Skip to content

Commit

Permalink
Merge pull request #1952 from tinumide/magpis-others-doc-cleanup
Browse files Browse the repository at this point in the history
Magpis, Xmatch documentation cleanup
  • Loading branch information
bsipocz authored Nov 18, 2022
2 parents f14f0a5 + f7a3443 commit 9bf69d3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 27 deletions.
44 changes: 22 additions & 22 deletions docs/magpis/magpis.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. doctest-skip-all
.. _astroquery.magpis:

*****************************************
Expand All @@ -16,15 +14,15 @@ functions or as coordinates using any of the coordinate systems available in
`astropy.coordinates`. The FITS image is returned as an
`~astropy.io.fits.HDUList` object. Here is a sample query:

.. code-block:: python
.. doctest-remote-data::

>>> from astroquery.magpis import Magpis
>>> from astropy import coordinates
>>> from astropy import units as u
>>> image = Magpis.get_images(coordinates.SkyCoord(10.5*u.deg, 0.0*u.deg,
... frame='galactic'))
>>> image
>>> image # doctest: +IGNORE_OUTPUT

[<astropy.io.fits.hdu.image.PrimaryHDU at 0x4008650>]

There are some other optional parameters that you may additionally specify.
Expand All @@ -35,29 +33,31 @@ appropriate `~astropy.units.Quantity` object.
You may also specify the MAGPIS survey from which to fetch the cutout via the
keyword ``survey``. To know the list of valid surveys:

.. code-block:: python
.. doctest-remote-data::

>>> from astroquery.magpis import Magpis
>>> Magpis.list_surveys()
['gps6epoch3',
'gps6epoch4',
'gps20',
'gps20new',
'gps90',
'gpsmsx',
'gpsmsx2',
'gpsglimpse36',
'gpsglimpse45',
'gpsglimpse58',
'gpsglimpse80',
'mipsgal',
'bolocam']
['gps6',
'gps6epoch2',
'gps6epoch3',
'gps6epoch4',
'gps20',
'gps20new',
'gps90',
'gpsmsx',
'gpsmsx2',
'gpsglimpse36',
'gpsglimpse45',
'gpsglimpse58',
'gpsglimpse80',
'mipsgal',
'atlasgal',
'bolocam']

The default survey used is 'bolocam'. Here is a query setting these optional
parameters as well.

.. code-block:: python
.. doctest-remote-data::

>>> from astroquery.magpis import Magpis
>>> import astropy.units as u
Expand All @@ -66,7 +66,7 @@ parameters as well.
... frame='galactic'),
... image_size=10*u.arcmin,
... survey='gps20new')
>>> image
>>> image # doctest: +IGNORE_OUTPUT

[<astropy.io.fits.hdu.image.PrimaryHDU at 0x4013e10>]

Expand Down
28 changes: 23 additions & 5 deletions docs/xmatch/xmatch.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. doctest-skip-all
.. _astroquery_xmatch:

************************************
Expand All @@ -23,20 +21,33 @@ has the following content::
306.01575,33.86756
322.493,12.16703

.. testsetup::

>>> with open('pos_list.csv', 'w') as f: # doctest: +IGNORE_OUTPUT
... f.write("""ra,dec
... 267.22029,-20.35869
... 274.83971,-25.42714
... 275.92229,-30.36572
... 283.26621,-8.70756
... 306.01575,33.86756
... 322.493,12.16703""")

Next, the xMatch service will be used to find cross matches between the
uploaded file and a VizieR catalogue. The parameters ``cat1`` and ``cat2``
define the catalogues where one of them may point to a local file (in this
example, the CSV file is stored in
``'/tmp/pos_list.csv'``). ``max_distance`` denotes the maximum distance in
``'pos_list.csv'``). ``max_distance`` denotes the maximum distance in
arcsec to look for counterparts; it is used here to limit the number of rows
in the resulting table for demonstration purposes. Finally, ``colRa1`` and
``colDec1`` are used to denote the column names in the input file.

.. code-block:: python
.. doctest-remote-data::

>>> from astropy import units as u
>>> from astroquery.xmatch import XMatch
>>> table = XMatch.query(cat1=open('/tmp/pos_list.csv'),
>>> from astropy.table import Table
>>> input_table = Table.read('pos_list.csv')
>>> table = XMatch.query(cat1=input_table,
... cat2='vizier:II/246/out',
... max_distance=5 * u.arcsec, colRA1='ra',
... colDec1='dec')
Expand All @@ -57,6 +68,13 @@ in the resulting table for demonstration purposes. Finally, ``colRa1`` and
0.853178 322.493 12.16703 21295836+1210007 ... EEA 222 0 2451080.6935
4.50395 322.493 12.16703 21295861+1210023 ... EEE 222 0 2451080.6935


.. testcleanup::

>>> from astroquery.utils import cleanup_saved_downloads
>>> cleanup_saved_downloads(['pos_list.csv'])


Reference/API
=============

Expand Down

0 comments on commit 9bf69d3

Please sign in to comment.