Skip to content
Snippets Groups Projects
Commit cb7b5658 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Minor improvements to core

- Allow read_par to have strings in the value
- Fix bug in setting detector constraints
- If fkdot not given, attempt to create it
parent 83d9c498
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,10 @@ def _get_dictionary_from_lines(lines, comments, raise_error): ...@@ -119,7 +119,10 @@ def _get_dictionary_from_lines(lines, comments, raise_error):
try: try:
key, val = line.rstrip('\n').split('=') key, val = line.rstrip('\n').split('=')
key = key.strip() key = key.strip()
try:
d[key] = np.float64(eval(val.rstrip('; '))) d[key] = np.float64(eval(val.rstrip('; ')))
except NameError:
d[key] = val.rstrip('; ')
except SyntaxError: except SyntaxError:
if raise_error: if raise_error:
raise IOError('Line {} not understood'.format(line)) raise IOError('Line {} not understood'.format(line))
...@@ -405,7 +408,7 @@ class ComputeFstat(BaseSearchClass): ...@@ -405,7 +408,7 @@ class ComputeFstat(BaseSearchClass):
constraints = lalpulsar.SFTConstraints() constraints = lalpulsar.SFTConstraints()
if self.detectors: if self.detectors:
if ',' in self.detectors: if ',' in self.detectors:
logging.info('Using all detector data') constraints.detector = self.detectors
else: else:
constraints.detector = self.detectors constraints.detector = self.detectors
if self.minStartTime: if self.minStartTime:
...@@ -493,7 +496,12 @@ class ComputeFstat(BaseSearchClass): ...@@ -493,7 +496,12 @@ class ComputeFstat(BaseSearchClass):
PP.Amp.psi = self.injectSources['psi'] PP.Amp.psi = self.injectSources['psi']
PP.Doppler.Alpha = self.injectSources['Alpha'] PP.Doppler.Alpha = self.injectSources['Alpha']
PP.Doppler.Delta = self.injectSources['Delta'] PP.Doppler.Delta = self.injectSources['Delta']
if 'fkdot' in self.injectSources:
PP.Doppler.fkdot = np.array(self.injectSources['fkdot']) PP.Doppler.fkdot = np.array(self.injectSources['fkdot'])
else:
PP.Doppler.fkdot = np.zeros(lalpulsar.PULSAR_MAX_SPINS)
for i, key in enumerate(['F0', 'F1', 'F2']):
PP.Doppler.fkdot[i] = self.injectSources[key]
PP.Doppler.refTime = self.tref PP.Doppler.refTime = self.tref
if 't0' not in self.injectSources: if 't0' not in self.injectSources:
PP.Transient.type = lalpulsar.TRANSIENT_NONE PP.Transient.type = lalpulsar.TRANSIENT_NONE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment