From cb7b565808b3b962fc9196856ffb378c7af0293f Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Mon, 2 Oct 2017 18:21:34 +0200 Subject: [PATCH] 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 --- pyfstat/core.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pyfstat/core.py b/pyfstat/core.py index 0ff84cb..a67c3d0 100755 --- a/pyfstat/core.py +++ b/pyfstat/core.py @@ -119,7 +119,10 @@ def _get_dictionary_from_lines(lines, comments, raise_error): try: key, val = line.rstrip('\n').split('=') key = key.strip() - d[key] = np.float64(eval(val.rstrip('; '))) + try: + d[key] = np.float64(eval(val.rstrip('; '))) + except NameError: + d[key] = val.rstrip('; ') except SyntaxError: if raise_error: raise IOError('Line {} not understood'.format(line)) @@ -405,7 +408,7 @@ class ComputeFstat(BaseSearchClass): constraints = lalpulsar.SFTConstraints() if self.detectors: if ',' in self.detectors: - logging.info('Using all detector data') + constraints.detector = self.detectors else: constraints.detector = self.detectors if self.minStartTime: @@ -493,7 +496,12 @@ class ComputeFstat(BaseSearchClass): PP.Amp.psi = self.injectSources['psi'] PP.Doppler.Alpha = self.injectSources['Alpha'] PP.Doppler.Delta = self.injectSources['Delta'] - PP.Doppler.fkdot = np.array(self.injectSources['fkdot']) + if 'fkdot' in self.injectSources: + 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 if 't0' not in self.injectSources: PP.Transient.type = lalpulsar.TRANSIENT_NONE -- GitLab