def test_simple_cone_search(self): components = self.sms_client.coneSearch(centre=Coordinate(70.2, -61.8), radius=1.0, criteria=SearchCriteria()) assert len(components) == 1 c = components[0] assert c.componentId == "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_1a" nt.assert_almost_equal(c.ra, 70.176918) nt.assert_almost_equal(c.dec, -61.819671) nt.assert_almost_equal(c.raErr, 0.00999999977) nt.assert_almost_equal(c.decErr, 0.00999999977) nt.assert_almost_equal(c.freq, 1400.5) nt.assert_almost_equal(c.fluxPeak, 326.529998779) nt.assert_almost_equal(c.fluxPeakErr, 0.282999992371) nt.assert_almost_equal(c.fluxInt, 378.830993652) nt.assert_almost_equal(c.fluxIntErr, 0.541999995708) nt.assert_almost_equal(c.spectralIndex, -1.24000000954) nt.assert_almost_equal(c.spectralCurvature, -1.37999999523) # this database has polarisation data assert len(c.polarisation) == 1 p = c.polarisation[0] nt.assert_almost_equal(p.lambdaRefSq, 0.09) nt.assert_almost_equal(p.polPeakFit, 1.55) nt.assert_almost_equal(p.polPeakFitDebias, 1.42) nt.assert_almost_equal(p.polPeakFitErr, 0.01) nt.assert_almost_equal(p.polPeakFitSnr, 150.0) nt.assert_almost_equal(p.polPeakFitSnrErr, 1.0) nt.assert_almost_equal(p.fdPeakFit, 52.0) nt.assert_almost_equal(p.fdPeakFitErr, 5.2)
def test_radius_40(self): start = time() components = self.sms_client.coneSearch( centre=Coordinate(255.0, 0.0), radius=40.0, criteria=SearchCriteria()) elapsed = time() - start sys.stderr.write('Search completed in {0} seconds ... '.format(elapsed)) assert len(components) == 79100
def test_cone_search_id_values(self): results = self.sms_client.coneSearch( centre=Coordinate(76.0, -71.0), radius=15, criteria=SearchCriteria()) assert len(results) == 10 # test that each ID is unique ids = (r.id for r in results) assert len(set(ids)) == 10
def test_simple_rect_search(self): self.check_results( # search results self.sms_client.rectSearch( Rect(centre=Coordinate(79.375, -71.5), extents=RectExtents(0.75, 1.0)), SearchCriteria()), # expected component IDs [ "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_1b", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_1c", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4a", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4c" ])
def test_cone_search_flux_int(self): self.check_results( # search results self.sms_client.coneSearch( centre=Coordinate(76.0, -71.0), radius=1.5, criteria=SearchCriteria(minFluxInt=80.0)), # expected component IDs [ "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_2a", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_3a", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4a", ])
def test_cone_search_frequency_criteria(self): self.check_results( # search results self.sms_client.coneSearch(centre=Coordinate(76.0, -71.0), radius=1.5, criteria=SearchCriteria( minFreq=1230.0, maxFreq=1250.0)), # expected component IDs [ "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4b", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4c", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_5a", ])
def test_rect_search_spectral_index_bounds(self): self.check_results( # search results self.sms_client.rectSearch( Rect(centre=Coordinate(79.375, -71.5), extents=RectExtents(0.75, 1.0)), SearchCriteria(minSpectralIndex=-3.2, useMinSpectralIndex=True, maxSpectralIndex=-0.1, useMaxSpectralIndex=True)), # expected component IDs [ "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_1b", "SB1958_image.i.LMC.cont.sb1958.taylor.0.restored_4a", ])