Exemple #1
0
 def sequence_of_integers_source(out_stream):
     return source_func_to_stream(func=sequence_of_integers,
                                  out_stream=out_stream,
                                  num_steps=15,
                                  window_size=1,
                                  state=0,
                                  max_integer=10)
Exemple #2
0
 def source_0(out_stream):
     return source_func_to_stream(func=increment_state,
                                  out_stream=out_stream,
                                  time_interval=0.1,
                                  num_steps=10,
                                  state=0,
                                  window_size=1,
                                  name='source')
Exemple #3
0
    def source_1(out_stream):
        # A simple source which outputs random numbers on
        # out_stream.

        # Return a source which takes 10 steps, and sleeps for 0.1
        # seconds between successive steps, and puts a random number
        # on out_stream at each step.
        return source_func_to_stream(func=random.random,
                                     out_stream=out_stream,
                                     time_interval=0.1,
                                     num_steps=10)
Exemple #4
0
    def source_0(out_stream):
        # A simple source which outputs 1, 2, 3, 4, .... on
        # out_stream.
        def generate_sequence(state):
            return state + 1, state + 1

        # Return a source which takes 10 steps, and
        # sleeps for 0.1 seconds between successive steps, and
        # puts the next element of the sequence in out_stream,
        # and starts the sequence with value 0. The elements on
        # out_stream will be 1, 2, 3, ...
        return source_func_to_stream(func=generate_sequence,
                                     out_stream=out_stream,
                                     time_interval=0.1,
                                     num_steps=10,
                                     state=0)
Exemple #5
0
 def source(s):
     return source_func_to_stream(func=random.random,
                                  out_stream=s,
                                  time_interval=0.01,
                                  num_steps=10)
 def source(s):
     return source_func_to_stream(func=random.random,
                                  out_stream=s,
                                  num_steps=10)