Skip to content

Commit f1c2a84

Browse files
Add examples to the docs.
1 parent 3a25324 commit f1c2a84

File tree

2 files changed

+109
-6
lines changed

2 files changed

+109
-6
lines changed

astroquery/ipac/irsa/most/core.py

Lines changed: 105 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
as the returned data in both cases is identical, as the figures created in
6969
``Full`` mode are not downloaded. The difference between the two modes are
7070
mainly visible in presentation of the data when MOST is used via their
71-
online interface.
71+
online interface. It is, therefore, recommended ``Regular`` because the
72+
query will complete significantly faster.
7273
7374
Regular and Full
7475
________________
@@ -336,6 +337,109 @@
336337
| | | | Comets |
337338
| | | | (``YYYY+MM+DD+HH:MM:SS``) |
338339
+-------------------+------------------+-------+------------------------------+
340+
341+
Examples
342+
--------
343+
344+
By default the input mode will be set to ``"name_input"``, the times to ``None``
345+
and output mode to ``Regular``. So the only piece of information required is the
346+
object's name. Since this will search the whole of ``wise_merged`` catalog for
347+
any detections of the given asteroid - we will restrict the example query in
348+
time and output in order to have a more manageable output.
349+
350+
So we can query the night of Thursday, 29th of May 2015 for observations of an
351+
asteroid `Victoria <https://en.wikipedia.org/wiki/12_Victoria>`_ as:
352+
353+
.. doctest-remote-data::
354+
355+
>>> from astroquery.ipac.irsa.most import Most
356+
>>> Most.query_object(output_mode="Brief",
357+
... obj_name="Victoria",
358+
... obs_begin="2014-05-29",
359+
... obs_end="2014-05-30")
360+
<Table length=10>
361+
ra_obj dec_obj sun_dist geo_dist ... saa_sep qual_frame image_set
362+
float64 float64 float64 float64 ... float64 int64 int64
363+
---------- --------- -------- -------- ... ------- ---------- ---------
364+
333.539704 -0.779309 1.8179 1.4638 ... 15.039 10 6
365+
333.539704 -0.779309 1.8179 1.4638 ... 15.039 10 6
366+
333.589056 -0.747249 1.8179 1.4626 ... 46.517 10 6
367+
333.589056 -0.747249 1.8179 1.4626 ... 46.517 10 6
368+
333.638285 -0.71525 1.8179 1.4614 ... 89.053 10 6
369+
333.638285 -0.71525 1.8179 1.4614 ... 89.053 10 6
370+
333.687494 -0.683205 1.8178 1.4603 ... 115.076 10 6
371+
333.687494 -0.683205 1.8178 1.4603 ... 115.076 10 6
372+
333.73658 -0.651221 1.8178 1.4591 ... 73.321 10 6
373+
333.73658 -0.651221 1.8178 1.4591 ... 73.321 10 6
374+
375+
To return more than just a table of image identifiers, use one of the more
376+
verbose output modes - ``Regular`` or ``Full``.
377+
378+
.. doctest-remote-data::
379+
380+
>>> matched = Most.query_object(output_mode="Regular",
381+
... with_tarballs=True,
382+
... obj_name="Victoria",
383+
... obs_begin="2014-05-29",
384+
... obs_end="2014-05-30")
385+
>>> type(matched)
386+
<class 'dict'>
387+
>>> matched.keys()
388+
dict_keys(['results', 'metadata', 'region', 'fits_tarball', 'region_tarball'])
389+
>>> matched["metadata"]
390+
<Table length=10>
391+
ra_obj dec_obj sun_dist geo_dist ... saa_sep qual_frame image_set
392+
float64 float64 float64 float64 ... float64 int64 int64
393+
---------- --------- -------- -------- ... ------- ---------- ---------
394+
333.539704 -0.779309 1.8179 1.4638 ... 15.039 10 6
395+
333.539704 -0.779309 1.8179 1.4638 ... 15.039 10 6
396+
333.589056 -0.747249 1.8179 1.4626 ... 46.517 10 6
397+
333.589056 -0.747249 1.8179 1.4626 ... 46.517 10 6
398+
333.638285 -0.71525 1.8179 1.4614 ... 89.053 10 6
399+
333.638285 -0.71525 1.8179 1.4614 ... 89.053 10 6
400+
333.687494 -0.683205 1.8178 1.4603 ... 115.076 10 6
401+
333.687494 -0.683205 1.8178 1.4603 ... 115.076 10 6
402+
333.73658 -0.651221 1.8178 1.4591 ... 73.321 10 6
403+
333.73658 -0.651221 1.8178 1.4591 ... 73.321 10 6
404+
405+
As demonstrated, the returned values are stored in a dictionary and which
406+
``metadata`` key table matches the ``Brief`` output mode table.
407+
408+
The ``fits_tarball`` and ``region_tarballs`` keys store the URL of the TAR
409+
archive containing all 10 images that observed asteroid Victoria on that night.
410+
Individual images that were put into the archive are stored under the ``results``
411+
key:
412+
413+
.. doctest-remote-data::
414+
415+
>>> matched["fits_tarball"] # doctest: +IGNORE_OUTPUT
416+
'https://irsa.ipac.caltech.edu/workspace/TMP_X69utS_13312/MOST/pid15792/fitsimage_A850RA.tar.gz'
417+
>>> matched["region_tarball"] # doctest: +IGNORE_OUTPUT
418+
'https://irsa.ipac.caltech.edu/workspace/TMP_X69utS_13312/MOST/pid15792/ds9region_A850RA.tar'
419+
>>> matched["results"].columns
420+
<TableColumns names=('Image_ID','date_obs','time_obs','mjd_obs','ra_obj','dec_obj','sun_dist','geo_dist','dist_ctr','phase','vmag','image_url','postcard_url','region_file')> # noqa: E501
421+
>>> matched["results"]["time_obs", "image_url"] # doctest: +IGNORE_OUTPUT
422+
<Table length=10>
423+
time_obs image_url
424+
str12 str103
425+
------------ -------------------------------------------------------------------------------------------------------
426+
11:00:08.319 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/3b/49273b/134/49273b134-w2-int-1b.fits
427+
11:00:08.319 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/3b/49273b/134/49273b134-w1-int-1b.fits
428+
14:09:44.351 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/7b/49277b/135/49277b135-w1-int-1b.fits
429+
14:09:44.351 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/7b/49277b/135/49277b135-w2-int-1b.fits
430+
17:19:09.391 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/1b/49281b/134/49281b134-w2-int-1b.fits
431+
17:19:09.391 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/1b/49281b/134/49281b134-w1-int-1b.fits
432+
20:28:45.431 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/5b/49285b/135/49285b135-w2-int-1b.fits
433+
20:28:45.431 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/5b/49285b/135/49285b135-w1-int-1b.fits
434+
23:38:10.476 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/9b/49289b/134/49289b134-w1-int-1b.fits
435+
23:38:10.476 https://irsa.ipac.caltech.edu/ibe/data/wise/merge/merge_p1bm_frm/9b/49289b/134/49289b134-w2-int-1b.fits
436+
437+
.. note::
438+
The returned TAR Archives point to the MOST service hosted directory which
439+
will dissapear after a while, making the URLs return a 404 Not Found Error.
440+
The URLs returned by the results table, however, point to the NASA/IPAC
441+
Infrared Science Archive, which means that the URLs to the images themselves
442+
will remain valid even after the MOST URLs expire.
339443
"""
340444
import io
341445
import re

astroquery/ipac/irsa/tests/test_most.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io
44
import os
5-
import itertools
65
import pytest
76

87
from astropy.io import votable
@@ -24,10 +23,10 @@
2423
# and Regular are two different jobs with two different PIDs we need individual
2524
# results files
2625
GET_FILENAME_MAP = {
27-
REGULAR_BASE_URL+"results.tbl" : "most_regular_results.tbl",
28-
REGULAR_BASE_URL+"imgframes_matched_final_table.tbl" : "most_regular_metadata.tbl",
29-
FULL_BASE_URL+"results.tbl" : "most_full_results.tbl",
30-
FULL_BASE_URL+"imgframes_matched_final_table.tbl" : "most_full_metadata.tbl",
26+
REGULAR_BASE_URL+"results.tbl": "most_regular_results.tbl",
27+
REGULAR_BASE_URL+"imgframes_matched_final_table.tbl": "most_regular_metadata.tbl",
28+
FULL_BASE_URL+"results.tbl": "most_full_results.tbl",
29+
FULL_BASE_URL+"imgframes_matched_final_table.tbl": "most_full_metadata.tbl",
3130
"https://irsa.ipac.caltech.edu/applications/MOST/": "MOST_application.html"
3231
}
3332

0 commit comments

Comments
 (0)