Exemple #1
0
    def testTimeShifting(self):
        time_points = 10
        channels = 1
        import pySPACE.tests.utils.data.test_data_generation as tdg
        counter = tdg.Counter()
        test_data = test_ts_generator.generate_test_data(channels=channels,
                                                         time_points=time_points,
                                                         function=counter)

        filter_node = filtering.FIRFilterNode([10,20],time_shift="middle",taps=3)

        filter_node.initialize_data_dependencies(test_data)

        filter_node.filter_kernel = numpy.array([1,1,1])/3.

        filtered_data = filter_node.execute(test_data)

        # the result should be
        #[[ 0.33333333]
        # [ 1.        ]
        # [ 2.        ]
        # [ 3.        ]
        # [ 4.        ]
        # [ 5.        ]
        # [ 6.        ]
        # [ 8.        ]
        # [ 7.        ]
        # [ 5.66666667]]
        desired_result=numpy.array([1.0/3,1,2,3,4,5,6,7,8,17./3])
        desired_result.shape=(10,1)

        #print filtered_data
        #print desired_result
        self.assertTrue(numpy.allclose(filtered_data,desired_result))
Exemple #2
0
 def setUp(self):
     self.time_points = 1000
     self.freq = 1000.
     self.channels = 1
     counter = test_data_generation.Counter()
     self.time_series = \
         time_series_generator.generate_test_data(self.channels,
                                                  self.time_points,
                                                  counter,
                                                  self.freq,
                                                  channel_order=True)
Exemple #3
0
    def setUp(self):
        self.time_points = 5000
        self.freq = 5000.
        self.channels = 1
        counter = test_data_generation.Counter()
        self.time_series = time_series_generator.generate_test_data(self.channels,self.time_points,function=counter,sampling_frequency=self.freq,channel_order=True)

        self.target_frequency = 25

        self.downsampling_factor = self.freq / self.target_frequency

        self.node = subsampling.DownsamplingNode(self.target_frequency)
Exemple #4
0
    def setUp(self):

        self.node = ReorderMemoryNode()

        time_points = 10
        channels = 2
        import pySPACE.tests.utils.data.test_data_generation as test_helpers
        counter = test_helpers.Counter()
        self.data = test_ts_generator.generate_test_data(channels,
                                                         time_points,
                                                         counter,
                                                         channel_order=True)
Exemple #5
0
    def setUp(self):
        self.time_points = 5000
        self.source_frequency = 5000.
        self.channels = 64
        counter = test_data_generation.Counter()
        self.time_series = \
            time_series_generator.generate_test_data(channels=self.channels,
                                                    time_points=self.time_points,
                                                    function=counter,
                                                    sampling_frequency=self.source_frequency,
                                                    channel_order=True)

        self.target_frequency = 25.0