| | 159 | def testCrosscorrelateNoLag(self): |
| | 160 | int, int_, norm = analysis.crosscorrelate(self.spk0, self.spk1) |
| | 161 | #The following are output was generated with the FIND MATLAB toolbox |
| | 162 | matlab_int = numpy.loadtxt('analysis/crosscorrelate/out_matlab_int') |
| | 163 | numpy.testing.assert_array_almost_equal(int, matlab_int, |
| | 164 | decimal=3) |
| | 165 | #The int_ output has a random component and for this reason the test |
| | 166 | # cases are not as trivial |
| | 167 | |
| | 168 | def testCrosscorrelateLag100(self): |
| | 169 | """Test case with lag within the length of the input array |
| | 170 | """ |
| | 171 | int, int_, norm, = analysis.crosscorrelate(self.spk0, self.spk1, |
| | 172 | lag=100.0) |
| | 173 | matlab_int = numpy.loadtxt('analysis/crosscorrelate/out_matlab_int_lag_100') |
| | 174 | numpy.testing.assert_array_almost_equal(int, matlab_int, decimal = 3) |
| | 175 | |
| | 176 | def testCrosscorrelateLag500(self): |
| | 177 | """Test case with lag is higher than the trial length |
| | 178 | """ |
| | 179 | int, int_, norm = analysis.crosscorrelate(self.spk0, self.spk1, |
| | 180 | lag=500.0) |
| | 181 | matlab_int = numpy.loadtxt('analysis/crosscorrelate/out_matlab_int_lag_500') |
| | 182 | numpy.testing.assert_array_almost_equal(int, matlab_int, decimal = 3) |
| | 183 | |