Ejemplo n.º 1
0
def test_reset_time_smoke():
    evs = list(_reset_time_data_helper())
    revs = list(reset_time(evs, 'a'))
    for ev, rev in zip(evs, revs):
        assert rev['time'] == rev['timestamps']['a']
        assert ev['data'] == rev['data']
        assert ev['timestamps'] == rev['timestamps']
Ejemplo n.º 2
0
def test_reset_time_smoke():
    evs = list(_reset_time_data_helper())
    revs = list(reset_time(evs, 'a'))
    for ev, rev in zip(evs, revs):
        assert rev['time'] == rev['timestamps']['a']
        assert ev['data'] == rev['data']
        assert ev['timestamps'] == rev['timestamps']
Ejemplo n.º 3
0
def clean_images(header, pivot_key, timesource_key, dark_images=None, static_keys=None):
    if static_keys is None:
        static_keys = ['sx', 'sy', 'temp_a', 'temp_b', 'sz']
    # sort out which descriptor has the key we want to pivot on
    pv_desc = [d for d in header['descriptors'] if pivot_key in d['data_keys']][0]
    # sort out which descriptor has the key that we want to zip with to get time stamps
    ts_desc = [d for d in header['descriptors'] if timesource_key in d['data_keys']][0]

    ts_events = get_events_generator(ts_desc)
    pv_events = get_events_generator(pv_desc)
    # fill_event works in place, sillyness to work around that
    pv_events = ((ev, fill_event(ev))[0] for ev in pv_events)
    pivoted_events = pivot_timeseries(pv_events, [pivot_key], static_keys)

    if dark_images:
        pivoted_events = correct_events(pivoted_events, pivot_key, dark_images)
    merged_events = zip_events(pivoted_events, ts_events)
    out_ev = reset_time(merged_events, timesource_key)
    yield from out_ev
Ejemplo n.º 4
0
def clean_images(header, pivot_key, timesource_key, dark_images=None, static_keys=None):
    if static_keys is None:
        static_keys = ["sx", "sy", "temp_a", "temp_b", "sz"]
    # sort out which descriptor has the key we want to pivot on
    pv_desc = [d for d in header["descriptors"] if pivot_key in d["data_keys"]][0]
    # sort out which descriptor has the key that we want to zip with to get time stamps
    ts_desc = [d for d in header["descriptors"] if timesource_key in d["data_keys"]][0]

    ts_events = get_events_generator(ts_desc)
    pv_events = get_events_generator(pv_desc)
    # fill_event works in place, sillyness to work around that
    pv_events = ((ev, fill_event(ev))[0] for ev in pv_events)
    pivoted_events = pivot_timeseries(pv_events, [pivot_key], static_keys)

    if dark_images:
        pivoted_events = correct_events(pivoted_events, pivot_key, dark_images)
    merged_events = zip_events(pivoted_events, ts_events)
    out_ev = reset_time(merged_events, timesource_key)
    yield from out_ev