Example #1
0
def dump_a_file(fileName, start, end):
    d = IndexedLogDB(fileName)

    c = d.Cursor(d.primary.cursor())

    for i in range(0, end):
        l = c.next()
        if (l == None):
            break
        elif (i >= start):
            print l, "\n"
Example #2
0
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)
Example #3
0
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)
Example #4
0
MAX_RECORDS = 10000
# Name of the file to read the log records from
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.
Example #5
0
MAX_RECORDS = 10000
# Name of the file to read the log records from
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()  #interval((0,100))
# 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))
from math import pi
######  Execution Starts here ########################

# Open the input log file
d = IndexedLogDB(fileName)


### Step1: find out how long every system lasted
def get_final_times():
    final_time = {}
    #    for i in system_range :
    #        for k, l in d.final_conditions(i):
    for i, l in d.final_conditions(system_range):
        final_time[i] = l.time / (2 * pi)
    return final_time


def plot_final_times_vs_systemid(final_time):
    P.scatter(final_time.keys(), final_time.values())
    P.axis([