diff options
author | Volker Hoffmann <volker@cheleb.net> | 2016-11-22 08:59:22 +0100 |
---|---|---|
committer | Volker Hoffmann <volker@cheleb.net> | 2016-11-22 08:59:22 +0100 |
commit | b361f1fbd272ce1f2a8d647e0f99cc290828e5bb (patch) | |
tree | 31f21c7dc7ad0b0d6d8f1c0cf05a4cffd9b7fe00 | |
parent | 7be5c3132feced43feb1ccc2b2b85407adc5bb66 (diff) |
feat: option to remove only particles with ID larger than --minpid
-rw-r--r-- | IC_Helpers/modic_cutmoons.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/IC_Helpers/modic_cutmoons.py b/IC_Helpers/modic_cutmoons.py index 4f6abbc..5e5e5b7 100644 --- a/IC_Helpers/modic_cutmoons.py +++ b/IC_Helpers/modic_cutmoons.py @@ -2,7 +2,9 @@ Remove moons from stdin (requires default Genga column ordering). Call Signature: -$ python modic_cutmoons.py --ce 95000 < $output_to_change > $changed_output +$ python modic_cutmoons.py \ + --minpid 5 \ + --ce 95000 < $output_to_change > $changed_output """ import numpy as np @@ -13,6 +15,8 @@ import sys parser = argparse.ArgumentParser() parser.add_argument('--ce', type=int, required=True, \ help="Number of close encounters required for removal") +parser.add_argument('--minpid', type=int, default=1, \ + help="Minimum PID that is cut.") args = parser.parse_args() # Read lines from stdin @@ -21,7 +25,9 @@ lines_in = sys.stdin.read().rstrip("\n").split("\n") # Remove particles with too many CEs lines_out = []; cce = 0 for line in lines_in: - if not int(line.strip().split()[19]) >= args.ce: + pid = int(line.strip().split()[1]) + cnt = int(line.strip().split()[19]) + if (cnt < args.ce) or (pid < args.minpid): lines_out.append(line) else: sys.stderr.write("Removed Particle %i (%i CEs) \n" % \ |