Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • add-higher-spindown-components
  • adds-header-to-grid-search
  • develop-DK
  • develop-GA
  • master
  • timeFstatmap
  • v1.0.1
  • v1.1.0
  • v1.1.2
  • v1.2
10 results

Target

Select target project
  • GregAshton/PyFstat
  • Yuanhao.Zhang/PyFstat
  • dkeitel/PyFstat
3 results
Select Git revision
  • 72-improve-docs-for_optimal_setup
  • add-higher-spindown-components
  • develop-GA
  • master
  • os-path-join
  • v1.0.1
  • v1.1.0
  • v1.1.2
  • v1.2
  • v1.3
10 results
Show changes
Commits on Source (1)
...@@ -665,11 +665,11 @@ class ComputeFstat(BaseSearchClass): ...@@ -665,11 +665,11 @@ class ComputeFstat(BaseSearchClass):
tcw.init_transient_fstat_map_features( tcw.init_transient_fstat_map_features(
self.tCWFstatMapVersion == 'pycuda', self.cudaDeviceName)) self.tCWFstatMapVersion == 'pycuda', self.cudaDeviceName))
def get_fullycoherent_twoF(self, tstart, tend, F0, F1, F2, Alpha, Delta, def get_fullycoherent_twoF(self, tstart, tend, F0, F1, F2=0, F3=0,
asini=None, period=None, ecc=None, tp=None, Alpha=0, Delta=0, asini=None, period=None,
argp=None): ecc=None, tp=None, argp=None):
""" Returns twoF or ln(BSGL) fully-coherently at a single point """ """ Returns twoF or ln(BSGL) fully-coherently at a single point """
self.PulsarDopplerParams.fkdot = np.array([F0, F1, F2, 0, 0, 0, 0]) self.PulsarDopplerParams.fkdot = np.array([F0, F1, F2, F3, 0, 0, 0])
self.PulsarDopplerParams.Alpha = Alpha self.PulsarDopplerParams.Alpha = Alpha
self.PulsarDopplerParams.Delta = Delta self.PulsarDopplerParams.Delta = Delta
if self.binary: if self.binary:
...@@ -1155,8 +1155,9 @@ class SemiCoherentGlitchSearch(ComputeFstat): ...@@ -1155,8 +1155,9 @@ class SemiCoherentGlitchSearch(ComputeFstat):
ts, te = tboundaries[i], tboundaries[i+1] ts, te = tboundaries[i], tboundaries[i+1]
if te - ts > 1800: if te - ts > 1800:
twoFVal = self.get_fullycoherent_twoF( twoFVal = self.get_fullycoherent_twoF(
ts, te, theta_i_at_tref[1], theta_i_at_tref[2], tstart=ts, tend=te, F0=theta_i_at_tref[1],
theta_i_at_tref[3], Alpha, Delta) F2=theta_i_at_tref[2], F3=theta_i_at_tref[3],
Alpha=Alpha, Delta=Delta)
twoFSum += twoFVal twoFSum += twoFVal
if np.isfinite(twoFSum): if np.isfinite(twoFSum):
...@@ -1181,15 +1182,15 @@ class SemiCoherentGlitchSearch(ComputeFstat): ...@@ -1181,15 +1182,15 @@ class SemiCoherentGlitchSearch(ComputeFstat):
theta_post_glitch_at_glitch, tref - tglitch) theta_post_glitch_at_glitch, tref - tglitch)
twoFsegA = self.get_fullycoherent_twoF( twoFsegA = self.get_fullycoherent_twoF(
self.minStartTime, tglitch, theta[0], theta[1], theta[2], Alpha, self.minStartTime, tglitch, F0=theta[0], F1=theta[1], F2=theta[2],
Delta) Alpha=Alpha, Delta=Delta)
if tglitch == self.maxStartTime: if tglitch == self.maxStartTime:
return twoFsegA return twoFsegA
twoFsegB = self.get_fullycoherent_twoF( twoFsegB = self.get_fullycoherent_twoF(
tglitch, self.maxStartTime, theta_post_glitch[0], tglitch, self.maxStartTime, F0=theta_post_glitch[0],
theta_post_glitch[1], theta_post_glitch[2], Alpha, F1=theta_post_glitch[1], F2=theta_post_glitch[2], Alpha=Alpha,
Delta) Delta=Delta)
return twoFsegA + twoFsegB return twoFsegA + twoFsegB
...@@ -22,7 +22,7 @@ class Writer(BaseSearchClass): ...@@ -22,7 +22,7 @@ class Writer(BaseSearchClass):
""" Instance object for generating SFTs """ """ Instance object for generating SFTs """
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label='Test', tstart=700000000, duration=100*86400, def __init__(self, label='Test', tstart=700000000, duration=100*86400,
tref=None, F0=30, F1=1e-10, F2=0, Alpha=5e-3, tref=None, F0=30, F1=1e-10, F2=0, F3=0, F4=0, Alpha=5e-3,
Delta=6e-2, h0=0.1, cosi=0.0, psi=0.0, phi=0, Tsft=1800, Delta=6e-2, h0=0.1, cosi=0.0, psi=0.0, phi=0, Tsft=1800,
outdir=".", sqrtSX=1, Band=4, detectors='H1', outdir=".", sqrtSX=1, Band=4, detectors='H1',
minStartTime=None, maxStartTime=None, add_noise=True, minStartTime=None, maxStartTime=None, add_noise=True,
...@@ -37,7 +37,7 @@ class Writer(BaseSearchClass): ...@@ -37,7 +37,7 @@ class Writer(BaseSearchClass):
tref: float or None tref: float or None
reference time (default is None, which sets the reference time to reference time (default is None, which sets the reference time to
tstart) tstart)
F0, F1, F2, Alpha, Delta, h0, cosi, psi, phi: float F0, F1, F2, F3, F4, Alpha, Delta, h0, cosi, psi, phi: float
frequency, sky-position, and amplitude parameters frequency, sky-position, and amplitude parameters
Tsft: float Tsft: float
the sft duration the sft duration
...@@ -70,7 +70,8 @@ class Writer(BaseSearchClass): ...@@ -70,7 +70,8 @@ class Writer(BaseSearchClass):
self.data_duration = self.maxStartTime - self.minStartTime self.data_duration = self.maxStartTime - self.minStartTime
numSFTs = int(float(self.data_duration) / self.Tsft) numSFTs = int(float(self.data_duration) / self.Tsft)
self.theta = np.array([self.phi, self.F0, self.F1, self.F2]) self.theta = np.array([self.phi, self.F0, self.F1, self.F2, self.F3,
self.F4])
if os.path.isdir(self.outdir) is False: if os.path.isdir(self.outdir) is False:
os.makedirs(self.outdir) os.makedirs(self.outdir)
...@@ -93,7 +94,7 @@ class Writer(BaseSearchClass): ...@@ -93,7 +94,7 @@ class Writer(BaseSearchClass):
self.run_makefakedata() self.run_makefakedata()
def get_base_template(self, i, Alpha, Delta, h0, cosi, psi, phi, F0, def get_base_template(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
F1, F2, tref): F1, F2, F3, F4, tref):
return ( return (
"""[TS{}] """[TS{}]
Alpha = {:1.18e} Alpha = {:1.18e}
...@@ -105,35 +106,42 @@ phi0 = {:1.18e} ...@@ -105,35 +106,42 @@ phi0 = {:1.18e}
Freq = {:1.18e} Freq = {:1.18e}
f1dot = {:1.18e} f1dot = {:1.18e}
f2dot = {:1.18e} f2dot = {:1.18e}
f3dot = {:1.18e}
f4dot = {:1.18e}
refTime = {:10.6f}""") refTime = {:10.6f}""")
def get_single_config_line_cw( def get_single_config_line_cw(
self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref): self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4,
template = (self.get_base_template( tref):
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) + """\n""") template = (
self.get_base_template(
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4, tref)
+ """\n""")
return template.format( return template.format(
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4, tref)
def get_single_config_line_tcw( def get_single_config_line_tcw(
self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref, self, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4,
window, tstart, duration_days): tref, window, tstart, duration_days):
template = (self.get_base_template( template = (self.get_base_template(
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) + """ i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4, tref)
+ """
transientWindowType = {:s} transientWindowType = {:s}
transientStartTime = {:10.3f} transientStartTime = {:10.3f}
transientTauDays = {:1.3f}\n""") transientTauDays = {:1.3f}\n""")
return template.format(i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, return template.format(i, Alpha, Delta, h0, cosi, psi, phi, F0, F1,
F2, tref, window, tstart, duration_days) F2, F3, F4, tref, window, tstart, duration_days)
def get_single_config_line(self, i, Alpha, Delta, h0, cosi, psi, phi, F0, def get_single_config_line(self, i, Alpha, Delta, h0, cosi, psi, phi, F0,
F1, F2, tref, window, tstart, duration_days): F1, F2, F3, F4, tref, window, tstart,
duration_days):
if window == 'none': if window == 'none':
return self.get_single_config_line_cw( return self.get_single_config_line_cw(
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref) i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4, tref)
else: else:
return self.get_single_config_line_tcw( return self.get_single_config_line_tcw(
i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, tref, window, i, Alpha, Delta, h0, cosi, psi, phi, F0, F1, F2, F3, F4, tref,
tstart, duration_days) window, tstart, duration_days)
def make_cff(self): def make_cff(self):
""" """
...@@ -143,7 +151,7 @@ transientTauDays = {:1.3f}\n""") ...@@ -143,7 +151,7 @@ transientTauDays = {:1.3f}\n""")
content = self.get_single_config_line( content = self.get_single_config_line(
0, self.Alpha, self.Delta, self.h0, self.cosi, self.psi, 0, self.Alpha, self.Delta, self.h0, self.cosi, self.psi,
self.phi, self.F0, self.F1, self.F2, self.tref, self.phi, self.F0, self.F1, self.F2, self.F3, self.F4, self.tref,
self.transientWindowType, self.tstart, self.duration_days) self.transientWindowType, self.tstart, self.duration_days)
if self.check_if_cff_file_needs_rewritting(content): if self.check_if_cff_file_needs_rewritting(content):
...@@ -152,7 +160,7 @@ transientTauDays = {:1.3f}\n""") ...@@ -152,7 +160,7 @@ transientTauDays = {:1.3f}\n""")
config_file.close() config_file.close()
def calculate_fmin_Band(self): def calculate_fmin_Band(self):
self.fmin = self.F0 - .5 * self.Band self.fmin = np.max([self.F0 - .5 * self.Band, 0.1])
def check_cached_data_okay_to_use(self, cl_mfd): def check_cached_data_okay_to_use(self, cl_mfd):
""" Check if cached data exists and, if it does, if it can be used """ """ Check if cached data exists and, if it does, if it can be used """
...@@ -269,8 +277,8 @@ class GlitchWriter(Writer): ...@@ -269,8 +277,8 @@ class GlitchWriter(Writer):
@helper_functions.initializer @helper_functions.initializer
def __init__(self, label='Test', tstart=700000000, duration=100*86400, def __init__(self, label='Test', tstart=700000000, duration=100*86400,
dtglitch=None, delta_phi=0, delta_F0=0, delta_F1=0, dtglitch=None, delta_phi=0, delta_F0=0, delta_F1=0,
delta_F2=0, tref=None, F0=30, F1=1e-10, F2=0, Alpha=5e-3, delta_F2=0, tref=None, F0=30, F1=1e-10, F2=0, F3=0, F4=0,
Delta=6e-2, h0=0.1, cosi=0.0, psi=0.0, phi=0, Tsft=1800, Alpha=5e-3, Delta=6e-2, h0=0.1, cosi=0.0, psi=0.0, phi=0, Tsft=1800,
outdir=".", sqrtSX=1, Band=4, detectors='H1', outdir=".", sqrtSX=1, Band=4, detectors='H1',
minStartTime=None, maxStartTime=None, add_noise=True, minStartTime=None, maxStartTime=None, add_noise=True,
transientWindowType='rect'): transientWindowType='rect'):
...@@ -327,7 +335,7 @@ class GlitchWriter(Writer): ...@@ -327,7 +335,7 @@ class GlitchWriter(Writer):
self.durations_days = (tbs[1:] - tbs[:-1]) / 86400 self.durations_days = (tbs[1:] - tbs[:-1]) / 86400
self.delta_thetas = np.atleast_2d( self.delta_thetas = np.atleast_2d(
np.array([delta_phi, delta_F0, delta_F1, delta_F2]).T) np.array([delta_phi, delta_F0, delta_F1, delta_F2, 0, 0]).T)
def make_cff(self): def make_cff(self):
""" """
...@@ -343,8 +351,8 @@ class GlitchWriter(Writer): ...@@ -343,8 +351,8 @@ class GlitchWriter(Writer):
self.tbounds[:-1])): self.tbounds[:-1])):
line = self.get_single_config_line( line = self.get_single_config_line(
i, self.Alpha, self.Delta, self.h0, self.cosi, self.psi, i, self.Alpha, self.Delta, self.h0, self.cosi, self.psi,
t[0], t[1], t[2], t[3], self.tref, self.transientWindowType, t[0], t[1], t[2], t[3], t[4], t[5], self.tref,
ts, d) self.transientWindowType, ts, d)
content += line content += line
......
...@@ -102,12 +102,12 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -102,12 +102,12 @@ class MCMCSearch(core.BaseSearchClass):
""" """
symbol_dictionary = dict( symbol_dictionary = dict(
F0='$f$', F1='$\dot{f}$', F2='$\ddot{f}$', Alpha=r'$\alpha$', F0='$f$', F1='$\dot{f}$', F2='$\ddot{f}$', F3='$\dddot{f}$',
Delta='$\delta$', asini='asini', period='P', ecc='ecc', tp='tp', Alpha=r'$\alpha$', Delta='$\delta$', asini='asini', period='P',
argp='argp') ecc='ecc', tp='tp', argp='argp')
unit_dictionary = dict( unit_dictionary = dict(
F0='Hz', F1='Hz/s', F2='Hz/s$^2$', Alpha=r'rad', Delta='rad', F0='Hz', F1='Hz/s', F2='Hz/s$^2$', F3='Hz/s$^3$', Alpha=r'rad',
asini='', period='s', ecc='', tp='', argp='') Delta='rad', asini='', period='s', ecc='', tp='', argp='')
transform_dictionary = {} transform_dictionary = {}
@helper_functions.initializer @helper_functions.initializer
...@@ -184,18 +184,21 @@ class MCMCSearch(core.BaseSearchClass): ...@@ -184,18 +184,21 @@ class MCMCSearch(core.BaseSearchClass):
return twoF/2.0 + self.likelihoodcoef return twoF/2.0 + self.likelihoodcoef
def _unpack_input_theta(self): def _unpack_input_theta(self):
full_theta_keys = ['F0', 'F1', 'F2', 'Alpha', 'Delta'] full_theta_keys = ['F0', 'F1', 'F2', 'F3', 'Alpha', 'Delta']
if self.binary: if self.binary:
full_theta_keys += [ full_theta_keys += [
'asini', 'period', 'ecc', 'tp', 'argp'] 'asini', 'period', 'ecc', 'tp', 'argp']
full_theta_keys_copy = copy.copy(full_theta_keys) full_theta_keys_copy = copy.copy(full_theta_keys)
full_theta_symbols = ['$f$', '$\dot{f}$', '$\ddot{f}$', r'$\alpha$', full_theta_symbols = ['$f$', '$\dot{f}$', '$\ddot{f}$', r'$\ddot{f}$',
r'$\delta$'] r'$\alpha$', r'$\delta$']
if self.binary: if self.binary:
full_theta_symbols += [ full_theta_symbols += [
'asini', 'period', 'ecc', 'tp', 'argp'] 'asini', 'period', 'ecc', 'tp', 'argp']
for default in ['F1', 'F2', 'F3']:
if default not in self.theta_prior:
self.theta_prior[default] = 0
self.theta_keys = [] self.theta_keys = []
fixed_theta_dict = {} fixed_theta_dict = {}
for key, val in self.theta_prior.iteritems(): for key, val in self.theta_prior.iteritems():
......