Example #1
0
    def test_distribution_overflow(self, seq_conf):
        target_rate = 0.9999999

        seq_conf = synthetic.Config((1, 1), 5, 1, rate=target_rate)

        seq = self.cls(seq_conf)
        rate = analysis.event_rate(seq)
Example #2
0
    def test_0_rate(self, seq_conf):
        target_rate = 0.0
        seq_conf = synthetic.Config((3, 3), 4, 1, rate=target_rate)

        seq = self.cls(seq_conf)
        rate = analysis.event_rate(seq)

        assert rate == target_rate
Example #3
0
    def test_rates(self, seq_conf):
        target_rates = [0.4235971, 0.073911]

        for target_rate in target_rates:
            seq_conf = synthetic.Config((32, 32), 500, 1, rate=target_rate)

            seq = self.cls(seq_conf)
            rate = analysis.event_rate(seq)

            assert target_rate == pytest.approx(rate, 0.001)
Example #4
0
    def test_computed_rate(self, seq_conf):
        target_rate = 0.4235971
        res = 30
        frames = 500

        seq_conf = synthetic.Config((res, res), frames, 1, rate=target_rate)

        seq = self.cls(seq_conf)
        rate = analysis.event_rate(seq)

        assert seq.rate == rate
        assert seq.rate != target_rate
Example #5
0
def test_event_rate():
	seq = [
	    np.array([[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
	             dtype='uint8'),
	    np.array([[1, 1, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
	             dtype='uint8'),
	    np.array([[2, 2, 2, 2], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
	             dtype='uint8'),
	    np.array([[3, 3, 3, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
	             dtype='uint8')
	]
	result = ev.event_rate(seq)
	assert result == 0.25
Example #6
0
def analyze(video_path):
    seq = GrayscaleVideoConverter(VideoSequence(video_path))
    return event_rate(seq)