def setUp(self): uncorr_map = accessors.open(uncorr_path) corr_map = accessors.open(corr_path) map_with_sources = accessors.open(deconv_path) self.uncorr_image = image.ImageData(uncorr_map.data, uncorr_map.beam, uncorr_map.wcs) self.corr_image = image.ImageData(corr_map.data, uncorr_map.beam, uncorr_map.wcs) self.image_with_sources = image.ImageData(map_with_sources.data, map_with_sources.beam, map_with_sources.wcs)
def setUp(self): uncorr_map = accessors.open(os.path.join(DATAPATH, 'UNCORRELATED_NOISE.FITS')) corr_map = accessors.open(os.path.join(DATAPATH, 'CORRELATED_NOISE.FITS')) map_with_sources = accessors.open(os.path.join(DATAPATH, 'TEST_DECONV.FITS')) self.uncorr_image = image.ImageData(uncorr_map.data, uncorr_map.beam, uncorr_map.wcs) self.corr_image = image.ImageData(corr_map.data, uncorr_map.beam, uncorr_map.wcs) self.image_with_sources = image.ImageData(map_with_sources.data, map_with_sources.beam, map_with_sources.wcs)
def testMaskedBackgroundBlind(self): self.image = accessors.sourcefinder_image_from_accessor( accessors.open(os.path.join(DATAPATH, "L41391_0.img.restored.corr.fits")), radius=1.0, ) result = self.image.extract() self.assertFalse(result)
def testMaskedBackgroundForcedFit(self): """ Background at forced fit is masked """ self.image = accessors.sourcefinder_image_from_accessor( accessors.open(fits_file), radius=1.0) result = self.image.fit_to_point(256, 256, 10, 0, None) self.assertFalse(result)
def testMaskedBackgroundForcedFit(self): """ Background at forced fit is masked """ self.image = accessors.sourcefinder_image_from_accessor( accessors.open(os.path.join(DATAPATH, "L41391_0.img.restored.corr.fits")), radius=1.0, ) result = self.image.fit_to_point(256, 256, 10, 0, None) self.assertFalse(result)
def test_theoreticalnoise(self): good_image = accessors.open(good_file) bad_image = accessors.open(bad_file) frequency = good_image.freq_eff # this stuff should be in the header of a LOFAR image some day integration_time = 18654.3 # s, should be self.good_image.tau_time some day bandwidth = 200 * 10**3 # Hz, shoud probably be self.good_image.freq_bw some day ncore = 23 # ~ nremote = 8 # ~ nintl = 0 configuration = "LBA_INNER" noise = tkp.lofar.noise.noise_level(frequency, bandwidth, integration_time, configuration, ncore, nremote, nintl) rms_good = statistics.rms_with_clipped_subregion(good_image.data) rms_bad = statistics.rms_with_clipped_subregion(bad_image.data) self.assertFalse(rms_invalid(rms_good, noise)) self.assertTrue(rms_invalid(rms_bad, noise))
def setUp(self): """ NB the required image has been committed to the tkp/data subversion repository. (See tkp/data/unittests/tkp_lib for a full copy of all the unittest data). Source positions / background positions were simply picked out by eye in DS9 """ self.image = accessors.sourcefinder_image_from_accessor( accessors.open(os.path.join(DATAPATH, 'NCP_sample_image_1.fits')) ) self.assertListEqual(list(self.image.data.shape),[1024,1024]) self.boxsize = BOX_IN_BEAMPIX*max(self.image.beam[0], self.image.beam[1]) self.bright_src_posn = (215.83993,86.307504) #RA, DEC self.background_posn = (186.33731,82.70002) #RA, DEC ##NB These are simply plucked from a previous run, # so they merely ensure *consistent*, rather than *correct*, results. self.known_fit_results = [215.84 , 86.31 , 9.88] #RA, DEC, PEAK
def setUp(self): """ NB the required image has been committed to the tkp/data subversion repository. (See tkp/data/unittests/tkp_lib for a full copy of all the unittest data). Source positions / background positions were simply picked out by eye in DS9 """ self.image = accessors.sourcefinder_image_from_accessor( accessors.open(os.path.join(DATAPATH, 'sourcefinder/NCP_sample_image_1.fits')) ) self.assertListEqual(list(self.image.data.shape),[1024,1024]) self.boxsize = BOX_IN_BEAMPIX*max(self.image.beam[0], self.image.beam[1]) self.bright_src_posn = (35.76726,86.305771) #RA, DEC self.background_posn = (6.33731,82.70002) #RA, DEC # #NB Peak of forced gaussian fit is simply plucked from a previous run; # so merely ensures *consistent*, rather than *correct*, results. self.known_fit_results = (self.bright_src_posn[0], # RA, self.bright_src_posn[1], # Dec 13.457697411730384) # Peak
def setUp(self): """ NB the required image has been committed to the tkp/data subversion repository. (See tkp/data/unittests/tkp_lib for a full copy of all the unittest data). Source positions / background positions were simply picked out by eye in DS9 """ self.image = accessors.sourcefinder_image_from_accessor( accessors.open( os.path.join(DATAPATH, 'sourcefinder/NCP_sample_image_1.fits'))) self.assertListEqual(list(self.image.data.shape), [1024, 1024]) self.boxsize = BOX_IN_BEAMPIX * max(self.image.beam[0], self.image.beam[1]) self.bright_src_posn = (35.76726, 86.305771) #RA, DEC self.background_posn = (6.33731, 82.70002) #RA, DEC # #NB Peak of forced gaussian fit is simply plucked from a previous run; # so merely ensures *consistent*, rather than *correct*, results. self.known_fit_results = ( self.bright_src_posn[0], # RA, self.bright_src_posn[1], # Dec 13.457697411730384) # Peak
def test_casaimage(self): image = accessors.open(casatable) self.assertEqual(type(image), accessors.CasaImage)
def test_rms_fits(self): accessors.open(good_file)
def testMaskedBackgroundBlind(self): self.image = accessors.sourcefinder_image_from_accessor( accessors.open(fits_file), radius=1.0) result = self.image.extract(det=10.0, anl=3.0) self.assertFalse(result)
def test_header(self): image = accessors.open(fits_file) (semimaj, semimin, theta) = image.beam self.assertFalse(beam_invalid(semimaj, semimin))