Skip to content

Commit 6bd18b4

Browse files
tinuademargaretbsipocz
authored andcommitted
spec.jp.nasa server down
1 parent 3ce7972 commit 6bd18b4

File tree

1 file changed

+76
-79
lines changed

1 file changed

+76
-79
lines changed

docs/jplspec/jplspec.rst

Lines changed: 76 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. doctest-skip-all
2-
31
.. _astroquery.jplspec:
42

53
*********************************************
@@ -27,15 +25,16 @@ following examples we have explicitly set it to False and True to show the
2725
what each setting yields:
2826

2927
.. code-block:: python
28+
.. doctest-remote-data::
3029

3130
>>> from astroquery.jplspec import JPLSpec
3231
>>> import astropy.units as u
3332
>>> 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)
3938
>>> print(response)
4039
FREQ ERR LGINT DR ELO GUP TAG QNFMT QN' QN"
4140
MHz MHz MHz nm2 1 / cm
@@ -51,13 +50,14 @@ what each setting yields:
5150
The following example, with ``get_query_payload = True``, returns the payload:
5251

5352
.. code-block:: python
53+
.. doctest-remote-data::
5454

5555
>>> 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)
6161
>>> print(response)
6262
{'MinNu': 100.0, 'MaxNu': 1000.0, 'Mol': '28001 CO', 'UnitNu': 'GHz',
6363
'StrLim': -500, 'MaxLines': 7}
@@ -66,13 +66,14 @@ The units of the columns of the query can be displayed by calling
6666
``response.info``:
6767

6868
.. code-block:: python
69+
.. doctest-remote-data::
6970

7071
>>> 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)
7677
>>> print(response.info)
7778
<Table length=7>
7879
name dtype unit
@@ -92,14 +93,15 @@ These come in handy for converting to other units easily, an example using a
9293
simplified version of the data above is shown below:
9394

9495
.. code-block:: python
96+
.. doctest-remote-data::
9597

9698
>>> print (response)
9799
FREQ ERR ELO
98100
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
103105
>>> response['FREQ'].quantity
104106
<Quantity [115271.2018,345795.9899,461040.7682] MHz>
105107
>>> response['FREQ'].to('GHz')
@@ -118,6 +120,7 @@ temperatures. Keep in mind that a negative TAG value signifies that
118120
the line frequency has been measured in the laboratory
119121

120122
.. code-block:: python
123+
.. doctest-remote-data::
121124

122125
>>> import matplotlib.pyplot as plt
123126
>>> from astroquery.jplspec import JPLSpec
@@ -133,6 +136,7 @@ You can also access the temperature of the partition function
133136
through metadata:
134137

135138
.. code-block:: python
139+
.. doctest-remote-data::
136140

137141
>>> result['QLOG2'].meta
138142
{'Temperature (K)' : 225}
@@ -147,6 +151,7 @@ partition function against the temperatures found in the metadata is shown
147151
below:
148152

149153
.. code-block:: python
154+
.. doctest-remote-data::
150155

151156
>>> temp = result.meta['Temperature (K)']
152157
>>> 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
171176
other temperatures using curve fitting models:
172177

173178
.. code-block:: python
179+
.. doctest-remote-data::
174180

175181
>>> from scipy.optimize import curve_fit
176182
>>> def f(T,a):
@@ -209,32 +215,28 @@ that you do not set the local parse parameter since the module will be able
209215
to query these directly.
210216

211217
.. code-block:: python
218+
.. doctest-remote-data::
212219

213220
>>> from astroquery.jplspec import JPLSpec
214221
>>> import astropy.units as u
215222
>>> 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}
238240

239241
As you can see, the 'H2O' string was processed as a regular expression,
240242
and the search matched any molecule that contained the combination of
@@ -243,64 +245,59 @@ characters 'H20'.
243245
A few examples that show the power of the regex option are the following:
244246

245247
.. code-block:: python
248+
.. doctest-remote-data::
246249

247250
>>> 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}
258257

259258

260259
As seen above, the regular expression "H2O$" yields only an exact match because
261260
the special character $ matches the end of the line. This functionality allows
262261
you to be as specific or vague as you want to allow the results to be:
263262

264263
.. code-block:: python
264+
.. doctest-remote-data::
265265

266266
>>> from astroquery.jplspec import JPLSpec
267267
>>> import astropy.units as u
268268
>>> 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 }
282280

283281
Another example of the functionality of this option is the option to obtain
284282
results from a molecule and its isotopes, in this case H2O and HDO:
285283

286284
.. code-block:: python
285+
.. doctest-remote-data::
287286

288287
>>> from astroquery.jplspec import JPLSpec
289288
>>> import astropy.units as u
290289
>>> 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}
304301

305302
Remember to print your response to see the table of your results.
306303

0 commit comments

Comments
 (0)