def run_with_args(args): d = IndexedLogDB(args.database) if args.keplerian != None: print_mode = Keplerian(args.keplerian) else: print_mode = TABLE if args.initial_conditions: q = d.initial_conditions(args.system_range) elif args.final_conditions: q = d.final_conditions(args.system_range) else: q = d.query(args.time_range, args.system_range, args.evt_id) for r in truncate(args.max_records, q): print_record(print_mode, r, args.body_range)
def run_with_args(args): d = IndexedLogDB(args.database) if args.keplerian != None: print_mode = Keplerian(args.keplerian) else: print_mode = TABLE if args.initial_conditions: q = d.initial_conditions(args.system_range) elif args.final_conditions: q = d.final_conditions(args.system_range) else: q = d.query(args.time_range, args.system_range, args.evt_id) for r in truncate(args.max_records, q): print_record(print_mode, r, args.body_range)
fileName = "/scratch/hpc/salehqt/kepler37ecc/kep37_log.db" # Range of times to accept in the query, universal accepts all times time_range = Range.interval((0.0, 100.0)) # Range of systems to include in the query system_range = Range.universal() # single(0) # Types of events to include in the results event_range = Range.single(1) # Bodies to record parameters for, only use interval or single body_range = Range.interval((1, 2)) ###### Execution Starts here ######################## # Open the input log file d = IndexedLogDB(fileName) # Execute a query on the log, the result is a Python iterable q = d.query(time_range, system_range, event_range) STARTING_SIZE = 1024 # Set up some lists to hold our numbers for later body_parameters = {} for i in body_range: body_parameters[i] = zeros(STARTING_SIZE) times = zeros(STARTING_SIZE) record_count = 0 # Main loop of processing the records, we use the # truncate function to select only the first MAX_RECORDS entries # from q. The ones that are selected are return in (k, l) tuples # k is the primary key for the record, l is a logrecord object. # for most processings we only need l for k, l in truncate(MAX_RECORDS, q):
P.scatter(final_time.keys(), final_time.values()) P.axis([ system_range.lower(), system_range.upper(), 10, max(final_time.values()) ]) P.gca().set_yscale('log', basey=10) P.savefig("figure_final_time") final_time = get_final_times() plot_final_times_vs_systemid(final_time) exit(1) # Execute a query on the log, the result is a Python iterable q = d.query(time_range, system_range, event_range) STARTING_SIZE = 1024 # Set up some lists to hold our numbers for later body_parameters = {} for i in body_range: body_parameters[i] = zeros(STARTING_SIZE) times = zeros(STARTING_SIZE) record_count = 0 # Main loop of processing the records, we use the # truncate function to select only the first MAX_RECORDS entries # from q. The ones that are selected are return in (k, l) tuples # k is the primary key for the record, l is a logrecord object. # for most processings we only need l for k, l in truncate(MAX_RECORDS, q):