def test_noise_reduces_with_square_root_of_ndit(self, ndit, noise_std): dtcr = _basic_detector(width=256) ron = BasicReadoutNoise(noise_std=noise_std, n_channels=64, ndit=ndit) dtcr = ron.apply_to(dtcr) noise_real = np.std(dtcr._hdu.data) assert noise_real == approx(noise_std * ndit**0.5, rel=0.05)
def test_only_applied_to_detector(self, in_flux, out_flux): dtcr = _basic_detector() dtcr._hdu.data[0, 0] = in_flux lincurve = LinearityCurve(ndit=1, filename="test_linearity.dat") new_dtcr = lincurve.apply_to(dtcr) assert new_dtcr._hdu.data[0, 0] == out_flux assert np.min(new_dtcr._hdu.data) == 0
def test_creates_noise_std_as_needed(self, noise_std): dtcr = _basic_detector(width=256) ron = BasicReadoutNoise(noise_std=noise_std, n_channels=64, ndit=1) dtcr = ron.apply_to(dtcr) assert np.std(dtcr._hdu.data) == approx(noise_std, rel=0.05)