Ejemplo n.º 1
0
def test_star_sink():
    L = []

    def add(x, y):
        L.append(x + y)

    source = Stream()
    source.starsink(add)

    source.emit((1, 10))

    assert L[0] == 11
Ejemplo n.º 2
0
        lambda x: x if not isinstance(x, list) else x[0]).map(
            lambda x: x.documents(fill=True)).flatten()).map(
                np.float32).connect(raw_background_dark))
(FromEventStream('event', ('data', image_name),
                 source,
                 event_stream_name='dark').map(
                     np.float32).connect(raw_foreground_dark))
# Get background
(FromEventStream('event', ('data', image_name),
                 bg_docs).map(np.float32).connect(raw_background))

# Get foreground
FromEventStream('event', ('seq_num', ), source,
                stream_name='seq_num').connect(img_counter)
(FromEventStream('event', ('data', image_name),
                 source,
                 principle=True,
                 event_stream_name='primary',
                 stream_name='raw_foreground').map(
                     np.float32).connect(raw_foreground))

# Save out calibration data to special place
h_timestamp = start_timestamp.map(_timestampstr)
(gen_geo_cal.pluck(0).zip_latest(h_timestamp).
 starsink(lambda x, y: _save_calib_param(
     x, y,
     os.path.join(glbl_dict['config_base'], glbl_dict['calib_config_name']))))

raw_source.starsink(StartStopCallback())
# raw_source.visualize(os.path.expanduser('~/mystream.png'), source_node=True)