def g_numpy(in_streams, out_streams): t = StreamArray('t') map_window(max, dtype_float(in_streams[0]), t, window_size=2, step_size=2) print_stream(t, 't')
def coordinate(in_streams, out_streams, total, num): x, sines, cosines, tangents = in_streams def f(lst): return lst[0] / lst[1] def g(lst): error_squared = (lst[0] - lst[1])**2 return error_squared ratios = Stream('ratios') errors = Stream('errors') zip_map(f, [sines, cosines], ratios, name='sine / cosine') zip_map(g, [ratios, tangents], errors, name='compute error') print_stream(errors, 'error')
def g(in_streams, out_streams): s = Stream('s') map_element(lambda v: v * 2, in_streams[0], s) print_stream(s, 's')
def g(in_streams, out_streams): print_stream(in_streams[0], 'x')
def zip_everything_and_file(in_streams, out_streams): t = Stream() zip_stream(in_streams, out_stream=t) print_stream(t, 'zipped') stream_to_file(in_stream=t, filename='result.dat')
def output_followers_retweets(in_streams, out_streams): map_element(followers_and_retweets_of_tweet, in_streams[0], out_streams[0]) print_stream(out_streams[0], 'followers')
def output_tweet_sentiment(in_streams, out_streams): def get_sentiment(tweet): return sentiment_of_text(get_text(tweet)) map_element(get_sentiment, in_streams[0], out_streams[0]) print_stream(out_streams[0], 'sentiment')
def r(in_streams, out_streams): t = Stream('t') map_element(lambda v: v * 3, in_streams[0], t) print_stream(t, 't')