def test_timeshift_with_no_corr_but_lc_assigned(self): result = np.array([1.92, 2.16, 1.8, -14.44, 11.12]) lags_result = np.array([-2, -1, 0, 1, 2]) cr = CrossCorrelation() cr.lc1 = self.lc1 cr.lc2 = self.lc2 cr.cal_timeshift(dt=1.0) assert np.allclose(cr.lc1, self.lc1) assert np.allclose(cr.lc2, self.lc2) assert np.allclose(cr.corr, result) assert np.isclose(cr.dt, self.lc1.dt) assert cr.n == 5 assert np.allclose(cr.time_lags, lags_result) assert np.isclose(cr.time_shift, 2.0) assert cr.mode == 'same' assert cr.auto is False
def test_timeshift_with_no_corr_but_lc_assigned(self): result = np.array([1.92, 2.16, 1.8, -14.44, 11.12]) lags_result = np.array([-2, -1, 0, 1, 2]) cr = CrossCorrelation() cr.lc1 = self.lc1 cr.lc2 = self.lc2 cr.cal_timeshift(dt=1.0) assert np.allclose(cr.lc1, self.lc1) assert np.allclose(cr.lc2, self.lc2) assert np.allclose(cr.corr, result) assert np.isclose(cr.dt, self.lc1.dt) assert cr.n == 5 assert np.allclose(cr.time_lags, lags_result) assert np.isclose(cr.time_shift, 2.0) assert cr.mode == 'same' assert cr.auto is False
def test_empty_cross_correlation_with_dt(self): cr = CrossCorrelation() with pytest.raises(StingrayError): cr.cal_timeshift(dt=2.0) assert np.isclose(cr.dt, 2.0)
def test_empty_cross_correlation_with_dt(self): cr = CrossCorrelation() with pytest.raises(StingrayError): cr.cal_timeshift(dt=2.0) assert np.isclose(cr.dt, 2.0)