1
- .. doctest-skip-all
2
-
3
1
.. _astroquery.oac :
4
2
5
3
**********************************
@@ -16,37 +14,38 @@ at the `OAC API Github Repository <https://github.com/astrocatalogs/OACAPI>`_
16
14
17
15
Primary Methods
18
16
===============
17
+
19
18
There are two primary methods for submitting API queries. The first is query_object
20
19
which can be used to search the OAC based on an event name. Multiple events can
21
20
be retrieved by submitting a list of event names.
22
21
23
22
The default behavior returns a top-level list of all available metadata for the
24
23
queried event(s).
25
24
26
- .. code-block :: python
25
+ .. doctest-remote-data ::
27
26
28
27
>>> from astroquery.oac import OAC
29
28
>>> metadata = OAC .query_object(" GW170817" )
30
29
31
30
The query can be further refined by using the available QUANTITY and ATTRIBUTE
32
31
options. For example, to retrieve the light curve for an object:
33
32
34
- .. code-block :: python
33
+ .. doctest-remote-data ::
35
34
36
35
>>> photometry = OAC .query_object(" GW170817" , quantity = " photometry" ,
37
- attribute = [" time" , " magnitude" ,
38
- " e_magnitude" , " band" ,
39
- " instrument" ])
36
+ ... attribute= [" time" , " magnitude" ,
37
+ ... " e_magnitude" , " band" ,
38
+ ... " instrument" ])
40
39
41
40
The results of a query can be further refined by using the ARGUMENT option
42
41
43
- .. code-block :: python
42
+ .. doctest-remote-data ::
44
43
45
44
>>> photometry = OAC .query_object(" GW170817" , quantity = " photometry" ,
46
- attribute = [" time" , " magnitude" ,
47
- " e_magnitude" , " band" ,
48
- " instrument" ],
49
- argument = [" band=i" ])
45
+ ... attribute= [" time" , " magnitude" ,
46
+ ... " e_magnitude" , " band" ,
47
+ ... " instrument" ],
48
+ ... argument= [" band=i" ])
50
49
51
50
The second method available is query_region which performs a cone or box
52
51
search for a given set of coordinates. Coordinates can be submitted as an Astropy
@@ -56,7 +55,7 @@ a single set of coordinates.
56
55
57
56
For this example, we first establish coordinates and search parameters:
58
57
59
- .. code-block :: python
58
+ .. doctest-remote-data ::
60
59
61
60
>>> import astropy.coordinates as coord
62
61
>>> import astropy.units as u
@@ -71,25 +70,22 @@ For this example, we first establish coordinates and search parameters:
71
70
72
71
An example cone search:
73
72
74
- .. code-block :: python
73
+ .. doctest-remote-data ::
75
74
76
- >> > photometry = OAC .query_region(coordinates = test_coords,
77
- radius = test_radius,
78
- quantity = " photometry" ,
79
- attribute = [" time" , " magnitude" ,
80
- " e_magnitude" , " band" ,
81
- " instrument" ])
75
+ >>> photometry = OAC .query_region(coordinates = test_coords, radius = test_radius,
76
+ ... quantity= " photometry" ,
77
+ ... attribute= [" time" , " magnitude" ,
78
+ ... " e_magnitude" , " band" , " instrument" ])
82
79
83
80
An example box search:
84
81
85
- .. code-block :: python
82
+ .. doctest-remote-data ::
86
83
87
84
>>> photometry = OAC .query_region(coordinates = test_coords,
88
- width = test_width, height = test_height,
89
- quantity = " photometry" ,
90
- attribute = [" time" , " magnitude" ,
91
- " e_magnitude" , " band" ,
92
- " instrument" ])
85
+ ... width= test_width, height= test_height,
86
+ ... quantity= " photometry" ,
87
+ ... attribute= [" time" , " magnitude" ,
88
+ ... " e_magnitude" , " band" , " instrument" ])
93
89
94
90
As with the query_object method, searches using query_region can be refined
95
91
using the QUANTITY, ATTRIBUTE, and ARGUMENT options. The complete list of
@@ -101,13 +97,14 @@ data_format option.
101
97
102
98
Tailored Methods
103
99
================
100
+
104
101
There are three tailed search methods available to users to facilitate quick
105
102
retrieval of common data products.
106
103
107
104
The method get_photometry is designed to quickly return the photometry for a
108
105
given event or list of events.
109
106
110
- .. code-block :: python
107
+ .. doctest-remote-data ::
111
108
112
109
>>> from astroquery.oac import OAC
113
110
>>> photometry = OAC .get_photometry(" SN2014J" )
@@ -117,7 +114,7 @@ query_object. More complex queries should use the base query_object method.
117
114
118
115
For example, to retrieve only R-band photometry:
119
116
120
- .. code-block :: python
117
+ .. doctest-remote-data ::
121
118
122
119
>>> photometry = OAC .get_photometry(" SN2014J" , argument = " band=R" )
123
120
@@ -127,7 +124,7 @@ The method get_single_spectrum is designed to retrieve a single spectrum for a
127
124
single object at a specified time. The time should be given in MJD, but does
128
125
not have to be exact. The query will return the spectrum that is closest in time.
129
126
130
- .. code-block :: python
127
+ .. doctest-remote-data ::
131
128
132
129
>>> from astroquery.oac import OAC
133
130
>>> test_time = 57740
@@ -138,7 +135,7 @@ The output is an Astropy table.
138
135
The method get_spectra is designed to return all available spectra for an event
139
136
or list of events.
140
137
141
- .. code-block :: python
138
+ .. doctest-remote-data ::
142
139
143
140
>>> from astroquery.oac import OAC
144
141
>>> spectra = OAC .get_spectra(" SN2014J" )
0 commit comments