Compare commits

...

2 commits

Author SHA1 Message Date
Sakimori 6d7dd549fe
bus error fix attempt 3 2025-07-31 16:55:30 -04:00
Sakimori 7beee3c29c
bus error fix attempt 2 2025-07-31 16:53:07 -04:00

View file

@ -132,8 +132,8 @@ def addBurst(values):
pulseNum = rng.integers(1, high=MAX_BURSTS, endpoint=True)
logger.info(f"{basename} loaded. Sampling {pulseNum} pulse(s) {values.nsamp} times.")
starts = np.linspace(samples//4, 3*(samples//4), num=pulseNum, dtype=int)
while pulseNum > 0:
start = starts[pulseNum-1]
for run in range(pulseNum):
start = starts[run]
#create pulse
#check if this is part of a rng run
@ -164,16 +164,21 @@ def addBurst(values):
logger.info("Injecting pulse and saving file.")
#inject pulse
if run != pulseNum-1:
savename = f"{basename}_injected_{run}.fil"
else:
savename = f"{basename}_injected.fil"
inject.inject_constant_into_file(
yr_input = filterbankObj,
pulse = pulse,
start = start,
out_fil = path.join("./", f"{basename}_injected.fil")
out_fil = path.join("./", savename)
)
sleep(1) #was a write then read too fast causing issues?
#reload into object
filterbankObj = Your(path.join("./", f"{basename}_injected.fil"))
pulseNum -= 1
if run != pulseNum-1:
filterbankObj = Your(path.join("./", f"{basename}_injected_{run}.fil"))
if run > 0:
os.remove(path.join("./", f"{basename}_injected_{run-1}.fil"))
os.remove(path.join("./", f"{basename}_trunc.fil")) #delete truncated file to save 2GB of disk space
logger.info(f"Truncated file removed.")