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