astroquery/alfalfa/core.py
def query_region(self, coordinates, radius=3. * u.arcmin,
                     optical_counterpart=False):
        """
        Perform object cross-ID in ALFALFA.

        Search for objects near position (ra, dec) within some radius.

        Parameters
        ----------
        coordinates : str or `astropy.coordinates` object
            The target around which to search. It may be specified as a
            string in which case it is resolved using online services or as
            the appropriate `astropy.coordinates` object. ICRS coordinates
            may also be entered as strings as specified in the
            `astropy.coordinates` module.
        radius : str or `~astropy.units.Quantity` object, optional
            The string must be parsable by `astropy.coordinates.Angle`. The
            appropriate `~astropy.units.Quantity` object from
            `astropy.units` may also be used. Defaults to 3 arcmin.
        optical_counterpart : bool
            Search for position match using radio positions or position of
            any optical counterpart identified by ALFALFA team? Keep in mind
            that the ALFA beam size is about 3x3 arcminutes.

        See documentation for astropy.coordinates.angles for more information
        about ('ra', 'dec', 'unit') parameters.

        Examples
        --------
        >>> from astroquery.alfalfa import Alfalfa
        >>> from astropy import coordinates as coords
        >>> C = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
        >>> agc = Alfalfa.query_region(C,'3 arcmin')

        Returns
        -------
        result : AGC number for object nearest supplied position.

        """

        coordinates = commons.parse_coordinates(coordinates)

        ra = coordinates.ra.degree
        dec = coordinates.dec.degree
        dr = coord.Angle(radius).deg

        cat = self.get_catalog()

        # Use RA and DEC to find appropriate AGC
        if optical_counterpart:
            ra_ref = cat['RAdeg_OC']
            dec_ref = cat['DECdeg_OC']
        else:
            ra_ref = cat['RAdeg_HI']
            dec_ref = cat['Decdeg_HI']

        dra = np.abs(ra_ref - ra) \
            * np.cos(dec * np.pi / 180.)
        ddec = np.abs(dec_ref - dec)
        sep = np.sqrt(dra ** 2 + ddec ** 2)

        i_minsep = np.argmin(sep)
        minsep = sep[i_minsep]

        # Matched object within our search radius?
        if minsep < dr:
            return cat['AGCNr'][i_minsep]
        else:
            return None

        Perform object cross-ID in ALFALFA.

        Search for objects near position (ra, dec) within some radius.

        Parameters
        ----------
        coordinates : str or `astropy.coordinates` object
            The target around which to search. It may be specified as a
            string in which case it is resolved using online services or as
            the appropriate `astropy.coordinates` object. ICRS coordinates
            may also be entered as strings as specified in the
            `astropy.coordinates` module.
        radius : str or `~astropy.units.Quantity` object, optional
            The string must be parsable by `astropy.coordinates.Angle`. The
            appropriate `~astropy.units.Quantity` object from
            `astropy.units` may also be used. Defaults to 3 arcmin.
        optical_counterpart : bool
            Search for position match using radio positions or position of
            any optical counterpart identified by ALFALFA team? Keep in mind
            that the ALFA beam size is about 3x3 arcminutes.

        See documentation for astropy.coordinates.angles for more information
        about ('ra', 'dec', 'unit') parameters.

        Examples
        --------
        >>> from astroquery.alfalfa import Alfalfa
        >>> from astropy import coordinates as coords
        >>> C = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
        >>> agc = Alfalfa.query_region(C,'3 arcmin')

        Returns
        -------
        result : AGC number for object nearest supplied position.

        
Perform object cross-ID in ALFALFA.
Search for objects near position (ra, dec) within some radius.

Parameters

coordinates : str or `astropy.coordinates` object
The target around which to search. It may be specified as a
string in which case it is resolved using online services or as
the appropriate `astropy.coordinates` object. ICRS coordinates
may also be entered as strings as specified in the
`astropy.coordinates` module.
radius : str or `~astropy.units.Quantity` object, optional
The string must be parsable by `astropy.coordinates.Angle`. The
appropriate `~astropy.units.Quantity` object from
`astropy.units` may also be used. Defaults to 3 arcmin.
optical_counterpart : bool
Search for position match using radio positions or position of
any optical counterpart identified by ALFALFA team. Keep in mind
that the ALFA beam size is about 3x3 arcminutes.



Examples



Returns

result : AGC number for object nearest supplied position.
Perform object cross - ID in ALFALFA . Search for objects near position ( ra dec ) within some radius . Parameters coordinates : str or ` astropy . coordinates ` object The target around which to search . It may be specified as a string in which case it is resolved using online services or as the appropriate ` astropy . coordinates ` object . ICRS coordinates may also be entered as strings as specified in the ` astropy . coordinates ` module . radius : str or ` ~astropy . units . Quantity ` object optional The string must be parsable by ` astropy . coordinates . Angle ` . The appropriate ` ~astropy . units . Quantity ` object from ` astropy . units ` may also be used . Defaults to 3 arcmin . optical_counterpart : bool Search for position match using radio positions or position of any optical counterpart identified by ALFALFA team . Keep in mind that the ALFA beam size is about 3x3 arcminutes . Examples Returns result : AGC number for object nearest supplied position .
def query_region(self, coordinates, radius=3. * u.arcmin,
                     optical_counterpart=False):
        coordinates = commons.parse_coordinates(coordinates)
        ra = coordinates.ra.degree
        dec = coordinates.dec.degree
        dr = coord.Angle(radius).deg
        cat = self.get_catalog()
        if optical_counterpart:
            ra_ref = cat['RAdeg_OC']
            dec_ref = cat['DECdeg_OC']
        else:
            ra_ref = cat['RAdeg_HI']
            dec_ref = cat['Decdeg_HI']
        dra = np.abs(ra_ref - ra) \
            * np.cos(dec * np.pi / 180.)
        ddec = np.abs(dec_ref - dec)
        sep = np.sqrt(dra ** 2 + ddec ** 2)
        i_minsep = np.argmin(sep)
        minsep = sep[i_minsep]
        if minsep < dr:
            return cat['AGCNr'][i_minsep]
        else:
            return None
def query_region ( self , coordinates , radius = 3. * u . arcmin , optical_counterpart = False ) : coordinates = commons . parse_coordinates ( coordinates ) ra = coordinates . ra . degree dec = coordinates . dec . degree dr = coord . Angle ( radius ) . deg cat = self . get_catalog ( ) if optical_counterpart : ra_ref = cat [ 'RAdeg_OC' ] dec_ref = cat [ 'DECdeg_OC' ] else : ra_ref = cat [ 'RAdeg_HI' ] dec_ref = cat [ 'Decdeg_HI' ] dra = np . abs ( ra_ref - ra ) * np . cos ( dec * np . pi / 180. ) ddec = np . abs ( dec_ref - dec ) sep = np . sqrt ( dra ** 2 + ddec ** 2 ) i_minsep = np . argmin ( sep ) minsep = sep [ i_minsep ] if minsep < dr : return cat [ 'AGCNr' ] [ i_minsep ] else : return None
Perform object cross-ID in ALFALFA.
Perform object cross - ID in ALFALFA .
"""
        Perform object cross-ID in ALFALFA.

        Search for objects near position (ra, dec) within some radius.

        Parameters
        ----------
        coordinates : str or `astropy.coordinates` object
            The target around which to search. It may be specified as a
            string in which case it is resolved using online services or as
            the appropriate `astropy.coordinates` object. ICRS coordinates
            may also be entered as strings as specified in the
            `astropy.coordinates` module.
        radius : str or `~astropy.units.Quantity` object, optional
            The string must be parsable by `astropy.coordinates.Angle`. The
            appropriate `~astropy.units.Quantity` object from
            `astropy.units` may also be used. Defaults to 3 arcmin.
        optical_counterpart : bool
            Search for position match using radio positions or position of
            any optical counterpart identified by ALFALFA team? Keep in mind
            that the ALFA beam size is about 3x3 arcminutes.

        See documentation for astropy.coordinates.angles for more information
        about ('ra', 'dec', 'unit') parameters.

        Examples
        --------
        >>> from astroquery.alfalfa import Alfalfa
        >>> from astropy import coordinates as coords
        >>> C = coords.SkyCoord('0h8m05.63s +14d50m23.3s')
        >>> agc = Alfalfa.query_region(C,'3 arcmin')

        Returns
        -------
        result : AGC number for object nearest supplied position.

        """ # Use RA and DEC to find appropriate AGC # Matched object within our search radius?
self
coordinates
radius
optical_counterpart