switched to sigproc file generation
This commit is contained in:
parent
8d0629c6cf
commit
acfa690900
15
signalgen.py
15
signalgen.py
|
@ -11,6 +11,7 @@ from jess.dispersion import dedisperse
|
|||
from jess.fitters import median_fitter
|
||||
from scipy.stats import median_abs_deviation
|
||||
from your import Your, Writer
|
||||
from your.formats.filwriter import make_sigproc_object
|
||||
from will import create, inject
|
||||
|
||||
|
||||
|
@ -79,7 +80,7 @@ def addBurst(values):
|
|||
basename = path.basename(values.file)
|
||||
samples = 8096
|
||||
|
||||
#the full filterbanks use 64GB in RAM, so we write out a truncated version and load that instead.
|
||||
#the full filterbanks use 64GB in RAM when injecting burst, so we write out a truncated version and load that instead.
|
||||
filWriter = Writer(filterbankObj, outdir="./", outname = f"{basename}_trunc", nstart = 0, nsamp = samples)
|
||||
filWriter.to_fil()
|
||||
#replace filterbankObj object and reload spectra (spectra should be the same but just in case)
|
||||
|
@ -121,11 +122,15 @@ def addBurst(values):
|
|||
)
|
||||
|
||||
logger.info("Saving plot and filterbank.")
|
||||
#and save the new plot and filterbank file
|
||||
#and save the new plot
|
||||
show_dynamic(injectedSpectra, f"{basename} Dynamic Spectra and {values.dm} DM Pulse", save=True)
|
||||
filWriter = Writer(filterbankObj, outdir="./", outname = f"{basename}_injected", nstart = 0, nsamp = samples)
|
||||
filWriter.to_fil(data=injectedSpectra)
|
||||
logger.info(f"{basename}_injected.fil successfully written.")
|
||||
#now generate new filterbank file
|
||||
|
||||
sigprocObj = make_sigproc_object(**(filterbankObj.your_header))
|
||||
newName = f"{basename}_injected.fil"
|
||||
sigprocObj.write_header(newName)
|
||||
sigprocObj.append_spectra(injectedSpectra, newName)
|
||||
logger.info(f"{newName} successfully written.")
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue