Commit 89f200ed authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Renames sftfilepath -> sftfilepattern

This renames the input sftfilepath to sftfilepattern and adds
documentation on how that should be used, i.e. a colon separated list of
wildstring or exact matches. In globbing for all matches, the colon
split is added in. sftfilepath is still used by `Writer` since
an exact path is known.
parent 54b82bdb
...@@ -24,7 +24,7 @@ nwalkers = 100 ...@@ -24,7 +24,7 @@ nwalkers = 100
nsteps = [500, 500] nsteps = [500, 500]
mcmc = MCMCSearch(label='computing_the_Bayes_factor', outdir='data', mcmc = MCMCSearch(label='computing_the_Bayes_factor', outdir='data',
sftfilepath='data/*basic*sft', theta_prior=theta_prior, sftfilepattern='data/*basic*sft', theta_prior=theta_prior,
tref=tref, tstart=tstart, tend=tend, nsteps=nsteps, tref=tref, tstart=tstart, tend=tend, nsteps=nsteps,
nwalkers=nwalkers, ntemps=ntemps, nwalkers=nwalkers, ntemps=ntemps,
log10temperature_min=log10temperature_min) log10temperature_min=log10temperature_min)
......
...@@ -26,7 +26,7 @@ run_setup = [(1000, 50), (1000, 25), (1000, 1, False), ...@@ -26,7 +26,7 @@ run_setup = [(1000, 50), (1000, 25), (1000, 1, False),
mcmc = pyfstat.MCMCFollowUpSearch( mcmc = pyfstat.MCMCFollowUpSearch(
label='follow_up', outdir='data', label='follow_up', outdir='data',
sftfilepath='data/*basic*sft', theta_prior=theta_prior, tref=tref, sftfilepattern='data/*basic*sft', theta_prior=theta_prior, tref=tref,
minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers, minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers,
ntemps=ntemps, log10temperature_min=log10temperature_min) ntemps=ntemps, log10temperature_min=log10temperature_min)
mcmc.run(run_setup) mcmc.run(run_setup)
......
...@@ -53,7 +53,7 @@ nsteps = [50, 50] ...@@ -53,7 +53,7 @@ nsteps = [50, 50]
mcmc = pyfstat.MCMCSearch( mcmc = pyfstat.MCMCSearch(
label='fully_coherent_search_using_MCMC', outdir='data', label='fully_coherent_search_using_MCMC', outdir='data',
sftfilepath='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref, sftfilepattern='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref,
minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers,
ntemps=ntemps, log10temperature_min=log10temperature_min) ntemps=ntemps, log10temperature_min=log10temperature_min)
mcmc.run(context='paper', subtractions=[30, -1e-10]) mcmc.run(context='paper', subtractions=[30, -1e-10])
......
...@@ -26,7 +26,7 @@ nwalkers = 100 ...@@ -26,7 +26,7 @@ nwalkers = 100
nsteps = [500, 500] nsteps = [500, 500]
mcmc = MCMCSearch('fully_coherent_search_using_MCMC_on_glitching_data', 'data', mcmc = MCMCSearch('fully_coherent_search_using_MCMC_on_glitching_data', 'data',
sftfilepath='data/*_glitch*.sft', sftfilepattern='data/*_glitch*.sft',
theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend, theta_prior=theta_prior, tref=tref, minStartTime=tstart, maxStartTime=tend,
nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps,
log10temperature_min=log10temperature_min) log10temperature_min=log10temperature_min)
......
...@@ -17,7 +17,7 @@ Delta = np.radians(22.0144) ...@@ -17,7 +17,7 @@ Delta = np.radians(22.0144)
tref = tstart + .5 * Tspan tref = tstart + .5 * Tspan
sftfilepath = 'data/*glitching_signal*sft' sftfilepattern = 'data/*glitching_signal*sft'
F0_width = np.sqrt(3)/(np.pi*Tspan) F0_width = np.sqrt(3)/(np.pi*Tspan)
F1_width = np.sqrt(45/4.)/(np.pi*Tspan**2) F1_width = np.sqrt(45/4.)/(np.pi*Tspan**2)
...@@ -45,7 +45,7 @@ theta_prior = {'F0': {'type': 'unif', ...@@ -45,7 +45,7 @@ theta_prior = {'F0': {'type': 'unif',
} }
search = pyfstat.MCMCGlitchSearch( search = pyfstat.MCMCGlitchSearch(
label=label, outdir=outdir, sftfilepath=sftfilepath, label=label, outdir=outdir, sftfilepattern=sftfilepattern,
theta_prior=theta_prior, nglitch=1, tref=tref, nsteps=[500, 500], theta_prior=theta_prior, nglitch=1, tref=tref, nsteps=[500, 500],
ntemps=3, log10temperature_min=-0.5, minStartTime=tstart, ntemps=3, log10temperature_min=-0.5, minStartTime=tstart,
maxStartTime=tstart+Tspan) maxStartTime=tstart+Tspan)
......
...@@ -31,7 +31,7 @@ nsteps = [5000, 1000, 1000] ...@@ -31,7 +31,7 @@ nsteps = [5000, 1000, 1000]
mcmc = pyfstat.MCMCGlitchSearch( mcmc = pyfstat.MCMCGlitchSearch(
'semi_coherent_glitch_search_using_MCMC', 'data', 'semi_coherent_glitch_search_using_MCMC', 'data',
sftfilepath='data/*_glitch*sft', theta_prior=theta_prior, tref=tref, sftfilepattern='data/*_glitch*sft', theta_prior=theta_prior, tref=tref,
tstart=tstart, tend=tend, nsteps=nsteps, nwalkers=nwalkers, tstart=tstart, tend=tend, nsteps=nsteps, nwalkers=nwalkers,
scatter_val=1e-10, nglitch=1, ntemps=ntemps, scatter_val=1e-10, nglitch=1, ntemps=ntemps,
log10temperature_min=log10temperature_min) log10temperature_min=log10temperature_min)
......
...@@ -25,7 +25,7 @@ nsteps = [500, 500, 500] ...@@ -25,7 +25,7 @@ nsteps = [500, 500, 500]
mcmc = pyfstat.MCMCSemiCoherentSearch( mcmc = pyfstat.MCMCSemiCoherentSearch(
label='semi_coherent_search_using_MCMC', outdir='data', nsegs=20, label='semi_coherent_search_using_MCMC', outdir='data', nsegs=20,
sftfilepath='data/*basic*sft', theta_prior=theta_prior, tref=tref, sftfilepattern='data/*basic*sft', theta_prior=theta_prior, tref=tref,
minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers, minStartTime=tstart, maxStartTime=tend, nsteps=nsteps, nwalkers=nwalkers,
ntemps=ntemps, log10temperature_min=log10temperature_min) ntemps=ntemps, log10temperature_min=log10temperature_min)
mcmc.run() mcmc.run()
......
...@@ -34,7 +34,7 @@ nwalkers = 100 ...@@ -34,7 +34,7 @@ nwalkers = 100
nsteps = [1000, 1000, 5000] nsteps = [1000, 1000, 5000]
mcmc = pyfstat.MCMCGlitchSearch( mcmc = pyfstat.MCMCGlitchSearch(
'semi_coherent_twoglitch_search', 'data', sftfilepath='data/*twoglitch*sft', 'semi_coherent_twoglitch_search', 'data', sftfilepattern='data/*twoglitch*sft',
theta_prior=theta_prior, tref=tref, tstart=tstart, theta_prior=theta_prior, tref=tref, tstart=tstart,
tend=tend, nsteps=nsteps, nwalkers=nwalkers, scatter_val=1e-10, nglitch=2) tend=tend, nsteps=nsteps, nwalkers=nwalkers, scatter_val=1e-10, nglitch=2)
......
...@@ -27,7 +27,7 @@ data.make_data() ...@@ -27,7 +27,7 @@ data.make_data()
DeltaF0 = 1e-5 DeltaF0 = 1e-5
search = pyfstat.FrequencySlidingWindow( search = pyfstat.FrequencySlidingWindow(
label='sliding_window', outdir='data', sftfilepath='data/*sliding_window*sft', label='sliding_window', outdir='data', sftfilepattern='data/*sliding_window*sft',
F0s=[F0-DeltaF0, F0+DeltaF0, DeltaF0/100.], F1=F1, F2=0, F0s=[F0-DeltaF0, F0+DeltaF0, DeltaF0/100.], F1=F1, F2=0,
Alpha=Alpha, Delta=Delta, tref=tref, minStartTime=tstart, Alpha=Alpha, Delta=Delta, tref=tref, minStartTime=tstart,
maxStartTime=tend, window_size=25*86400, window_delta=1*86400) maxStartTime=tend, window_size=25*86400, window_delta=1*86400)
......
...@@ -40,7 +40,7 @@ nsteps = [100, 100] ...@@ -40,7 +40,7 @@ nsteps = [100, 100]
mcmc = pyfstat.MCMCTransientSearch( mcmc = pyfstat.MCMCTransientSearch(
label='transient_search', outdir='data', label='transient_search', outdir='data',
sftfilepath='data/*simulated_transient_signal*sft', sftfilepattern='data/*simulated_transient_signal*sft',
theta_prior=theta_prior, tref=tref, minStartTime=minStartTime, theta_prior=theta_prior, tref=tref, minStartTime=minStartTime,
maxStartTime=maxStartTime, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps, maxStartTime=maxStartTime, nsteps=nsteps, nwalkers=nwalkers, ntemps=ntemps,
log10temperature_min=log10temperature_min) log10temperature_min=log10temperature_min)
......
...@@ -55,7 +55,7 @@ nsteps = [100, 100] ...@@ -55,7 +55,7 @@ nsteps = [100, 100]
mcmc = pyfstat.MCMCFollowUpSearch( mcmc = pyfstat.MCMCFollowUpSearch(
label='weak_signal_follow_up', outdir='data', label='weak_signal_follow_up', outdir='data',
sftfilepath='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref, sftfilepattern='data/*'+data_label+'*sft', theta_prior=theta_prior, tref=tref,
minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers, nsteps=nsteps, minStartTime=tstart, maxStartTime=tend, nwalkers=nwalkers, nsteps=nsteps,
ntemps=ntemps, log10temperature_min=log10temperature_min, ntemps=ntemps, log10temperature_min=log10temperature_min,
scatter_val=scatter_val) scatter_val=scatter_val)
......
...@@ -174,16 +174,15 @@ class BaseSearchClass(object): ...@@ -174,16 +174,15 @@ class BaseSearchClass(object):
return thetas return thetas
def _get_list_of_matching_sfts(self): def _get_list_of_matching_sfts(self):
# first make sure we have a list of paths, to avoid """ Returns a list of sfts matching the sftfilepattern """
# list comprehension trying to glob each single character sftfilepatternlist = np.atleast_1d(self.sftfilepattern.split(';'))
sftfilepathlist = np.atleast_1d(self.sftfilepath) matches = [glob.glob(p) for p in sftfilepatternlist]
matches = [glob.glob(p) for p in sftfilepathlist]
matches = [item for sublist in matches for item in sublist] matches = [item for sublist in matches for item in sublist]
if len(matches) > 0: if len(matches) > 0:
return matches return matches
else: else:
raise IOError('No sfts found matching {}'.format( raise IOError('No sfts found matching {}'.format(
self.sftfilepath)) self.sftfilepattern))
class ComputeFstat(object): class ComputeFstat(object):
...@@ -193,7 +192,7 @@ class ComputeFstat(object): ...@@ -193,7 +192,7 @@ class ComputeFstat(object):
sun_ephem_default = sun_ephem sun_ephem_default = sun_ephem
@helper_functions.initializer @helper_functions.initializer
def __init__(self, tref, sftfilepath=None, minStartTime=None, def __init__(self, tref, sftfilepattern=None, minStartTime=None,
maxStartTime=None, binary=False, transient=True, BSGL=False, maxStartTime=None, binary=False, transient=True, BSGL=False,
detectors=None, minCoverFreq=None, maxCoverFreq=None, detectors=None, minCoverFreq=None, maxCoverFreq=None,
earth_ephem=None, sun_ephem=None, injectSources=None, earth_ephem=None, sun_ephem=None, injectSources=None,
...@@ -203,8 +202,9 @@ class ComputeFstat(object): ...@@ -203,8 +202,9 @@ class ComputeFstat(object):
---------- ----------
tref: int tref: int
GPS seconds of the reference time. GPS seconds of the reference time.
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
minStartTime, maxStartTime: float GPStime minStartTime, maxStartTime: float GPStime
Only use SFTs with timestemps starting from (including, excluding) Only use SFTs with timestemps starting from (including, excluding)
this epoch this epoch
...@@ -250,7 +250,7 @@ class ComputeFstat(object): ...@@ -250,7 +250,7 @@ class ComputeFstat(object):
def get_SFTCatalog(self): def get_SFTCatalog(self):
if hasattr(self, 'SFTCatalog'): if hasattr(self, 'SFTCatalog'):
return return
if self.sftfilepath is None: if self.sftfilepattern is None:
for k in ['minStartTime', 'maxStartTime', 'detectors']: for k in ['minStartTime', 'maxStartTime', 'detectors']:
if getattr(self, k) is None: if getattr(self, k) is None:
raise ValueError('You must provide "{}" to injectSources' raise ValueError('You must provide "{}" to injectSources'
...@@ -285,8 +285,8 @@ class ComputeFstat(object): ...@@ -285,8 +285,8 @@ class ComputeFstat(object):
constraints.maxStartTime = lal.LIGOTimeGPS(self.maxStartTime) constraints.maxStartTime = lal.LIGOTimeGPS(self.maxStartTime)
logging.info('Loading data matching pattern {}'.format( logging.info('Loading data matching pattern {}'.format(
self.sftfilepath)) self.sftfilepattern))
SFTCatalog = lalpulsar.SFTdataFind(self.sftfilepath, constraints) SFTCatalog = lalpulsar.SFTdataFind(self.sftfilepattern, constraints)
detector_names = list(set([d.header.name for d in SFTCatalog.data])) detector_names = list(set([d.header.name for d in SFTCatalog.data]))
self.detector_names = detector_names self.detector_names = detector_names
SFT_timestamps = [d.header.epoch for d in SFTCatalog.data] SFT_timestamps = [d.header.epoch for d in SFTCatalog.data]
...@@ -572,7 +572,7 @@ class ComputeFstat(object): ...@@ -572,7 +572,7 @@ class ComputeFstat(object):
times = np.linspace(self.minStartTime, self.maxStartTime, N+1)[1:] times = np.linspace(self.minStartTime, self.maxStartTime, N+1)[1:]
times = np.insert(times, 0, self.minStartTime + 86400/2.) times = np.insert(times, 0, self.minStartTime + 86400/2.)
out = [predict_fstat(minStartTime=self.minStartTime, maxStartTime=t, out = [predict_fstat(minStartTime=self.minStartTime, maxStartTime=t,
sftfilepattern=self.sftfilepath, IFO=IFO, sftfilepattern=self.sftfilepattern, IFO=IFO,
**pfs_input) for t in times] **pfs_input) for t in times]
pfs, pfs_sigma = np.array(out).T pfs, pfs_sigma = np.array(out).T
return times, pfs, pfs_sigma return times, pfs, pfs_sigma
...@@ -647,7 +647,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat): ...@@ -647,7 +647,7 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
""" A semi-coherent search """ """ A semi-coherent search """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, tref, nsegs=None, sftfilepath=None, def __init__(self, label, outdir, tref, nsegs=None, sftfilepattern=None,
binary=False, BSGL=False, minStartTime=None, binary=False, BSGL=False, minStartTime=None,
maxStartTime=None, minCoverFreq=None, maxCoverFreq=None, maxStartTime=None, minCoverFreq=None, maxCoverFreq=None,
detectors=None, earth_ephem=None, sun_ephem=None, detectors=None, earth_ephem=None, sun_ephem=None,
...@@ -661,8 +661,9 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat): ...@@ -661,8 +661,9 @@ class SemiCoherentSearch(BaseSearchClass, ComputeFstat):
GPS seconds of the reference time, and start and end of the data. GPS seconds of the reference time, and start and end of the data.
nsegs: int nsegs: int
The (fixed) number of segments The (fixed) number of segments
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
For all other parameters, see pyfstat.ComputeFStat. For all other parameters, see pyfstat.ComputeFStat.
""" """
...@@ -776,7 +777,7 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat): ...@@ -776,7 +777,7 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, tref, minStartTime, maxStartTime, def __init__(self, label, outdir, tref, minStartTime, maxStartTime,
nglitch=0, sftfilepath=None, theta0_idx=0, BSGL=False, nglitch=0, sftfilepattern=None, theta0_idx=0, BSGL=False,
minCoverFreq=None, maxCoverFreq=None, assumeSqrtSX=None, minCoverFreq=None, maxCoverFreq=None, assumeSqrtSX=None,
detectors=None, earth_ephem=None, sun_ephem=None, detectors=None, earth_ephem=None, sun_ephem=None,
SSBprec=None, injectSources=None): SSBprec=None, injectSources=None):
...@@ -790,8 +791,9 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat): ...@@ -790,8 +791,9 @@ class SemiCoherentGlitchSearch(BaseSearchClass, ComputeFstat):
nglitch: int nglitch: int
The (fixed) number of glitches; this can zero, but occasionally The (fixed) number of glitches; this can zero, but occasionally
this causes issue (in which case just use ComputeFstat). this causes issue (in which case just use ComputeFstat).
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
theta0_idx, int theta0_idx, int
Index (zero-based) of which segment the theta refers to - uyseful Index (zero-based) of which segment the theta refers to - uyseful
if providing a tight prior on theta to allow the signal to jump if providing a tight prior on theta to allow the signal to jump
......
...@@ -17,7 +17,7 @@ from core import tqdm, args, earth_ephem, sun_ephem, read_par ...@@ -17,7 +17,7 @@ from core import tqdm, args, earth_ephem, sun_ephem, read_par
class GridSearch(BaseSearchClass): class GridSearch(BaseSearchClass):
""" Gridded search using ComputeFstat """ """ Gridded search using ComputeFstat """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, sftfilepath, F0s=[0], F1s=[0], F2s=[0], def __init__(self, label, outdir, sftfilepattern, F0s=[0], F1s=[0], F2s=[0],
Alphas=[0], Deltas=[0], tref=None, minStartTime=None, Alphas=[0], Deltas=[0], tref=None, minStartTime=None,
maxStartTime=None, nsegs=1, BSGL=False, minCoverFreq=None, maxStartTime=None, nsegs=1, BSGL=False, minCoverFreq=None,
maxCoverFreq=None, earth_ephem=None, sun_ephem=None, maxCoverFreq=None, earth_ephem=None, sun_ephem=None,
...@@ -28,8 +28,9 @@ class GridSearch(BaseSearchClass): ...@@ -28,8 +28,9 @@ class GridSearch(BaseSearchClass):
---------- ----------
label, outdir: str label, outdir: str
A label and directory to read/write data from/to A label and directory to read/write data from/to
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
F0s, F1s, F2s, delta_F0s, delta_F1s, tglitchs, Alphas, Deltas: tuple F0s, F1s, F2s, delta_F0s, delta_F1s, tglitchs, Alphas, Deltas: tuple
Length 3 tuple describing the grid for each parameter, e.g Length 3 tuple describing the grid for each parameter, e.g
[F0min, F0max, dF0], for a fixed value simply give [F0]. Unless [F0min, F0max, dF0], for a fixed value simply give [F0]. Unless
...@@ -56,7 +57,7 @@ class GridSearch(BaseSearchClass): ...@@ -56,7 +57,7 @@ class GridSearch(BaseSearchClass):
logging.info('Setting up search object') logging.info('Setting up search object')
if self.nsegs == 1: if self.nsegs == 1:
self.search = ComputeFstat( self.search = ComputeFstat(
tref=self.tref, sftfilepath=self.sftfilepath, tref=self.tref, sftfilepattern=self.sftfilepattern,
minCoverFreq=self.minCoverFreq, maxCoverFreq=self.maxCoverFreq, minCoverFreq=self.minCoverFreq, maxCoverFreq=self.maxCoverFreq,
earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem, earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem,
detectors=self.detectors, transient=False, detectors=self.detectors, transient=False,
...@@ -68,7 +69,7 @@ class GridSearch(BaseSearchClass): ...@@ -68,7 +69,7 @@ class GridSearch(BaseSearchClass):
else: else:
self.search = SemiCoherentSearch( self.search = SemiCoherentSearch(
label=self.label, outdir=self.outdir, tref=self.tref, label=self.label, outdir=self.outdir, tref=self.tref,
nsegs=self.nsegs, sftfilepath=self.sftfilepath, nsegs=self.nsegs, sftfilepattern=self.sftfilepattern,
BSGL=self.BSGL, minStartTime=self.minStartTime, BSGL=self.BSGL, minStartTime=self.minStartTime,
maxStartTime=self.maxStartTime, minCoverFreq=self.minCoverFreq, maxStartTime=self.maxStartTime, minCoverFreq=self.minCoverFreq,
maxCoverFreq=self.maxCoverFreq, detectors=self.detectors, maxCoverFreq=self.maxCoverFreq, detectors=self.detectors,
...@@ -106,7 +107,7 @@ class GridSearch(BaseSearchClass): ...@@ -106,7 +107,7 @@ class GridSearch(BaseSearchClass):
if os.path.isfile(self.out_file) is False: if os.path.isfile(self.out_file) is False:
logging.info('No old data found, continuing with grid search') logging.info('No old data found, continuing with grid search')
return False return False
if self.sftfilepath is not None: if self.sftfilepattern is not None:
oldest_sft = min([os.path.getmtime(f) for f in oldest_sft = min([os.path.getmtime(f) for f in
self._get_list_of_matching_sfts()]) self._get_list_of_matching_sfts()])
if os.path.getmtime(self.out_file) < oldest_sft: if os.path.getmtime(self.out_file) < oldest_sft:
...@@ -275,7 +276,7 @@ class GridSearch(BaseSearchClass): ...@@ -275,7 +276,7 @@ class GridSearch(BaseSearchClass):
class GridUniformPriorSearch(): class GridUniformPriorSearch():
def __init__(self, theta_prior, NF0, NF1, label, outdir, sftfilepath, def __init__(self, theta_prior, NF0, NF1, label, outdir, sftfilepattern,
tref, minStartTime, maxStartTime, minCoverFreq=None, tref, minStartTime, maxStartTime, minCoverFreq=None,
maxCoverFreq=None, BSGL=False, detectors=None, nsegs=1): maxCoverFreq=None, BSGL=False, detectors=None, nsegs=1):
dF0 = (theta_prior['F0']['upper'] - theta_prior['F0']['lower'])/NF0 dF0 = (theta_prior['F0']['upper'] - theta_prior['F0']['lower'])/NF0
...@@ -283,7 +284,7 @@ class GridUniformPriorSearch(): ...@@ -283,7 +284,7 @@ class GridUniformPriorSearch():
F0s = [theta_prior['F0']['lower'], theta_prior['F0']['upper'], dF0] F0s = [theta_prior['F0']['lower'], theta_prior['F0']['upper'], dF0]
F1s = [theta_prior['F1']['lower'], theta_prior['F1']['upper'], dF1] F1s = [theta_prior['F1']['lower'], theta_prior['F1']['upper'], dF1]
self.search = GridSearch( self.search = GridSearch(
label, outdir, sftfilepath, F0s=F0s, F1s=F1s, tref=tref, label, outdir, sftfilepattern, F0s=F0s, F1s=F1s, tref=tref,
Alphas=[theta_prior['Alpha']], Deltas=[theta_prior['Delta']], Alphas=[theta_prior['Alpha']], Deltas=[theta_prior['Delta']],
minStartTime=minStartTime, maxStartTime=maxStartTime, BSGL=BSGL, minStartTime=minStartTime, maxStartTime=maxStartTime, BSGL=BSGL,
detectors=detectors, minCoverFreq=minCoverFreq, detectors=detectors, minCoverFreq=minCoverFreq,
...@@ -299,7 +300,7 @@ class GridUniformPriorSearch(): ...@@ -299,7 +300,7 @@ class GridUniformPriorSearch():
class GridGlitchSearch(GridSearch): class GridGlitchSearch(GridSearch):
""" Grid search using the SemiCoherentGlitchSearch """ """ Grid search using the SemiCoherentGlitchSearch """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, sftfilepath=None, F0s=[0], def __init__(self, label, outdir, sftfilepattern=None, F0s=[0],
F1s=[0], F2s=[0], delta_F0s=[0], delta_F1s=[0], tglitchs=None, F1s=[0], F2s=[0], delta_F0s=[0], delta_F1s=[0], tglitchs=None,
Alphas=[0], Deltas=[0], tref=None, minStartTime=None, Alphas=[0], Deltas=[0], tref=None, minStartTime=None,
maxStartTime=None, minCoverFreq=None, maxCoverFreq=None, maxStartTime=None, minCoverFreq=None, maxCoverFreq=None,
...@@ -310,8 +311,9 @@ class GridGlitchSearch(GridSearch): ...@@ -310,8 +311,9 @@ class GridGlitchSearch(GridSearch):
---------- ----------
label, outdir: str label, outdir: str
A label and directory to read/write data from/to A label and directory to read/write data from/to
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
F0s, F1s, F2s, delta_F0s, delta_F1s, tglitchs, Alphas, Deltas: tuple F0s, F1s, F2s, delta_F0s, delta_F1s, tglitchs, Alphas, Deltas: tuple
Length 3 tuple describing the grid for each parameter, e.g Length 3 tuple describing the grid for each parameter, e.g
[F0min, F0max, dF0], for a fixed value simply give [F0]. [F0min, F0max, dF0], for a fixed value simply give [F0].
...@@ -328,7 +330,7 @@ class GridGlitchSearch(GridSearch): ...@@ -328,7 +330,7 @@ class GridGlitchSearch(GridSearch):
self.sun_ephem = self.sun_ephem_default self.sun_ephem = self.sun_ephem_default
self.search = SemiCoherentGlitchSearch( self.search = SemiCoherentGlitchSearch(
label=label, outdir=outdir, sftfilepath=self.sftfilepath, label=label, outdir=outdir, sftfilepattern=self.sftfilepattern,
tref=tref, minStartTime=minStartTime, maxStartTime=maxStartTime, tref=tref, minStartTime=minStartTime, maxStartTime=maxStartTime,
minCoverFreq=minCoverFreq, maxCoverFreq=maxCoverFreq, minCoverFreq=minCoverFreq, maxCoverFreq=maxCoverFreq,
earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem, earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem,
...@@ -357,7 +359,7 @@ class GridGlitchSearch(GridSearch): ...@@ -357,7 +359,7 @@ class GridGlitchSearch(GridSearch):
class FrequencySlidingWindow(GridSearch): class FrequencySlidingWindow(GridSearch):
""" A sliding-window search over the Frequency """ """ A sliding-window search over the Frequency """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, sftfilepath, F0s, F1, F2, def __init__(self, label, outdir, sftfilepattern, F0s, F1, F2,
Alpha, Delta, tref, minStartTime=None, Alpha, Delta, tref, minStartTime=None,
maxStartTime=None, window_size=10*86400, window_delta=86400, maxStartTime=None, window_size=10*86400, window_delta=86400,
BSGL=False, minCoverFreq=None, maxCoverFreq=None, BSGL=False, minCoverFreq=None, maxCoverFreq=None,
...@@ -368,8 +370,9 @@ class FrequencySlidingWindow(GridSearch): ...@@ -368,8 +370,9 @@ class FrequencySlidingWindow(GridSearch):
---------- ----------
label, outdir: str label, outdir: str
A label and directory to read/write data from/to A label and directory to read/write data from/to
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
F0s: array F0s: array
Frequency range Frequency range
F1, F2, Alpha, Delta: float F1, F2, Alpha, Delta: float
...@@ -397,7 +400,7 @@ class FrequencySlidingWindow(GridSearch): ...@@ -397,7 +400,7 @@ class FrequencySlidingWindow(GridSearch):
def inititate_search_object(self): def inititate_search_object(self):
logging.info('Setting up search object') logging.info('Setting up search object')
self.search = ComputeFstat( self.search = ComputeFstat(
tref=self.tref, sftfilepath=self.sftfilepath, tref=self.tref, sftfilepattern=self.sftfilepattern,
minCoverFreq=self.minCoverFreq, maxCoverFreq=self.maxCoverFreq, minCoverFreq=self.minCoverFreq, maxCoverFreq=self.maxCoverFreq,
earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem, earth_ephem=self.earth_ephem, sun_ephem=self.sun_ephem,
detectors=self.detectors, transient=True, detectors=self.detectors, transient=True,
...@@ -473,7 +476,7 @@ class FrequencySlidingWindow(GridSearch): ...@@ -473,7 +476,7 @@ class FrequencySlidingWindow(GridSearch):
class DMoff_NO_SPIN(GridSearch): class DMoff_NO_SPIN(GridSearch):
""" DMoff test using SSBPREC_NO_SPIN """ """ DMoff test using SSBPREC_NO_SPIN """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, par, label, outdir, sftfilepath, minStartTime=None, def __init__(self, par, label, outdir, sftfilepattern, minStartTime=None,
maxStartTime=None, minCoverFreq=None, maxCoverFreq=None, maxStartTime=None, minCoverFreq=None, maxCoverFreq=None,
earth_ephem=None, sun_ephem=None, detectors=None, earth_ephem=None, sun_ephem=None, detectors=None,
injectSources=None, assumeSqrtSX=None): injectSources=None, assumeSqrtSX=None):
...@@ -485,8 +488,9 @@ class DMoff_NO_SPIN(GridSearch): ...@@ -485,8 +488,9 @@ class DMoff_NO_SPIN(GridSearch):
and 'tref') or a path to a .par file to read in the F0, F1 etc and 'tref') or a path to a .par file to read in the F0, F1 etc
label, outdir: str label, outdir: str
A label and directory to read/write data from/to A label and directory to read/write data from/to
sftfilepath: str sftfilepattern: str
File patern to match SFTs Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons.
minStartTime, maxStartTime: int minStartTime, maxStartTime: int
GPS seconds of the start time and end time GPS seconds of the start time and end time
......
...@@ -36,7 +36,7 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -36,7 +36,7 @@ class MCMCSearch(core.BaseSearchClass):
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label, outdir, theta_prior, tref, minStartTime, def __init__(self, label, outdir, theta_prior, tref, minStartTime,
maxStartTime, sftfilepath=None, nsteps=[100, 100], maxStartTime, sftfilepattern=None, nsteps=[100, 100],
nwalkers=100, ntemps=1, log10temperature_min=-5, nwalkers=100, ntemps=1, log10temperature_min=-5,
theta_initial=None, scatter_val=1e-10, rhohatmax=1000, theta_initial=None, scatter_val=1e-10, rhohatmax=1000,
binary=False, BSGL=False, minCoverFreq=None, SSBprec=None, binary=False, BSGL=False, minCoverFreq=None, SSBprec=None,
...@@ -46,7 +46,7 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -46,7 +46,7 @@ class MCMCSearch(core.BaseSearchClass):
Parameters Parameters
label, outdir: str label, outdir: str
A label and directory to read/write data from/to A label and directory to read/write data from/to
sftfilepath: str sftfilepattern: str
Pattern to match SFTs using wildcards (*?) and ranges [0-9]; Pattern to match SFTs using wildcards (*?) and ranges [0-9];
mutiple patterns can be given separated by colons. mutiple patterns can be given separated by colons.
theta_prior: dict theta_prior: dict
...@@ -94,10 +94,10 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -94,10 +94,10 @@ class MCMCSearch(core.BaseSearchClass):
os.mkdir(outdir) os.mkdir(outdir)
self._add_log_file() self._add_log_file()
logging.info('Set-up MCMC search for model {}'.format(self.label)) logging.info('Set-up MCMC search for model {}'.format(self.label))
if sftfilepath: if sftfilepattern:
logging.info('Using data {}'.format(self.sftfilepath)) logging.info('Using data {}'.format(self.sftfilepattern))
else: else:
logging.info('No sftfilepath given')