moved to log space sampling for DM and pulse width
This commit is contained in:
parent
c4d88037f3
commit
d9dad7cd68
14
signalgen.py
14
signalgen.py
|
@ -24,10 +24,10 @@ logFmt = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|||
logging.basicConfig(level=logging.INFO, format=logFmt)
|
||||
|
||||
#Set values for random sampling
|
||||
MIN_DM = 300
|
||||
MAX_DM = 10000
|
||||
MIN_WIDTH = 0.001 #1 ms
|
||||
MAX_WIDTH = 1 #1 s
|
||||
LOG_MIN_DM = 2.5
|
||||
LOG_MAX_DM = 3.5
|
||||
LOG_MIN_WIDTH = 0
|
||||
LOG_MAX_WIDTH = 3 #in ms
|
||||
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.
|
||||
|
@ -92,7 +92,11 @@ def randomDMandWidth():
|
|||
"""
|
||||
Helper function that returns (DM, pulseWidth) tuple with bounds set at start of script.
|
||||
"""
|
||||
return (rng.uniform(low=MIN_DM, high=MAX_DM), rng.uniform(low=MIN_WIDTH, high=MAX_WIDTH))
|
||||
log_dm = rng.uniform(low=LOG_MIN_DM, high=LOG_MAX_DM)
|
||||
log_pw = rng.uniform(low=LOG_MIN_WIDTH, high=LOG_MAX_WIDTH)
|
||||
dm = 10**log_dm
|
||||
pw = 10**(log_pw - 3) #-3 to convert ms to s
|
||||
return (dm, pw)
|
||||
|
||||
|
||||
def addBurst(values):
|
||||
|
|
Loading…
Reference in a new issue