Skip to content

Commit 147546c

Browse files
authored
Merge pull request #3122 from snbianco/ASB-28019-doctests
Reduce running time for MAST doctests
2 parents 3e26521 + 701a4e3 commit 147546c

File tree

3 files changed

+95
-74
lines changed

3 files changed

+95
-74
lines changed

docs/mast/mast_catalog.rst

Lines changed: 25 additions & 9 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])
@@ -115,8 +117,11 @@ The table to query is a required parameter.
115117

116118
.. doctest-remote-data::
117119

118-
>>> catalog_data = Catalogs.query_region("158.47924 -7.30962", radius=0.1,
119-
... catalog="Panstarrs", data_release="dr1", table="mean")
120+
>>> catalog_data = Catalogs.query_region("158.47924 -7.30962",
121+
... radius=0.1,
122+
... catalog="Panstarrs",
123+
... data_release="dr1",
124+
... table="mean")
120125
>>> print("Number of results:",len(catalog_data))
121126
Number of results: 7007
122127
>>> print(catalog_data[:10]) # doctest: +IGNORE_OUTPUT
@@ -166,7 +171,9 @@ The TESS Input Catalog (TIC), Disk Detective Catalog, and PanSTARRS Catalog can
166171
>>> from astroquery.mast import Catalogs
167172
...
168173
>>> catalog_data = Catalogs.query_criteria(catalog="Ctl",
169-
... objectname='M101', radius=1, Tmag=[10.75,11])
174+
... objectname='M101',
175+
... radius=1,
176+
... Tmag=[10.75,11])
170177
>>> print(catalog_data)
171178
ID version HIP TYC ... raddflag wdflag objID
172179
--------- -------- --- ------------ ... -------- ------ ---------
@@ -185,7 +192,9 @@ The TESS Input Catalog (TIC), Disk Detective Catalog, and PanSTARRS Catalog can
185192
>>> from astroquery.mast import Catalogs
186193
...
187194
>>> catalog_data = Catalogs.query_criteria(catalog="DiskDetective",
188-
... objectname="M10",radius=2,state="complete")
195+
... objectname="M10",
196+
... radius=2,
197+
... state="complete")
189198
>>> print(catalog_data) # doctest: +IGNORE_OUTPUT
190199
designation ... ZooniverseURL
191200
------------------- ... ----------------------------------------------------
@@ -230,11 +239,15 @@ tuples of criteria decorator (min, gte, gt, max, lte, lt, like, contains) and va
230239

231240
.. doctest-remote-data::
232241

233-
>>> catalog_data = Catalogs.query_criteria(coordinates="5.97754 32.53617", radius=0.01,
234-
... catalog="PANSTARRS", table="mean", data_release="dr2",
242+
>>> catalog_data = Catalogs.query_criteria(coordinates="5.97754 32.53617",
243+
... radius=0.01,
244+
... catalog="PANSTARRS",
245+
... table="mean",
246+
... data_release="dr2",
235247
... nStackDetections=[("gte", 2)],
236248
... columns=["objName", "objID", "nStackDetections", "distance"],
237-
... sort_by=[("desc", "distance")], pagesize=15)
249+
... sort_by=[("desc", "distance")],
250+
... pagesize=15)
238251
>>> print(catalog_data[:10]) # doctest: +IGNORE_OUTPUT
239252
objName objID nStackDetections distance
240253
--------------------- ------------------ ---------------- ---------------------
@@ -259,7 +272,10 @@ Given an HSC Match ID, return all catalog results.
259272

260273
>>> from astroquery.mast import Catalogs
261274
...
262-
>>> catalog_data = Catalogs.query_object("M10", radius=.02, catalog="HSC")
275+
>>> catalog_data = Catalogs.query_object("M10",
276+
... radius=.001,
277+
... catalog="HSC",
278+
... magtype=1)
263279
>>> matchid = catalog_data[0]["MatchID"]
264280
>>> print(matchid)
265281
7542452

docs/mast/mast_cut.rst

Lines changed: 47 additions & 39 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
@@ -121,7 +125,10 @@ parameter will result in an error when set to 'TICA'.
121125

122126
>>> from astroquery.mast import Tesscut
123127
...
124-
>>> hdulist = Tesscut.get_cutouts(objectname="Eleonora", product='tica', moving_target=True, size=5, sector=6)
128+
>>> hdulist = Tesscut.get_cutouts(objectname="Eleonora",
129+
... product='tica',
130+
... moving_target=True,
131+
... sector=6)
125132
Traceback (most recent call last):
126133
...
127134
astroquery.exceptions.InvalidQueryError: Only SPOC is available for moving targets queries.
@@ -141,12 +148,14 @@ pixel file will be produced for each one.
141148
>>> import astropy.units as u
142149
...
143150
>>> 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
151+
>>> manifest = Tesscut.download_cutouts(coordinates=cutout_coord,
152+
... size=[5, 5]*u.arcmin,
153+
... sector=9) # doctest: +IGNORE_OUTPUT
145154
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]
146155
>>> print(manifest) # doctest: +IGNORE_OUTPUT
147156
Local Path
148157
----------------------------------------------------------
149-
./tess-s0009-4-1_107.186960_-70.509190_21x15_astrocut.fits
158+
./tess-s0009-4-1_107.186960_-70.509190_15x15_astrocut.fits
150159

151160
The query from the example above defaults to downloading cutouts from SPOC. The following example is a query for
152161
the same target from above, but with the product argument passed as TICA to explicitly request for TICA cutouts,
@@ -159,7 +168,10 @@ and because the TICA products are not available for sectors 1-26, we request cut
159168
>>> import astropy.units as u
160169
...
161170
>>> cutout_coord = SkyCoord(107.18696, -70.50919, unit="deg")
162-
>>> manifest = Tesscut.download_cutouts(coordinates=cutout_coord, product='tica', size=[5, 7]*u.arcmin, sector=27) # doctest: +IGNORE_OUTPUT
171+
>>> manifest = Tesscut.download_cutouts(coordinates=cutout_coord,
172+
... product='tica',
173+
... size=[5, 7]*u.arcmin,
174+
... sector=27) # doctest: +IGNORE_OUTPUT
163175
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&product=TICA&sector=27 to ./tesscut_20230214150644.zip ... [Done]
164176
>>> print(manifest) # doctest: +IGNORE_OUTPUT
165177
Local Path
@@ -234,17 +246,6 @@ The following example requests SPOC cutouts for a moving target.
234246
Note that the moving targets functionality is not currently available for TICA,
235247
so the query will always default to SPOC.
236248

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
248249

249250
Zcut
250251
====
@@ -270,7 +271,7 @@ If the given coordinate appears in more than one Zcut survey, a FITS file will b
270271
>>> from astropy.coordinates import SkyCoord
271272
...
272273
>>> cutout_coord = SkyCoord(189.49206, 62.20615, unit="deg")
273-
>>> hdulist = Zcut.get_cutouts(coordinates=cutout_coord, size=5)
274+
>>> hdulist = Zcut.get_cutouts(coordinates=cutout_coord, survey='3dhst_goods-n')
274275
>>> hdulist[0].info() # doctest: +IGNORE_OUTPUT
275276
Filename: <class '_io.BytesIO'>
276277
No. Name Ver Type Cards Dimensions Format
@@ -292,31 +293,37 @@ If a given coordinate appears in more than one Zcut survey, a cutout will be pro
292293
>>> from astropy.coordinates import SkyCoord
293294
...
294295
>>> 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
296+
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord,
297+
... size=[5, 10],
298+
... units="px",
299+
... survey="3dhst_goods-n") # doctest: +IGNORE_OUTPUT
296300
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]
297301
Inflating...
298302
...
299303
>>> print(manifest) # doctest: +IGNORE_OUTPUT
300304
Local Path
301305
-------------------------------------------------------------------------
302306
./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
307+
>>> manifest = Zcut.download_cutouts(coordinates=cutout_coord,
308+
... size=[5, 10],
309+
... units="px",
310+
... survey="3dhst_goods-n",
311+
... cutout_format="jpg") # doctest: +IGNORE_OUTPUT
312312
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]
313313
...
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
314+
>>> print(manifest)
315+
Local Path
316+
-----------------------------------------------------------------------------------------------------
317+
./hlsp_3dhst_spitzer_irac_goods-n_irac1_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
318+
./hlsp_3dhst_spitzer_irac_goods-n-s2_irac3_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
319+
./hlsp_3dhst_spitzer_irac_goods-n-s1_irac4_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
320+
./hlsp_3dhst_spitzer_irac_goods-n_irac2_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
321+
./hlsp_3dhst_mayall_mosaic_goods-n_u_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
322+
./hlsp_3dhst_subaru_suprimecam_goods-n_rc_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
323+
./hlsp_3dhst_subaru_suprimecam_goods-n_v_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
324+
./hlsp_3dhst_subaru_suprimecam_goods-n_ic_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
325+
./hlsp_3dhst_subaru_suprimecam_goods-n_zp_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
326+
./hlsp_3dhst_subaru_suprimecam_goods-n_b_v4.0_sc_189.492060_62.206150_10.0pix-x-5.0pix_astrocut.jpg
320327

321328

322329
Survey information
@@ -387,5 +394,6 @@ If the given coordinate appears in more than one product, a cutout will be produ
387394
Local Path
388395
---------------------------------------------------------------------------------
389396
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_ir_f160w_coarse.fits
397+
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_ir_f160w.fits
390398
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_uvis_f606w.fits
391399
./hst_cutout_skycell-p2007x09y05-ra351d3478-decn28d4978_wfc3_uvis_f814w.fits

0 commit comments

Comments
 (0)