Skip to content

Commit

Permalink
Reset global variable to original value.
Browse files Browse the repository at this point in the history
Other minor changes. Add todo in sifting function. Change notes for long/short period rejections to include units (now ms instead of s).
  • Loading branch information
plazar committed Jun 9, 2012
1 parent b7f32cd commit b8687b8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/python/sifting.py
Expand Up @@ -22,7 +22,7 @@
# Shortest period candidates to consider (s) # Shortest period candidates to consider (s)
short_period = 0.0005 short_period = 0.0005
# Ignore candidates with a sigma (from incoherent power summation) less than this # 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 # Ignore candidates with a coherent power less than this
c_pow_threshold = 100.0 c_pow_threshold = 100.0
# Ignore any candidates where at least one harmonic does not exceed this power # Ignore any candidates where at least one harmonic does not exceed this power
Expand Down Expand Up @@ -284,8 +284,8 @@ def reject_longperiod(self):
for ii in reversed(range(len(self.cands))): for ii in reversed(range(len(self.cands))):
cand = self.cands[ii] cand = self.cands[ii]
if (cand.p > long_period): if (cand.p > long_period):
cand.note = "Period is too long (%g > %g)" % \ cand.note = "Period is too long (%g ms > %g ms)" % \
(cand.p, long_period) (cand.p*1000, long_period*1000)
self.badcands_longperiod.append(self.cands.pop(ii)) self.badcands_longperiod.append(self.cands.pop(ii))


def reject_shortperiod(self): def reject_shortperiod(self):
Expand All @@ -301,8 +301,8 @@ def reject_shortperiod(self):
for ii in reversed(range(len(self.cands))): for ii in reversed(range(len(self.cands))):
cand = self.cands[ii] cand = self.cands[ii]
if (cand.p < short_period): if (cand.p < short_period):
cand.note = "Period is too short (%g > %g)" % \ cand.note = "Period is too short (%g ms > %g ms)" % \
(cand.p, short_period) (cand.p*1000, short_period*1000)
self.badcands_shortperiod.append(self.cands.pop(ii)) self.badcands_shortperiod.append(self.cands.pop(ii))


def reject_knownbirds(self, birdie_freqs=[], birdie_periods=[]): def reject_knownbirds(self, birdie_freqs=[], birdie_periods=[]):
Expand Down Expand Up @@ -729,7 +729,7 @@ def write_cand_report(self, reportfilenm=None):
badcands = self.get_all_badcands() badcands = self.get_all_badcands()
for badcand in badcands: for badcand in badcands:
reportfile.write("%s (%d)\n" % (str(badcand), len(badcand.hits))) 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: if reportfilenm is not None:
reportfile.close() reportfile.close()


Expand Down Expand Up @@ -929,7 +929,13 @@ def sift_directory(dir, outbasenm):
import os.path import os.path
import glob import glob
import infodata 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 # Get list of DMs from *.inf files
inffns = glob.glob(os.path.join(dir, '*.inf')) inffns = glob.glob(os.path.join(dir, '*.inf'))
dmstrs = ['%.2f'%infodata.infodata(inffn).DM for inffn in inffns] dmstrs = ['%.2f'%infodata.infodata(inffn).DM for inffn in inffns]
Expand Down

0 comments on commit b8687b8

Please sign in to comment.