Ejemplo n.º 1
0
 def test_multiple_samples(self):
     ts_ary = [800, 810, 1800, 1810]
     display_sample = 1000
     fbg = FlywheelBatchGenerator(ts_ary, display_sample)
     current_sample = next(fbg.generate(), 0)
     self.assertEquals(current_sample, 2)
     current_sample = next(fbg.generate(), 0)
     self.assertEquals(current_sample, 2)
Ejemplo n.º 2
0
    def __init__(self,
                 gst_img_path,
                 data_filename,
                 x,
                 trial_length,
                 display_sample,
                 layer_multiplier=1):
        #super(OnTheFlyBatchGhost, self).__init__(gst_img_path, data_filename, x, trial_length, display_sample)
        #can't use super on an old style class
        Ghost.__init__(self, gst_img_path, data_filename, x, layer_multiplier)

        self.flywheel_generator = FlywheelBatchGenerator(
            self.timestamp_ary, display_sample)
        self.stroke_generator = StrokeBatchGenerator(self.ir_timestamp_ary,
                                                     display_sample)
Ejemplo n.º 3
0
class OnTheFlyBatchGhost(Ghost):
    def __init__(self,
                 gst_img_path,
                 data_filename,
                 x,
                 trial_length,
                 display_sample,
                 layer_multiplier=1):
        #super(OnTheFlyBatchGhost, self).__init__(gst_img_path, data_filename, x, trial_length, display_sample)
        #can't use super on an old style class
        Ghost.__init__(self, gst_img_path, data_filename, x, layer_multiplier)

        self.flywheel_generator = FlywheelBatchGenerator(
            self.timestamp_ary, display_sample)
        self.stroke_generator = StrokeBatchGenerator(self.ir_timestamp_ary,
                                                     display_sample)

    def generate_next_flywheel_update(self):
        return next(self.flywheel_generator.generate(), 0)

    def generate_next_ir_update(self):
        return next(self.stroke_generator, 0)

    def update(self, viewable_min_r, viewable_max_r):
        self.r_y += self.generate_next_flywheel_update()

        #self.stroke_pos_current += self.generate_next_ir_update()
        self.stroke_pos_change = self.generate_next_ir_update()
        self.stroke_pos_current += self.stroke_pos_change

        #return super(OnTheFlyBatchGhost, self).update(viewable_min_r, viewable_max_r)
        #can't use super on an old style class
        return Ghost.update(self, viewable_min_r, viewable_max_r)
Ejemplo n.º 4
0
    def test_no_activity_between_samples(self):
        ts_ary = [100, 5100]
        display_sample = 1000
        fbg = FlywheelBatchGenerator(ts_ary, display_sample)
        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 1)

        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 0)

        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 0)

        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 0)

        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 0)

        current_sample = next(fbg.generate(), 0)
        self.assertEquals(current_sample, 1)
Ejemplo n.º 5
0
 def test_no_revolutions_in_a_sample(self):
     ts_ary = []
     display_sample = 1000
     fbg = FlywheelBatchGenerator(ts_ary, display_sample)
     current_sample = next(fbg.generate(), 0)
     self.assertEquals(current_sample, 0)