Beispiel #1
0
    def _setup_all_procs(self):
        # make a list of all the types of processors
        processors = []
        processors.append(proc.BufferProcessor())
        processors.append(proc.Average())
        processors.append(proc.Raw())
        processors.append(proc.AverageN(1))
        processors.append(proc.Chunk(1,0,1))

        return processors
Beispiel #2
0
    def test_total_records_not_divisible_by_n(self):

        params = mock_acq_params()
        assert params["records_per_acquisition"] % 3 != 0

        ave_n = proc.AverageN(3)

        bufs = buffers_same_val(params, 1)

        emulate_acq(params, bufs, ave_n)

        ave_n.get_result()
Beispiel #3
0
    def check_process_for_n_val(self, n_val, params):

        ave_n = proc.AverageN(n_val)

        bufs = buffers_random(params, 0, 255)

        raw_dat = bufs_to_raw_array(bufs, params)

        correct_results = [np.empty((n_val, params["samples_per_record"]), np.float)
                           for _ in range(params["channel_count"])]

        # make the correct averaged data
        for rec_type in range(n_val):
            for result, chan_dat in zip(correct_results, raw_dat):
                result[rec_type] = np.mean(chan_dat[rec_type::n_val],axis=0)

        emulate_acq(params, bufs, ave_n)

        result = ave_n.get_result()

        for (correct, returned) in zip(correct_results, result):

            assert (correct == returned).all()
Beispiel #4
0
 def test_negative_n(self):
     proc.AverageN(-1)
Beispiel #5
0
 def test_zero_n(self):
     proc.AverageN(0)