Exemplo n.º 1
0
def main():
    global opt
    opt, args = get_options()

    # Get orbital ephemeris in requested time range
    print 'Reading orbital ephemeris file', opt.ephemfile
    ephem = Ska.Table.read_table(opt.ephemfile)
    tstart = DateTime(opt.tstart).secs
    tstop = DateTime(opt.tstop).secs
    ephem = ephem[(ephem.Time >= tstart) & (ephem.Time <= tstop)][::opt.sample]
    if len(ephem) == 0:
        print 'Error: ephemeris file has no overlap with specified time interval'
        sys.exit(0)
    chandra_ecis = np.array([ephem.X, ephem.Y, ephem.Z]).copy().transpose()
    ephem_times = ephem.Time.copy()

    # Get spacecraft attitude in requested time range at the same sampling as ephemeris
    dt = ephem.Time[1] - ephem.Time[0]
    print(
        'Fetching attitude telemetry between %s and %s at %d second intervals'
        % (DateTime(ephem.Time[0]).date, DateTime(ephem.Time[-1]).date, dt))
    cols, atts = fetch(
        start=ephem.Time[0],
        stop=ephem.Time[-1],
        dt=dt,
        time_format='secs',
        colspecs=['aoattqt1', 'aoattqt2', 'aoattqt3', 'aoattqt4'])
    atts = np.rec.fromrecords(atts, names=cols)
    q1s = Ska.Numpy.interpolate(atts.aoattqt1, atts.date, ephem.Time)
    q2s = Ska.Numpy.interpolate(atts.aoattqt2, atts.date, ephem.Time)
    q3s = Ska.Numpy.interpolate(atts.aoattqt3, atts.date, ephem.Time)
    q4s = Ska.Numpy.interpolate(atts.aoattqt4, atts.date, ephem.Time)

    # Divy up calculations amongst the n-processors
    i0s = range(0, len(q1s), len(q1s) // opt.nproc + 1)
    i1s = i0s[1:] + [len(q1s)]

    # Calculate illumination in a separate process over each sub-interval
    for iproc, i0, i1 in zip(itertools.count(), i0s, i1s):
        calc_vis_values(iproc, ephem_times[i0:i1], chandra_ecis[i0:i1],
                        q1s[i0:i1], q2s[i0:i1], q3s[i0:i1], q4s[i0:i1])
Exemplo n.º 2
0
def main():
    global opt
    opt, args = get_options()

    # Get orbital ephemeris in requested time range
    print 'Reading orbital ephemeris file', opt.ephemfile
    ephem = Ska.Table.read_table(opt.ephemfile)
    tstart = DateTime(opt.tstart).secs
    tstop = DateTime(opt.tstop).secs
    ephem = ephem[(ephem.Time >= tstart)
                              & (ephem.Time <= tstop)][::opt.sample]
    if len(ephem) == 0:
        print 'Error: ephemeris file has no overlap with specified time interval'
        sys.exit(0)
    chandra_ecis = np.array([ephem.X, ephem.Y, ephem.Z]).copy().transpose()
    ephem_times = ephem.Time.copy()


    # Get spacecraft attitude in requested time range at the same sampling as ephemeris
    dt = ephem.Time[1] - ephem.Time[0]
    print ('Fetching attitude telemetry between %s and %s at %d second intervals'
           % (DateTime(ephem.Time[0]).date, DateTime(ephem.Time[-1]).date, dt))
    cols, atts = fetch(start=ephem.Time[0], stop=ephem.Time[-1], dt=dt, time_format='secs',
                 colspecs=['aoattqt1', 'aoattqt2',  'aoattqt3',  'aoattqt4'])
    atts = np.rec.fromrecords(atts, names=cols)
    q1s = Ska.Numpy.interpolate(atts.aoattqt1, atts.date, ephem.Time)
    q2s = Ska.Numpy.interpolate(atts.aoattqt2, atts.date, ephem.Time)
    q3s = Ska.Numpy.interpolate(atts.aoattqt3, atts.date, ephem.Time)
    q4s = Ska.Numpy.interpolate(atts.aoattqt4, atts.date, ephem.Time)

    # Divy up calculations amongst the n-processors
    i0s = range(0, len(q1s), len(q1s) // opt.nproc + 1)
    i1s = i0s[1:] + [len(q1s)]

    # Calculate illumination in a separate process over each sub-interval
    for iproc, i0, i1 in zip(itertools.count(), i0s, i1s):
        calc_vis_values(iproc, ephem_times[i0:i1], chandra_ecis[i0:i1],
                        q1s[i0:i1], q2s[i0:i1], q3s[i0:i1], q4s[i0:i1])
Exemplo n.º 3
0
def fetch_temps( starttime ):
    (telem_hdr,telem_val) = fetch(start=DateTime(starttime).secs, 
                                  stop=( DateTime(starttime).secs+1),colspecs=['1pdeaat,1pin1at'])
    telem = np.rec.fromrecords( telem_val, names=telem_hdr)
    return telem