From b736d3c89212ed7b7d8344c382abdd3c2b854086 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Thu, 7 Aug 2025 12:29:08 -0400 Subject: [PATCH] scale nsamp with pulse width --- signalgen.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/signalgen.py b/signalgen.py index 0244ea1..d6b2a0a 100755 --- a/signalgen.py +++ b/signalgen.py @@ -30,6 +30,7 @@ LOG_MAX_DM = 3.5 LOG_MIN_WIDTH = 0 LOG_MAX_WIDTH = 3 #in ms MAX_BURSTS = 4 +LOG_FIDUCIAL_WIDTH = -2.6 rng = np.random.default_rng() #This function from https://josephwkania.github.io/will/examples/inject_pulse.html#Show-how-we-can-inject-a-pulse-into-a-GREENBURST-filterbank. @@ -168,7 +169,11 @@ def addBurst(values): nscint=0, bandpass = bpWeights ) - pulse = pulseObj.sample_pulse(nsamp=values.nsamp) #30000 by default + + #We need to scale the number of samples with pulse width to (hopefully) maintain constant peak flux + scaleFac = (pWidth/(10**(LOG_FIDUCIAL_WIDTH))) + scaledSamps = values.nsamp * scaleFac + pulse = pulseObj.sample_pulse(nsamp=scaledSamps) #30000 by default logger.info("Injecting pulse and saving file.") #inject pulse