Skip to content

Commit 851499b

Browse files
committed
optimize doctests
1 parent 3e26521 commit 851499b

File tree

3 files changed

+62
-63
lines changed

3 files changed

+62
-63
lines changed

docs/mast/mast_catalog.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ the user that they might be getting a subset of the true result set.
5353

5454
>>> from astroquery.mast import Catalogs
5555
...
56-
>>> catalog_data = Catalogs.query_region("322.49324 12.16683", catalog="HSC", magtype=2) # doctest: +SHOW_WARNINGS
56+
>>> catalog_data = Catalogs.query_region("322.49324 12.16683",
57+
... catalog="HSC",
58+
... magtype=2) # doctest: +SHOW_WARNINGS
5759
InputWarning: Coordinate string is being interpreted as an ICRS coordinate provided in degrees.
5860
MaxResultsWarning: Maximum catalog results returned, may not include all sources within radius.
5961
>>> print(catalog_data[:10])
@@ -259,7 +261,10 @@ Given an HSC Match ID, return all catalog results.
259261

260262
>>> from astroquery.mast import Catalogs
261263
...
262-
>>> catalog_data = Catalogs.query_object("M10", radius=.02, catalog="HSC")
264+
>>> catalog_data = Catalogs.query_object("M10",
265+
... radius=.001,
266+
... catalog="HSC",
267+
... magtype=1)
263268
>>> matchid = catalog_data[0]["MatchID"]
264269
>>> print(matchid)
265270
7542452

docs/mast/mast_cut.rst

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ not explicitly called for TICA.
5353
>>> from astropy.coordinates import SkyCoord
5454
...
5555
>>> cutout_coord = SkyCoord(107.18696, -70.50919, unit="deg")
56-
>>> hdulist = Tesscut.get_cutouts(coordinates=cutout_coord)
56+
>>> hdulist = Tesscut.get_cutouts(coordinates=cutout_coord, sector=33)
5757
>>> hdulist[0].info() # doctest: +IGNORE_OUTPUT
5858
Filename: <class '_io.BytesIO'>
5959
No. Name Ver Type Cards Dimensions Format
60-
0 PRIMARY 1 PrimaryHDU 56 ()
61-
1 PIXELS 1 BinTableHDU 280 1196R x 12C [D, E, J, 25J, 25E, 25E, 25E, 25E, J, E, E, 38A]
62-
2 APERTURE 1 ImageHDU 81 (5, 5) int32
60+
0 PRIMARY 1 PrimaryHDU 57 ()
61+
1 PIXELS 1 BinTableHDU 281 3495R x 12C [D, E, J, 25J, 25E, 25E, 25E, 25E, J, E, E, 38A]
62+
2 APERTURE 1 ImageHDU 82 (5, 5) int32
6363

6464

6565
For users with time-sensitive targets who would like cutouts from the latest observations,
@@ -72,7 +72,9 @@ this example shows a request for TICA cutouts:
7272
>>> from astropy.coordinates import SkyCoord
7373
...
7474
>>> cutout_coord = SkyCoord(107.18696, -70.50919, unit="deg")
75-
>>> hdulist = Tesscut.get_cutouts(coordinates=cutout_coord, product='tica')
75+
>>> hdulist = Tesscut.get_cutouts(coordinates=cutout_coord,
76+
... product='tica',
77+
... sector=28)
7678
>>> hdulist[0][0].header['FFI_TYPE'] # doctest: +IGNORE_OUTPUT
7779
'TICA'
7880

@@ -83,7 +85,7 @@ than a set of coordinates.
8385

8486
>>> from astroquery.mast import Tesscut
8587
...
86-
>>> hdulist = Tesscut.get_cutouts(objectname="TIC 32449963")
88+
>>> hdulist = Tesscut.get_cutouts(objectname="TIC 32449963", sector=37)
8789
>>> hdulist[0].info() # doctest: +IGNORE_OUTPUT
8890
Filename: <class '_io.BytesIO'>
8991
No. Name Ver Type Cards Dimensions Format
@@ -106,7 +108,9 @@ simply with either the objectname or coordinates.
106108

107109
>>> from astroquery.mast import Tesscut
108110
...
109-
>>> hdulist = Tesscut.get_cutouts(objectname="Eleonora", moving_target=True, size=5, sector=6)
111+
>>> hdulist = Tesscut.get_cutouts(objectname="Eleonora",
112+
... moving_target=True,
113+
... sector=6)
110114
>>> hdulist[0].info() # doctest: +IGNORE_OUTPUT
111115
Filename: <class '_io.BytesIO'>
112116
No. Name Ver Type Cards Dimensions Format
@@ -141,12 +145,12 @@ pixel file will be produced for each one.
141145
>>> import astropy.units as u
142146
...
143147
>>> cutout_coord = SkyCoord(107.18696, -70.50919, unit="deg")
144-
>>> manifest = Tesscut.download_cutouts(coordinates=cutout_coord, size=[5, 7]*u.arcmin, sector=9) # doctest: +IGNORE_OUTPUT
148+
>>> manifest = Tesscut.download_cutouts(coordinates=cutout_coord, size=[5, 5]*u.arcmin, sector=9) # doctest: +IGNORE_OUTPUT
145149
Downloading URL https://mast.stsci.edu/tesscut/api/v0.1/astrocut?ra=107.18696&dec=-70.50919&y=0.08333333333333333&x=0.11666666666666667&units=d&sector=9 to ./tesscut_20210716150026.zip ... [Done]
146150
>>> print(manifest) # doctest: +IGNORE_OUTPUT
147151
Local Path
148152
----------------------------------------------------------
149-
./tess-s0009-4-1_107.186960_-70.509190_21x15_astrocut.fits
153+
./tess-s0009-4-1_107.186960_-70.509190_15x15_astrocut.fits
150154

151155
The query from the example above defaults to downloading cutouts from SPOC. The following example is a query for
152156
the same target from above, but with the product argument passed as TICA to explicitly request for TICA cutouts,
@@ -234,17 +238,6 @@ The following example requests SPOC cutouts for a moving target.
234238
Note that the moving targets functionality is not currently available for TICA,
235239
so the query will always default to SPOC.
236240

237-
.. doctest-remote-data::
238-
239-
>>> from astroquery.mast import Tesscut
240-
...
241-
>>> sector_table = Tesscut.get_sectors(objectname="Ceres", moving_target=True)
242-
>>> print(sector_table)
243-
sectorName sector camera ccd
244-
-------------- ------ ------ ---
245-
tess-s0029-1-4 29 1 4
246-
tess-s0043-3-3 43 3 3
247-
tess-s0044-2-4 44 2 4
248241

249242
Zcut
250243
====
@@ -270,7 +263,7 @@ If the given coordinate appears in more than one Zcut survey, a FITS file will b
270263
>>> from astropy.coordinates import SkyCoord
271264
...
272265
>>> cutout_coord = SkyCoord(189.49206, 62.20615, unit="deg")
273-
>>> hdulist = Zcut.get_cutouts(coordinates=cutout_coord, size=5)
266+
>>> hdulist = Zcut.get_cutouts(coordinates=cutout_coord, survey='3dhst_goods-n')
274267
>>> hdulist[0].info() # doctest: +IGNORE_OUTPUT
275268
Filename: <class '_io.BytesIO'>
276269
No. Name Ver Type Cards Dimensions Format
@@ -292,31 +285,37 @@ If a given coordinate appears in more than one Zcut survey, a cutout will be pro
292285
>>> from astropy.coordinates import SkyCoord
293286
...
294287
>>> cutout_coord = SkyCoord(189.49206, 62.20615, unit="deg")
295-
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord, size=[200, 300], units="px") # doctest: +IGNORE_OUTPUT
288+
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord,
289+
... size=[5, 10],
290+
... units="px",
291+
... survey="3dhst_goods-n") # doctest: +IGNORE_OUTPUT
296292
Downloading URL https://mast.stsci.edu/zcut/api/v0.1/astrocut?ra=189.49206&dec=62.20615&y=200&x=300&units=px&format=fits to ./zcut_20210125155545.zip ... [Done]
297293
Inflating...
298294
...
299295
>>> print(manifest) # doctest: +IGNORE_OUTPUT
300296
Local Path
301297
-------------------------------------------------------------------------
302298
./candels_gn_30mas_189.492060_62.206150_300.0pix-x-200.0pix_astrocut.fits
303-
304-
305-
.. doctest-remote-data::
306-
307-
>>> from astroquery.mast import Zcut
308-
>>> from astropy.coordinates import SkyCoord
309-
...
310-
>>> cutout_coord = SkyCoord(189.49206, 62.20615, unit="deg")
311-
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord, size=[200, 300], units="px", form="jpg") # doctest: +IGNORE_OUTPUT
299+
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord,
300+
... size=[5, 10],
301+
... units="px",
302+
... survey="3dhst_goods-n",
303+
... cutout_format="jpg") # doctest: +IGNORE_OUTPUT
312304
Downloading URL https://mast.stsci.edu/zcut/api/v0.1/astrocut?ra=189.49206&dec=62.20615&y=200&x=300&units=px&format=jpg to ./zcut_20201202132453.zip ... [Done]
313305
...
314-
>>> print(manifest) # doctest: +IGNORE_OUTPUT
315-
Local Path
316-
---------------------------------------------------------------------------------------------------------
317-
./hlsp_candels_hst_acs_gn-tot-30mas_f606w_v1.0_drz_189.492060_62.206150_300.0pix-x-200.0pix_astrocut.jpg
318-
./hlsp_candels_hst_acs_gn-tot-30mas_f814w_v1.0_drz_189.492060_62.206150_300.0pix-x-200.0pix_astrocut.jpg
319-
./hlsp_candels_hst_acs_gn-tot-30mas_f850lp_v1.0_drz_189.492060_62.206150_300.0pix-x-200.0pix_astrocut.jpg
306+
>>> print(manifest)
307+
Local Path
308+
-----------------------------------------------------------------------------------------------------
309+
./hlsp_3dhst_spitzer_irac_goods-n_irac1_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
310+
./hlsp_3dhst_spitzer_irac_goods-n-s2_irac3_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
311+
./hlsp_3dhst_spitzer_irac_goods-n-s1_irac4_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
312+
./hlsp_3dhst_spitzer_irac_goods-n_irac2_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
313+
./hlsp_3dhst_mayall_mosaic_goods-n_u_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
314+
./hlsp_3dhst_subaru_suprimecam_goods-n_rc_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
315+
./hlsp_3dhst_subaru_suprimecam_goods-n_v_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
316+
./hlsp_3dhst_subaru_suprimecam_goods-n_ic_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
317+
./hlsp_3dhst_subaru_suprimecam_goods-n_zp_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
318+
./hlsp_3dhst_subaru_suprimecam_goods-n_b_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
320319

321320

322321
Survey information
@@ -387,5 +386,6 @@ If the given coordinate appears in more than one product, a cutout will be produ
387386
Local Path
388387
---------------------------------------------------------------------------------
389388
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_ir_f160w_coarse.fits
389+
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_ir_f160w.fits
390390
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_uvis_f606w.fits
391391
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_uvis_f814w.fits

docs/mast/mast_obsquery.rst

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Radius is an optional parameter and the default is 0.2 degrees.
3535

3636
>>> from astroquery.mast import Observations
3737
...
38-
>>> obs_table = Observations.query_object("M8",radius=".02 deg")
38+
>>> obs_table = Observations.query_object("M8", radius=".02 deg")
3939
>>> print(obs_table[:10]) # doctest: +IGNORE_OUTPUT
4040
intentType obs_collection provenance_name ... srcDen obsid distance
4141
---------- -------------- --------------- ... ------ ----------- --------
@@ -96,22 +96,19 @@ RA and Dec must be given in decimal degrees, and datetimes in MJD.
9696
image 1 HST ... science 2003520266 2023816134
9797
image 1 HST ... science 2003520268 2025756935
9898
...
99-
>>> obs_table = Observations.query_criteria(filters=["*UV","Kepler"],objectname="M101")
99+
>>> obs_table = Observations.query_criteria(filters=["*UV","Kepler"],
100+
... objectname="M10",
101+
... obs_collection="GALEX")
100102
>>> print(obs_table) # doctest: +IGNORE_OUTPUT
101-
dataproduct_type calib_level obs_collection ... objID1 distance
102-
---------------- ----------- -------------- ... ---------- ------------------
103-
image 2 GALEX ... 1000045952 0.0
104-
image 2 GALEX ... 1000001327 371.71837196246395
105-
image 2 GALEX ... 1000016641 0.0
106-
image 2 GALEX ... 1000016644 229.81061601101433
107-
image 2 GALEX ... 1000001326 0.0
108-
image 2 GALEX ... 1000004203 0.0
109-
image 2 GALEX ... 1000004937 3.8329068532314046
110-
image 2 GALEX ... 1000045953 371.71837196246395
111-
image 2 GALEX ... 1000048357 0.0
112-
image 2 GALEX ... 1000048943 3.8329068532314046
113-
image 2 GALEX ... 1000055044 0.0
114-
image 2 GALEX ... 1000055047 229.81061601101433
103+
intentType obs_collection provenance_name ... objID objID1 distance
104+
---------- -------------- --------------- ... ----- ------ --------
105+
science GALEX GII ... 7022 7022 0.0
106+
science GALEX GII ... 7023 7023 0.0
107+
science GALEX AIS ... 61673 61673 0.0
108+
science GALEX AIS ... 61674 61674 0.0
109+
science GALEX AIS ... 61675 61675 0.0
110+
science GALEX AIS ... 61676 61676 0.0
111+
science GALEX GII ... 78941 78941 0.0
115112

116113
We encourage the use of wildcards particularly when querying for JWST instruments
117114
with the instrument_name criteria. This is because of the varying instrument names
@@ -138,17 +135,14 @@ This can be useful if trying to decide whether the available memory is sufficien
138135

139136
>>> from astroquery.mast import Observations
140137
...
141-
>>> print(Observations.query_region_count("322.49324 12.16683")) # doctest: +IGNORE_OUTPUT
142-
2364
138+
>>> print(Observations.query_region_count("322.49324 12.16683", radius=0.001)) # doctest: +IGNORE_OUTPUT
139+
6338
143140
...
144141
>>> print(Observations.query_object_count("M8",radius=".02 deg")) # doctest: +IGNORE_OUTPUT
145142
469
146143
...
147-
>>> print(Observations.query_criteria_count(dataproduct_type="image",
148-
... filters=["NUV","FUV"],
149-
... t_max=[52264.4586,54452.8914])) # doctest: +IGNORE_OUTPUT
150-
59033
151-
144+
>>> print(Observations.query_criteria_count(proposal_id=8880)) # doctest: +IGNORE_OUTPUT
145+
8
152146

153147

154148
Metadata Queries
@@ -162,7 +156,7 @@ use the `~astroquery.mast.ObservationsClass.list_missions` function.
162156
>>> from astroquery.mast import Observations
163157
...
164158
>>> print(Observations.list_missions())
165-
['BEFS', 'EUVE', 'FIMS-SPEAR', 'FUSE', 'GALEX', 'HLA', 'HLSP', 'HST', 'HUT', 'IUE', 'JWST', 'K2', 'K2FFI', 'Kepler', 'KeplerFFI', 'OPO', 'PS1', 'SPITZER_SHA', 'SWIFT', 'TESS', 'TUES', 'WUPPE']
159+
['BEFS', 'EUVE', 'FIMS-SPEAR', 'FUSE', 'GALEX', 'HLA', 'HLSP', 'HST', 'HUT', 'IUE', 'JWST', 'K2', 'K2FFI', 'Kepler', 'KeplerFFI', 'OPO', 'PS1', 'SDSS', 'SPITZER_SHA', 'SWIFT', 'TESS', 'TUES', 'WUPPE']
166160

167161
To get a table of metadata associated with observation or product lists use the
168162
`~astroquery.mast.ObservationsClass.get_metadata` function.

0 commit comments

Comments
 (0)