def test_spatial_query(self, fixture_db_session):
     s = fixture_db_session
     posn = vp.get_event_position(swift_bat_grb_655721)
     # Cone search centred on the known co-ords should return the row:
     results = s.query(Coord).filter(
         coord_cone_search_clause(posn.ra, posn.dec, 0.5)).all()
     assert len(results) == 1
     # Now bump the cone to the side (so not matching) and check null return
     results = s.query(Coord).filter(
         coord_cone_search_clause(posn.ra, posn.dec + 1.0, 0.5)).all()
     assert len(results) == 0
Exemple #2
0
 def test_spatial_query(self, fixture_db_session):
     s = fixture_db_session
     posn = vp.get_event_position(swift_bat_grb_655721)
     # Cone search centred on the known co-ords should return the row:
     results = s.query(Coord).filter(
         coord_cone_search_clause(posn.ra, posn.dec, 0.5)).all()
     assert len(results) == 1
     # Now bump the cone to the side (so not matching) and check null return
     results = s.query(Coord).filter(
         coord_cone_search_clause(posn.ra, posn.dec + 1.0, 0.5)).all()
     assert len(results) == 0
Exemple #3
0
 def filter(self, filter_value):
     try:
         ra, dec, radius = json.loads(filter_value)
     except:
         raise apierror.InvalidQueryString(self.querystring_key,
                                           filter_value)
     if dec < -90.0 or dec > 90.0:
         raise apierror.InvalidQueryString(self.querystring_key,
                                           filter_value,
                                           reason="invalid declination value")
     return coord_cone_search_clause(ra, dec, radius)
Exemple #4
0
 def filter(self, filter_value):
     try:
         ra, dec, radius = json.loads(filter_value)
     except:
         raise apierror.InvalidQueryString(self.querystring_key,
                                           filter_value)
     if dec < -90.0 or dec > 90.0:
         raise apierror.InvalidQueryString(self.querystring_key,
                                           filter_value,
                                           reason="invalid declination value")
     return coord_cone_search_clause(ra, dec, radius)