示例#1
0
    def _one_image_search(self, coords, radius, service, image_format=None):
        if (type(coords) is tuple
                or type(coords) is list) and len(coords) == 2:
            coords = parse_coordinates("{} {}".format(coords[0], coords[1]))
        elif type(coords) is str:
            coords = parse_coordinates(coords)
        else:
            assert isinstance(
                coords,
                SkyCoord), "ERROR: cannot parse input coordinates {}".format(
                    coords)

        params = {
            'POS':
            utils.sval(coords.ra.deg) + ',' + utils.sval(coords.dec.deg),
            'SIZE': utils.sval(
                2. *
                float(radius)),  #Note: size in SIA is diameter, not radius!
        }
        if image_format is not None:
            params['FORMAT'] = image_format

        response = utils.try_query(service,
                                   get_params=params,
                                   timeout=self._TIMEOUT,
                                   retries=self._RETRIES)
        return utils.astropy_table_from_votable_response(response)
示例#2
0
 def _compute_coords(self, in_coords):
     # Get the RA and Dec from in_coords.
     coords = in_coords
     if (type(in_coords) is tuple or type(in_coords) is list) and len(in_coords) == 2:
         coords = parse_coordinates(f"{in_coords[0]} {in_coords[1]}")
     elif type(in_coords) is str:
         coords = parse_coordinates(in_coords)
     elif type(in_coords) is not SkyCoord:
         raise ValueError(f"Cannot parse input coordinates {in_coords}")  
     
     return coords
示例#3
0
    def _one_cone_search(self, coords, radius, service):
        if (type(coords) is tuple
                or type(coords) is list) and len(coords) == 2:
            coords = parse_coordinates("{} {}".format(coords[0], coords[1]))
        elif type(coords) is str:
            coords = parse_coordinates(coords)
        else:
            assert isinstance(
                coords,
                SkyCoord), "ERROR: cannot parse input coordinates {}".format(
                    coords)

        params = {'RA': coords.ra.deg, 'DEC': coords.dec.deg, 'SR': radius}

        response = utils.try_query(service,
                                   get_params=params,
                                   timeout=self._TIMEOUT,
                                   retries=self._RETRIES)

        return utils.astropy_table_from_votable_response(response)
示例#4
0
    def _compute_coords(self):
        # Get the RA and Dec from in_coords.
        in_coords = self._orig_coords
        coords = in_coords
        if in_coords is not None:
            if ((type(in_coords) is tuple or type(in_coords) is list)
                    and len(in_coords) == 2):
                coords = SkyCoord(in_coords[0],
                                  in_coords[1],
                                  frame="icrs",
                                  unit="deg")
            elif type(in_coords) is str:
                coords = parse_coordinates(in_coords)
            elif type(in_coords) is not SkyCoord:
                raise ValueError(f"Cannot parse input coordinates {in_coords}")

        return coords