From b8687b851d05662f9575cd8d4dfb2606d07bc07b Mon Sep 17 00:00:00 2001 From: Patrick Lazarus Date: Sun, 10 Jun 2012 01:46:39 +0200 Subject: [PATCH] Reset global variable to original value. Other minor changes. Add todo in sifting function. Change notes for long/short period rejections to include units (now ms instead of s). --- lib/python/sifting.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/python/sifting.py b/lib/python/sifting.py index 2b5545682..6053c9e3e 100644 --- a/lib/python/sifting.py +++ b/lib/python/sifting.py @@ -22,7 +22,7 @@ # Shortest period candidates to consider (s) short_period = 0.0005 # Ignore candidates with a sigma (from incoherent power summation) less than this -sigma_threshold = 5.0 #6.0 +sigma_threshold = 6.0 # Ignore candidates with a coherent power less than this c_pow_threshold = 100.0 # Ignore any candidates where at least one harmonic does not exceed this power @@ -284,8 +284,8 @@ def reject_longperiod(self): for ii in reversed(range(len(self.cands))): cand = self.cands[ii] if (cand.p > long_period): - cand.note = "Period is too long (%g > %g)" % \ - (cand.p, long_period) + cand.note = "Period is too long (%g ms > %g ms)" % \ + (cand.p*1000, long_period*1000) self.badcands_longperiod.append(self.cands.pop(ii)) def reject_shortperiod(self): @@ -301,8 +301,8 @@ def reject_shortperiod(self): for ii in reversed(range(len(self.cands))): cand = self.cands[ii] if (cand.p < short_period): - cand.note = "Period is too short (%g > %g)" % \ - (cand.p, short_period) + cand.note = "Period is too short (%g ms > %g ms)" % \ + (cand.p*1000, short_period*1000) self.badcands_shortperiod.append(self.cands.pop(ii)) def reject_knownbirds(self, birdie_freqs=[], birdie_periods=[]): @@ -729,7 +729,7 @@ def write_cand_report(self, reportfilenm=None): badcands = self.get_all_badcands() for badcand in badcands: reportfile.write("%s (%d)\n" % (str(badcand), len(badcand.hits))) - reportfile.write(" Note: %s\n" % badcand.note) + reportfile.write(" Note: %s\n\n" % badcand.note) if reportfilenm is not None: reportfile.close() @@ -929,7 +929,13 @@ def sift_directory(dir, outbasenm): import os.path import glob import infodata - + + # TODO: Remove hard-coded values in this function + # replace with command line options. + + global sigma_threshold + sigma_threshold = 5.0 + # Get list of DMs from *.inf files inffns = glob.glob(os.path.join(dir, '*.inf')) dmstrs = ['%.2f'%infodata.infodata(inffn).DM for inffn in inffns]