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