1
- .. doctest-skip-all
2
-
3
1
.. _astroquery.jplspec :
4
2
5
3
*********************************************
@@ -27,15 +25,16 @@ following examples we have explicitly set it to False and True to show the
27
25
what each setting yields:
28
26
29
27
.. code-block :: python
28
+ .. doctest-remote-data ::
30
29
31
30
>>> from astroquery.jplspec import JPLSpec
32
31
>>> import astropy.units as u
33
32
>>> response = JPLSpec.query_lines(min_frequency = 100 * u.GHz,
34
- max_frequency = 1000 * u.GHz,
35
- min_strength = - 500 ,
36
- molecule = " 28001 CO" ,
37
- max_lines = 7 ,
38
- get_query_payload = False )
33
+ ... max_frequency= 1000 * u.GHz,
34
+ ... min_strength= - 500 ,
35
+ ... molecule= " 28001 CO" ,
36
+ ... max_lines = 7 ,
37
+ ... get_query_payload= False )
39
38
>>> print (response)
40
39
FREQ ERR LGINT DR ELO GUP TAG QNFMT QN' QN"
41
40
MHz MHz MHz nm2 1 / cm
@@ -51,13 +50,14 @@ what each setting yields:
51
50
The following example, with ``get_query_payload = True ``, returns the payload:
52
51
53
52
.. code-block :: python
53
+ .. doctest-remote-data ::
54
54
55
55
>>> response = JPLSpec.query_lines(min_frequency = 100 * u.GHz,
56
- max_frequency = 1000 * u.GHz,
57
- min_strength = - 500 ,
58
- molecule = " 28001 CO" ,
59
- max_lines = 7 ,
60
- get_query_payload = True )
56
+ ... max_frequency= 1000 * u.GHz,
57
+ ... min_strength= - 500 ,
58
+ ... molecule= " 28001 CO" ,
59
+ ... max_lines = 7 ,
60
+ ... get_query_payload= True )
61
61
>>> print (response)
62
62
{'MinNu': 100.0, 'MaxNu': 1000.0, 'Mol': '28001 CO', 'UnitNu': 'GHz',
63
63
'StrLim': -500, 'MaxLines': 7}
@@ -66,13 +66,14 @@ The units of the columns of the query can be displayed by calling
66
66
``response.info ``:
67
67
68
68
.. code-block :: python
69
+ .. doctest-remote-data ::
69
70
70
71
>>> response = JPLSpec.query_lines(min_frequency = 100 * u.GHz,
71
- max_frequency = 1000 * u.GHz,
72
- min_strength = - 500 ,
73
- molecule = " 28001 CO" ,
74
- max_lines = 7 ,
75
- get_query_payload = True )
72
+ ... max_frequency= 1000 * u.GHz,
73
+ ... min_strength= - 500 ,
74
+ ... molecule= " 28001 CO" ,
75
+ ... max_lines = 7 ,
76
+ ... get_query_payload= True )
76
77
>>> print (response.info)
77
78
<Table length=7>
78
79
name dtype unit
@@ -92,14 +93,15 @@ These come in handy for converting to other units easily, an example using a
92
93
simplified version of the data above is shown below:
93
94
94
95
.. code-block :: python
96
+ .. doctest-remote-data ::
95
97
96
98
>>> print (response)
97
99
FREQ ERR ELO
98
100
MHz MHz 1 / cm
99
- ---------- - ------ - ------ -
100
- 115271.2018 0.0005 0.0
101
- 345795.9899 0.0005 11.535
102
- 461040.7682 0.0005 23.0695
101
+ ----------- ------- -------
102
+ 115271.2018 0.0005 0.0
103
+ 345795.9899 0.0005 11.535
104
+ 461040.7682 0.0005 23.0695
103
105
>>> response[' FREQ' ].quantity
104
106
<Quantity [115271.2018,345795.9899,461040.7682] MHz>
105
107
>>> response[' FREQ' ].to(' GHz' )
@@ -118,6 +120,7 @@ temperatures. Keep in mind that a negative TAG value signifies that
118
120
the line frequency has been measured in the laboratory
119
121
120
122
.. code-block :: python
123
+ .. doctest-remote-data ::
121
124
122
125
>>> import matplotlib.pyplot as plt
123
126
>>> from astroquery.jplspec import JPLSpec
@@ -133,6 +136,7 @@ You can also access the temperature of the partition function
133
136
through metadata:
134
137
135
138
.. code-block :: python
139
+ .. doctest-remote-data ::
136
140
137
141
>>> result[' QLOG2' ].meta
138
142
{'Temperature (K)' : 225}
@@ -147,6 +151,7 @@ partition function against the temperatures found in the metadata is shown
147
151
below:
148
152
149
153
.. code-block :: python
154
+ .. doctest-remote-data ::
150
155
151
156
>>> temp = result.meta[' Temperature (K)' ]
152
157
>>> part = list (mol[' QLOG1' ,' QLOG2' ,' QLOG3' , ' QLOG4' , ' QLOG5' ,' QLOG6' ,
@@ -171,6 +176,7 @@ for the CO molecule) we can continue to determine the partition function at
171
176
other temperatures using curve fitting models:
172
177
173
178
.. code-block :: python
179
+ .. doctest-remote-data ::
174
180
175
181
>>> from scipy.optimize import curve_fit
176
182
>>> def f (T ,a ):
@@ -209,32 +215,28 @@ that you do not set the local parse parameter since the module will be able
209
215
to query these directly.
210
216
211
217
.. code-block :: python
218
+ .. doctest-remote-data ::
212
219
213
220
>>> from astroquery.jplspec import JPLSpec
214
221
>>> import astropy.units as u
215
222
>>> response = JPLSpec.query_lines_async(min_frequency = 100 * u.GHz,
216
- max_frequency = 1000 * u.GHz,
217
- min_strength = - 500 ,
218
- molecule = " H2O" ,
219
- parse_name_locally = True )
220
-
221
-
222
- Searches like these can lead to very broad queries. Since the table yields
223
- extensive results, we will only show a dictionary of the tags that
224
- went into the payload to create a response:
225
-
226
- .. code-block :: python
227
-
228
- >> > {' CH2OO' : 46014 ,
229
- ' H2O' : 18003 ,
230
- ' H2O v2,2v2,v' : 18005 ,
231
- ' H2O-17' : 19003 ,
232
- ' H2O-18' : 20003 ,
233
- ' H2O2' : 34004 ,
234
- ' HCCCH2OD' : 57003 ,
235
- ' HCCCH2OH' : 56010 ,
236
- ' HCOCH2OH' : 60006 ,
237
- ' NH2CH2CH2OH' : 61004 }
223
+ ... max_frequency= 1000 * u.GHz,
224
+ ... min_strength= - 500 ,
225
+ ... molecule= " H2O" ,
226
+ ... parse_name_locally= True )
227
+ >>> # Searches like these can lead to very broad queries. Since the table yields
228
+ >>> # extensive results, we will only show a dictionary of the tags that
229
+ >>> # went into the payload to create a response:
230
+ {'CH2OO': 46014,
231
+ 'H2O': 18003,
232
+ 'H2O v2,2v2,v': 18005,
233
+ 'H2O-17': 19003,
234
+ 'H2O-18': 20003,
235
+ 'H2O2': 34004,
236
+ 'HCCCH2OD': 57003,
237
+ 'HCCCH2OH': 56010,
238
+ 'HCOCH2OH': 60006,
239
+ 'NH2CH2CH2OH': 61004}
238
240
239
241
As you can see, the 'H2O' string was processed as a regular expression,
240
242
and the search matched any molecule that contained the combination of
@@ -243,64 +245,59 @@ characters 'H20'.
243
245
A few examples that show the power of the regex option are the following:
244
246
245
247
.. code-block :: python
248
+ .. doctest-remote-data ::
246
249
247
250
>>> response = JPLSpec.query_lines_async(min_frequency = 100 * u.GHz,
248
- max_frequency = 1000 * u.GHz,
249
- min_strength = - 500 ,
250
- molecule = " H2O$" ,
251
- parse_name_locally = True )
252
-
253
- The response:
254
-
255
- .. code-block :: python
256
-
257
- >> > {' H2O' : 18003 }
251
+ ... max_frequency= 1000 * u.GHz,
252
+ ... min_strength= - 500 ,
253
+ ... molecule= " H2O$" ,
254
+ ... parse_name_locally= True )
255
+ >>> # The response:
256
+ {'H2O': 18003}
258
257
259
258
260
259
As seen above, the regular expression "H2O$" yields only an exact match because
261
260
the special character $ matches the end of the line. This functionality allows
262
261
you to be as specific or vague as you want to allow the results to be:
263
262
264
263
.. code-block :: python
264
+ .. doctest-remote-data ::
265
265
266
266
>>> from astroquery.jplspec import JPLSpec
267
267
>>> import astropy.units as u
268
268
>>> response = JPLSpec.query_lines_async(min_frequency = 100 * u.GHz,
269
- max_frequency = 1000 * u.GHz,
270
- min_strength = - 500 ,
271
- molecule = " ^H.O$" ,
272
- parse_name_locally = True )
273
-
274
- This pattern matches any word that starts with an H, ends with an O, and
275
- contains any character in between, it results in the following molecules
276
- being queried:
277
-
278
- >>> {' H2O' : 18003 ,
279
- 'HDO': 19002
280
- 'HCO': 29004
281
- 'HNO': 31005 }
269
+ ... max_frequency= 1000 * u.GHz,
270
+ ... min_strength= - 500 ,
271
+ ... molecule= " ^H.O$" ,
272
+ ... parse_name_locally= True )
273
+ >>> # This pattern matches any word that starts with an H, ends with an O, and
274
+ >>> # contains any character in between, it results in the following molecules
275
+ >>> # being queried:
276
+ {'H2O': 18003,
277
+ 'HDO': 19002
278
+ 'HCO': 29004
279
+ 'HNO': 31005 }
282
280
283
281
Another example of the functionality of this option is the option to obtain
284
282
results from a molecule and its isotopes, in this case H2O and HDO:
285
283
286
284
.. code-block :: python
285
+ .. doctest-remote-data ::
287
286
288
287
>>> from astroquery.jplspec import JPLSpec
289
288
>>> import astropy.units as u
290
289
>>> response = JPLSpec.query_lines_async(min_frequency = 100 * u.GHz,
291
- max_frequency = 1000 * u.GHz,
292
- min_strength = - 500 ,
293
- molecule = " ^H[2D]O(-\d\d|)$" ,
294
- parse_name_locally = True )
295
-
296
- This pattern matches any H2O and HDO isotopes and it results in the following
297
- molecules being part of the payload:
298
-
299
- >>> {' H2O' : 18003 ,
300
- 'H2O-17': 19003,
301
- 'H2O-18': 20003,
302
- 'HDO': 19002,
303
- 'HDO-18': 21001}
290
+ ... max_frequency= 1000 * u.GHz,
291
+ ... min_strength= - 500 ,
292
+ ... molecule= " ^H[2D]O(-\d\d|)$" ,
293
+ ... parse_name_locally= True )
294
+ >>> # This pattern matches any H2O and HDO isotopes and it results in the following
295
+ >>> # molecules being part of the payload:
296
+ {'H2O': 18003,
297
+ 'H2O-17': 19003,
298
+ 'H2O-18': 20003,
299
+ 'HDO': 19002,
300
+ 'HDO-18': 21001}
304
301
305
302
Remember to print your response to see the table of your results.
306
303
0 commit comments