コード例 #1
0
ファイル: test_multicore.py プロジェクト: mikedeltalima/IoTPy
 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')
コード例 #2
0
ファイル: test_multicore.py プロジェクト: mikedeltalima/IoTPy
        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')
コード例 #3
0
 def g(in_streams, out_streams):
     s = Stream('s')
     map_element(lambda v: v * 2, in_streams[0], s)
     print_stream(s, 's')
コード例 #4
0
 def g(in_streams, out_streams):
     print_stream(in_streams[0], 'x')
コード例 #5
0
 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')
コード例 #6
0
 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')
コード例 #7
0
    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')
コード例 #8
0
ファイル: test_multicore.py プロジェクト: mikedeltalima/IoTPy
 def r(in_streams, out_streams):
     t = Stream('t')
     map_element(lambda v: v * 3, in_streams[0], t)
     print_stream(t, 't')