def test_error_extension_shape(niri_adinputs, caplog): niri_adinputs[1][0].data = np.zeros((3, 3)) p = NIRIImage(niri_adinputs) p.prepare() match = "Not all inputs images have the same shape" with pytest.raises(IOError, match=match): p.stackFrames()
def test_error_extension_number(niri_adinputs, caplog): p = NIRIImage(niri_adinputs) p.prepare() niri_adinputs[1].append(np.zeros((2, 2))) match = "Not all inputs have the same number of extensions" with pytest.raises(IOError, match=match): p.stackFrames()
def test_rejmap(niri_adinputs): for i in (2, 3, 4): niri_adinputs.append(niri_adinputs[0] + i) p = NIRIImage(niri_adinputs) p.prepare() adout = p.stackFrames(reject_method='minmax', nlow=1, nhigh=1, save_rejection_map=True)[0] assert_array_equal(adout[0].REJMAP, 2) # rejected 2 values for each pixel
def test_stackframes_refcat_propagation(niri_adinputs): refcat = Table([[1, 2], ['a', 'b']], names=('Id', 'Cat_Id')) for i, ad in enumerate(niri_adinputs): if i > 0: refcat['Cat_Id'] = ['b', 'c'] ad.REFCAT = refcat p = NIRIImage(niri_adinputs) p.prepare() adout = p.stackFrames()[0] # The merged REFCAT should contain 'a', 'b', 'c' assert len(adout.REFCAT) == 3 np.testing.assert_equal(adout.REFCAT['Id'], np.arange(1, 4)) assert all(adout.REFCAT['Cat_Id'] == ['a', 'b', 'c'])
def test_prepare(self): ad = astrodata.open(os.path.join(TESTDATAPATH, 'NIRI', 'N20070819S0104.fits')) p = NIRIImage([ad]) ad = p.prepare()[0] assert ad_compare(ad, os.path.join(TESTDATAPATH, 'NIRI', 'N20070819S0104_prepared.fits'))
def test_stackframes_refcat_propagation(niri_adinputs): refcat = Table([[1, 2], [0.0, 1.0], [40.0, 40.0]], names=('Id', 'RAJ2000', 'DEJ2000')) for i, ad in enumerate(niri_adinputs): if i > 0: refcat['RAJ2000'] = [1.0, 2.0] ad.REFCAT = refcat p = NIRIImage(niri_adinputs) p.prepare() adout = p.stackFrames()[0] # The merged REFCAT should contain 3 sources as follows assert len(adout.REFCAT) == 3 np.testing.assert_equal(adout.REFCAT['Id'], np.arange(1, 4)) assert all(adout.REFCAT['RAJ2000'] == [0.0, 1.0, 2.0])
def test_prepare(self): ad = astrodata.open( os.path.join(TESTDATAPATH, 'NIRI', 'N20070819S0104.fits')) p = NIRIImage([ad]) ad = p.prepare()[0] assert ad_compare( ad, os.path.join(TESTDATAPATH, 'NIRI', 'N20070819S0104_prepared.fits'))