Skip to content

Commit 58fc0bf

Browse files
committed
Fix doctests, skip bugs
1 parent 37c02b6 commit 58fc0bf

File tree

1 file changed

+59
-68
lines changed

1 file changed

+59
-68
lines changed

docs/cadc/cadc.rst

Lines changed: 59 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,42 @@ these collections:
3333
>>> for collection, details in sorted(cadc.get_collections().items()):
3434
... print('{} : {}'.format(collection, details))
3535
...
36-
APASS : {'Description': 'The APASS collection at the CADC', 'Bands': ['Optical', 'Infrared', '']}
36+
APASS : {'Description': 'The APASS collection at the CADC', 'Bands': ['Optical', 'Infrared|Optical', '']}
3737
BLAST : {'Description': 'The BLAST collection at the CADC', 'Bands': ['', 'Millimeter']}
3838
CFHT : {'Description': 'The CFHT collection at the CADC', 'Bands': ['Infrared|Optical', 'Infrared|Optical|UV', '', 'Infrared|Optical|UV|EUV|X-ray|Ga', 'Optical', 'Infrared', 'X-ray|Gamma-ray']}
3939
CFHTMEGAPIPE : {'Description': 'The CFHTMEGAPIPE collection at the CADC', 'Bands': ['', 'Infrared|Optical', 'Infrared', 'Optical']}
40-
CFHTTERAPIX : {'Description': 'The CFHTTERAPIX collection at the CADC', 'Bands': ['Optical', 'Infrared']}
40+
CFHTTERAPIX : {'Description': 'The CFHTTERAPIX collection at the CADC', 'Bands': ['Infrared|Optical', 'Optical', 'Infrared']}
4141
CFHTWIRWOLF : {'Description': 'The CFHTWIRWOLF collection at the CADC', 'Bands': ['Infrared']}
42-
CGPS : {'Description': 'The CGPS collection at the CADC', 'Bands': ['Infrared', 'Radio', 'Millimeter', '']}
42+
CGPS : {'Description': 'The CGPS collection at the CADC', 'Bands': ['Infrared', 'Radio', 'Millimeter', '', 'Millimeter|Infrared']}
4343
CHANDRA : {'Description': 'The CHANDRA collection at the CADC', 'Bands': ['X-ray']}
44-
DAO : {'Description': 'The DAO collection at the CADC', 'Bands': ['UV|EUV|X-ray|Gamma-ray', '', 'EUV|X-ray|Gamma-ray', 'Infrared|Optical', 'Optical|UV|EUV|X-ray|Gamma-ray', 'Infrared', 'Optical', 'X-ray|Gamma-ray', 'Infrared|Optical|UV|EUV|X-ray|Ga']}
44+
DAO : {'Description': 'The DAO collection at the CADC', 'Bands': ['', 'Infrared|Optical', 'Infrared', 'Optical']}
45+
DAOCADC : {'Description': 'The DAOCADC collection at the CADC', 'Bands': ['Optical', '']}
4546
DAOPLATES : {'Description': 'The DAOPLATES collection at the CADC', 'Bands': ['Optical', '']}
4647
DRAO : {'Description': 'The DRAO collection at the CADC', 'Bands': ['Radio']}
47-
FUSE : {'Description': 'The FUSE collection at the CADC', 'Bands': ['UV', '']}
48-
GEMINI : {'Description': 'The GEMINI collection at the CADC', 'Bands': ['Gamma-ray', 'Infrared|Optical|UV|EUV|X-ray|Ga', 'Infrared', 'Optical', 'Infrared|Optical', '']}
48+
FUSE : {'Description': 'The FUSE collection at the CADC', 'Bands': ['UV|EUV', '']}
49+
GEMINI : {'Description': 'The GEMINI collection at the CADC', 'Bands': ['Infrared|Optical|UV|EUV|X-ray|Ga', 'Infrared', 'Optical', 'Infrared|Optical', 'Optical|UV', '']}
50+
GEMINICADC : {'Description': 'The GEMINICADC collection at the CADC', 'Bands': ['', 'Infrared|Optical', 'Infrared']}
4951
HST : {'Description': 'The HST collection at the CADC', 'Bands': ['', 'Infrared', 'Optical', 'UV']}
50-
HSTHLA : {'Description': 'The HSTHLA collection at the CADC', 'Bands': ['Optical', 'Infrared', 'UV']}
51-
IRIS : {'Description': 'The IRIS collection at the CADC', 'Bands': ['Infrared']}
52+
HSTHLA : {'Description': 'The HSTHLA collection at the CADC', 'Bands': ['Optical', 'Infrared', 'UV', 'Infrared|Optical', 'Infrared|Optical|UV', 'Optical|UV']}
53+
IRIS : {'Description': 'The IRIS collection at the CADC', 'Bands': ['Millimeter|Infrared', 'Infrared']}
5254
JCMT : {'Description': 'The JCMT collection at the CADC', 'Bands': ['', 'Millimeter']}
5355
JCMTLS : {'Description': 'The JCMTLS collection at the CADC', 'Bands': ['Millimeter', '']}
56+
JWST : {'Description': 'The JWST collection at the CADC', 'Bands': ['', 'Infrared']}
5457
MACHO : {'Description': 'The MACHO collection at the CADC', 'Bands': ['Optical']}
5558
MOST : {'Description': 'The MOST collection at the CADC', 'Bands': ['Optical']}
5659
NEOSSAT : {'Description': 'The NEOSSAT collection at the CADC', 'Bands': ['Optical']}
5760
NGVS : {'Description': 'The NGVS collection at the CADC', 'Bands': ['Infrared|Optical', '', 'Optical']}
5861
NOAO : {'Description': 'The NOAO collection at the CADC', 'Bands': ['Optical', 'Infrared']}
5962
OMM : {'Description': 'The OMM collection at the CADC', 'Bands': ['Optical', 'Infrared', '']}
63+
RACS : {'Description': 'The RACS collection at the CADC', 'Bands': ['Radio']}
6064
SDSS : {'Description': 'The SDSS collection at the CADC', 'Bands': ['Infrared', 'Optical']}
6165
SUBARU : {'Description': 'The SUBARU collection at the CADC', 'Bands': ['Optical']}
66+
SUBARUCADC : {'Description': 'The SUBARUCADC collection at the CADC', 'Bands': ['Optical', 'Infrared|Optical']}
6267
TESS : {'Description': 'The TESS collection at the CADC', 'Bands': ['Optical']}
63-
UKIRT : {'Description': 'The UKIRT collection at the CADC', 'Bands': ['', 'Optical', 'Infrared']}
68+
UKIRT : {'Description': 'The UKIRT collection at the CADC', 'Bands': ['Infrared|Optical', '', 'Optical', 'Infrared']}
6469
VGPS : {'Description': 'The VGPS collection at the CADC', 'Bands': ['Radio']}
65-
VLASS : {'Description': 'The VLASS collection at the CADC', 'Bands': ['Radio']}
70+
VLASS : {'Description': 'The VLASS collection at the CADC', 'Bands': ['', 'Radio']}
71+
WALLABY : {'Description': 'The WALLABY collection at the CADC', 'Bands': ['Radio']}
6672
XMM : {'Description': 'The XMM collection at the CADC', 'Bands': ['Optical', 'UV', 'X-ray']}
6773

6874

@@ -78,17 +84,21 @@ the URLs for downloading the corresponding data.
7884
>>> cadc = Cadc()
7985
>>> result = cadc.query_region('08h45m07.5s +54d18m00s', collection='CFHT')
8086
>>> print(result)
81-
observationURI sequenceNumber ... accMetaChecksum2
82-
...
83-
----------------- -------------- ... ------------------------------------
84-
caom:CFHT/2366432 2366432 ... md5:76a5e97c9d2f726f456c92b6d2303dd3
85-
caom:CFHT/2366432 2366432 ... md5:eff6ecab03761186d6ce699dff43ddc7
86-
caom:CFHT/2366188 2366188 ... md5:896250159a7e80eecdad34150201f361
87-
caom:CFHT/2376828 2376828 ... md5:1c9008a82af8e5b0ed377c8544ded497
88-
caom:CFHT/2376828 2376828 ... md5:297b56e1f2e80602e0cb0cc901505108
89-
caom:CFHT/2366188 2366188 ... md5:f0ec6252250a86963a102351c23d0ca7
90-
caom:CFHT/2480747 2480747 ... md5:a7cccd9710cbca222dc8f8b1eedff3b5
91-
caom:CFHT/2480747 2480747 ... md5:c24ace389b760c290a5bf31842fb4ea9
87+
observationURI sequenceNumber ... maxLastModified2
88+
...
89+
----------------- -------------- ... -----------------------
90+
caom:CFHT/2366432 2366432 ... 2020-09-14T04:24:28.932
91+
caom:CFHT/2366188 2366188 ... 2020-09-14T06:58:23.094
92+
caom:CFHT/2366432 2366432 ... 2020-09-14T04:24:28.932
93+
caom:CFHT/2480747 2480747 ... 2020-09-09T12:47:39.890
94+
caom:CFHT/2366188 2366188 ... 2020-09-14T06:58:23.094
95+
caom:CFHT/2480747 2480747 ... 2021-02-26T14:40:21.695
96+
caom:CFHT/2583703 2583703 ... 2021-02-18T01:32:51.542
97+
caom:CFHT/2583527 2583527 ... 2021-09-01T20:37:05.647
98+
caom:CFHT/2583527 2583527 ... 2021-09-01T20:37:05.647
99+
caom:CFHT/2583703 2583703 ... 2021-02-26T10:37:42.355
100+
caom:CFHT/2376828 2376828 ... 2021-09-01T23:48:18.790
101+
caom:CFHT/2376828 2376828 ... 2021-09-01T23:48:18.790
92102
>>> urls = cadc.get_data_urls(result)
93103
>>> for url in urls:
94104
... print(url) #doctest: +IGNORE_OUTPUT
@@ -115,7 +125,7 @@ auxiliary data (in this case preview files)
115125
>>> cadc = Cadc()
116126
>>> result = cadc.query_region('08h45m07.5s +54d18m00s')
117127
>>> print(len(result))
118-
3034
128+
3044
119129
>>> urls = cadc.get_data_urls(result[result['target_name'] == 'Nr3491_1'],
120130
... include_auxiliaries=True)
121131
>>> for url in urls:
@@ -145,28 +155,26 @@ the CADC metadata.
145155
103949
146156
>>> result = cadc.query_name('Nr3491_1')
147157
>>> print(result)
148-
observationURI sequenceNumber metaReadGroups ... accMetaChecksum2 lastModified2 maxLastModified2
149-
...
150-
----------------- -------------- -------------- ... ------------------------------------ ----------------------- -----------------------
151-
caom:CFHT/2376828 2376828 ... md5:a3e8ccba7bc69d14a07d261d8615cc47 2019-04-10T22:14:33.111 2019-11-06T08:56:14.246
152-
caom:CFHT/2376828 2376828 ... md5:7c84ae4b76485a28336f03b2b5af18b3 2019-03-04T08:19:23.766 2019-03-04T10:55:53.572
158+
observationURI sequenceNumber ... maxLastModified2
159+
...
160+
----------------- -------------- ... -----------------------
161+
caom:CFHT/2376828 2376828 ... 2021-09-01T23:48:18.790
162+
caom:CFHT/2376828 2376828 ... 2021-09-01T23:48:18.790
153163

154164

155165
If only a subsection of the FITS file is needed, CADC can query an
156166
area and resolve the cutout of a result.
157167

158168
.. code-block:: python
159-
.. doctest-remote-data::
169+
.. doctest-skip::
160170

161171
>>> from astropy import units as u
162172
>>> from astroquery.cadc import Cadc
163173
>>> cadc = Cadc()
164174
>>> coords = '01h45m07.5s +23d18m00s'
165175
>>> radius = 0.01*u.deg
166176
>>> images = cadc.get_images(coords, radius, collection='CFHT')
167-
>>> for image in images:
168-
... print(image) # doctest: +IGNORE_OUTPUT
169-
...
177+
>>> images
170178
[<astropy.io.fits.hdu.image.PrimaryHDU object at 0x7f3805a06ef0>]
171179
[<astropy.io.fits.hdu.image.PrimaryHDU object at 0x7f3805b23b38>]
172180

@@ -183,11 +191,8 @@ in memory, lazy access to the downloaded FITS file can be used.
183191
>>> cadc = Cadc()
184192
>>> coords = SkyCoord(10, 20, unit='deg')
185193
>>> radius = 0.01*u.deg
186-
>>> readable_objs = cadc.get_images_async(coords, radius,
187-
... collection='CFHT')
188-
>>> for obj in readable_objs:
189-
... print(obj) # doctest: +IGNORE_OUTPUT
190-
...
194+
>>> readable_objs = cadc.get_images_async(coords, radius, collection='CFHT')
195+
>>> readable_objs # doctest: +IGNORE_OUTPUT
191196
Downloaded object from URL https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync?ID=ad%3ACFHT%2F2234132o.fits.fz&RUNID=pot39nwwtaht03wc&POS=CIRCLE+26.2812589776878+23.299999818906816+0.01 with ID 140045451168112
192197
Downloaded object from URL https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync?ID=ad%3ACFHT%2F2368279p.fits.fz&RUNID=pot39nwwtaht03wc&POS=CIRCLE+26.2812589776878+23.299999818906816+0.01 with ID 140045451142576
193198
Downloaded object from URL https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2ops/sync?ID=ad%3ACFHT%2F2228383o.fits.fz&RUNID=pot39nwwtaht03wc&POS=CIRCLE+26.2812589776878+23.299999818906816+0.01 with ID 140045452176880
@@ -430,50 +435,36 @@ Query without saving results in a file:
430435
>>> cadc = Cadc()
431436
>>> results = cadc.exec_sync("SELECT top 100 observationID, intent FROM caom2.Observation")
432437
>>> print(results)
433-
observationID intent
434-
----------------------------------------------- -----------
435-
j8eh03boq science
436-
j8f635020 science
437-
jbfkb1peq science
438-
j8ff06s2q science
439-
icdx40oxq science
440-
j8fd13rgq science
441-
j8ff03020 science
442-
GN-2014B-SV-101-761-010 science
443-
j8ff07020 science
444-
jbfh14020 science
445-
... ...
446-
hst_10476_50_acs_wfc_f850lp_j9fo50ul science
447-
GS-CAL20181018-10-026-G-BIAS calibration
448-
GN-2020B-Q-120-40-050 calibration
449-
GS-CAL20181018-10-021-G-BIAS calibration
450-
GS-CAL20181018-10-036-G-BIAS calibration
451-
GS-CAL20181018-10-061-G-BIAS calibration
452-
icdx13u2q science
453-
GS-CAL20181117-2-046-G-BIAS calibration
454-
tess2019357164649-s0020-0000000159539617-0165-s science
455-
GS-CAL20181117-2-061-G-BIAS calibration
456-
GS-CAL20181018-10-086-G-BIAS calibration
457-
Length = 100 rows
438+
observationID intent
439+
---------------------------------- -----------
440+
VLASS2.2.T18t28.J204443+293000 science
441+
c4d_141029_044031_oki_g_v1 science
442+
VLASS2.2.T18t28.J203534+293000 science
443+
... ...
444+
C170323_0155 calibration
445+
C180513_0208 science
446+
2019101223440 science
447+
Length = 100 rows
458448

459449

460450
Query saving results in a file:
461451

462452
.. code-block:: python
463-
.. doctest-remote-data::
453+
.. doctest-skip::
464454

465455
>>> from astroquery.cadc import Cadc
466456
>>> cadc = Cadc()
467457
>>> job = cadc.exec_sync("SELECT TOP 10 observationID, obsID FROM caom2.Observation AS Observation",
468-
... output_file='test_output_noauth.tsv', output_format='tsv')
458+
... output_file='test_output_noauth.tsv')
459+
469460

470461
1.5 Synchronous query with temporary uploaded table
471462
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
472463

473464
A table can be uploaded to the server in order to be used in a query.
474465

475466
.. code-block:: python
476-
.. doctest-remote-data::
467+
.. doctest-skip::
477468

478469
>>> from astroquery.cadc import Cadc
479470
>>> cadc = Cadc()
@@ -506,10 +497,10 @@ Query without saving results in a file:
506497
>>> from astroquery.cadc import Cadc
507498
>>> cadc = Cadc()
508499
>>> job = cadc.create_async("SELECT TOP 100 observationID, instrument_name, target_name FROM caom2.Observation AS Observation")
509-
>>> job.run().wait()
500+
>>> job.run().wait() # doctest: +IGNORE_OUTPUT
510501
>>> job.raise_if_error()
511-
>>> print(job.fetch_result().to_table()) # doctest: +IGNORE_OUTPUT
512-
observationID intent
502+
>>> print(job.fetch_result().to_table()) # doctest: +IGNORE_OUTPUT
503+
observationID intent
513504
----------------------------------------------- -----------
514505
j8eh03boq science
515506
j8f635020 science
@@ -549,7 +540,7 @@ the job.
549540
>>> from astroquery.cadc import Cadc
550541
>>> cadc = Cadc()
551542
>>> job = cadc.create_async("SELECT TOP 100 observationID, instrument_name, target_name FROM caom2.Observation AS Observation")
552-
>>> job.run().wait()
543+
>>> job.run().wait() # doctest: +IGNORE_OUTPUT
553544
>>> job.raise_if_error()
554545
>>> loaded_job = cadc.load_async_job(jobid=job.job_id)
555546
>>> print(loaded_job.fetch_result().to_table()) # doctest: +IGNORE_OUTPUT

0 commit comments

Comments
 (0)