Skip to content

Commit

Permalink
Fixed candidate comparison for sort for Py3
Browse files Browse the repository at this point in the history
  • Loading branch information
scottransom committed Nov 19, 2019
1 parent fd7ee9c commit 291e5eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bin/GBT350_drift_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from builtins import str
from builtins import range
from builtins import object
from operator import attrgetter
import glob, os, os.path, shutil, socket, tarfile, stat
import numpy, sys, time
from presto import sigproc
Expand Down Expand Up @@ -392,7 +393,7 @@ def main(fil_filenm, workdir, ddplans):
lo_accel_cands = sifting.remove_DM_problems(lo_accel_cands, numhits_to_fold,
dmstrs, low_DM_cutoff)
if len(lo_accel_cands):
lo_accel_cands.sort(sifting.cmp_sigma)
lo_accel_cands.sort(key=attrgetter('sigma'), reverse=True)
sifting.write_candlist(lo_accel_cands,
job.basefilenm+".accelcands_Z%d"%lo_accel_zmax)

Expand All @@ -403,7 +404,7 @@ def main(fil_filenm, workdir, ddplans):
hi_accel_cands = sifting.remove_DM_problems(hi_accel_cands, numhits_to_fold,
dmstrs, low_DM_cutoff)
if len(hi_accel_cands):
hi_accel_cands.sort(sifting.cmp_sigma)
hi_accel_cands.sort(key=attrgetter('sigma'), reverse=True)
sifting.write_candlist(hi_accel_cands,
job.basefilenm+".accelcands_Z%d"%hi_accel_zmax)

Expand Down
3 changes: 2 additions & 1 deletion bin/PALFA_presto_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from builtins import str
from builtins import range
from builtins import object
from operator import attrgetter
import glob, os, os.path, socket, struct, sys, time, tarfile
import numpy
from presto import psr_utils
Expand Down Expand Up @@ -521,7 +522,7 @@ def main(fil_filenm, workdir):
if len(all_accel_cands):
all_accel_cands = sifting.remove_harmonics(all_accel_cands)
# Note: the candidates will be sorted in _sigma_ order, not _SNR_!
all_accel_cands.sort(sifting.cmp_sigma)
all_accel_cands.sort(key=attrgetter('sigma'), reverse=True)
sifting.write_candlist(all_accel_cands, job.basefilenm+".accelcands")

try:
Expand Down

0 comments on commit 291e5eb

Please sign in to comment.