13
13
from astroquery .exceptions import InvalidQueryError , EmptyResponseError
14
14
15
15
import re
16
+ import string
16
17
17
18
__all__ = ['CDMS' , 'CDMSClass' ]
18
19
@@ -53,7 +54,7 @@ def query_lines_async(self, min_frequency, max_frequency, *,
53
54
Identifiers of the molecules to search for. If this parameter
54
55
is not provided the search will match any species. Default is 'All'.
55
56
Note that if the molecule name contains parentheses, they must be
56
- escaped. For exmaple, 'H2C(CN)2' must be specified as 'H2C\(CN\)2'.
57
+ escaped. For exmaple, 'H2C(CN)2' must be specified as 'H2C\\ (CN\ \ )2'.
57
58
58
59
temperature_for_intensity : float
59
60
The temperature to use when computing the intensity Smu^2. Set
@@ -198,12 +199,14 @@ def _parse_result(self, response, verbose=False):
198
199
199
200
ELO: Lower state energy in cm^{-1} relative to the ground state.
200
201
GUP: Upper state degeneracy.
201
- TAG: Species tag or molecular identifier.
202
- A negative value flags that the line frequency has
203
- been measured in the laboratory. The absolute value of TAG is then the
204
- species tag and ERR is the reported experimental error. The three most
205
- significant digits of the species tag are coded as the mass number of
206
- the species.
202
+ MOLWT: The first half of the molecular weight tag, which is the mass in atomic
203
+ mass units (Daltons).
204
+ TAG: Species tag or molecular identifier. This only includes the
205
+ last 3 digits of the CDMS tag
206
+
207
+ A negative value of MOLWT flags that the line frequency has been
208
+ measured in the laboratory. We record this boolean in the 'Lab'
209
+ column. ERR is the reported experimental error.
207
210
208
211
QNFMT: Identifies the format of the quantum numbers
209
212
Ju/Ku/vu and Jl/Kl/vl are the upper/lower QNs
@@ -226,15 +229,21 @@ def _parse_result(self, response, verbose=False):
226
229
'DR' : 36 ,
227
230
'ELO' : 38 ,
228
231
'GUP' : 48 ,
229
- 'TAG' : 51 ,
232
+ 'MOLWT' : 51 ,
233
+ 'TAG' : 54 ,
230
234
'QNFMT' : 58 ,
231
235
'Ju' : 61 ,
232
236
'Ku' : 63 ,
233
237
'vu' : 65 ,
234
- 'Jl' : 67 ,
235
- 'Kl' : 69 ,
236
- 'vl' : 71 ,
237
- 'F' : 73 ,
238
+ 'F1u' : 67 ,
239
+ 'F2u' : 69 ,
240
+ 'F3u' : 71 ,
241
+ 'Jl' : 73 ,
242
+ 'Kl' : 75 ,
243
+ 'vl' : 77 ,
244
+ 'F1l' : 79 ,
245
+ 'F2l' : 81 ,
246
+ 'F3l' : 83 ,
238
247
'name' : 89 }
239
248
240
249
result = ascii .read (text , header_start = None , data_start = 0 ,
@@ -243,9 +252,23 @@ def _parse_result(self, response, verbose=False):
243
252
col_starts = list (starts .values ()),
244
253
format = 'fixed_width' , fast_reader = False )
245
254
255
+
246
256
result ['FREQ' ].unit = u .MHz
247
257
result ['ERR' ].unit = u .MHz
248
258
259
+ result ['Lab' ] = result ['MOLWT' ] < 0
260
+ result ['MOLWT' ] = np .abs (result ['MOLWT' ])
261
+ result ['MOLWT' ].unit = u .Da
262
+
263
+ for suf in 'ul' :
264
+ for qn in ('J' , 'v' , 'K' , 'F1' , 'F2' , 'F3' ):
265
+ qnind = qn + suf
266
+ if result [qnind ].dtype != int :
267
+ intcol = np .array (list (map (parse_letternumber , result [qnind ])),
268
+ dtype = int )
269
+ result [qnind ] = intcol
270
+
271
+
249
272
# if there is a crash at this step, something went wrong with the query
250
273
# and the _last_query_temperature was not set. This shouldn't ever
251
274
# happen, but, well, I anticipate it will.
@@ -314,6 +337,24 @@ def tryfloat(x):
314
337
CDMS = CDMSClass ()
315
338
316
339
340
+ def parse_letternumber (st ):
341
+ """
342
+ Parse CDMS's two-letter QNs
343
+
344
+ Very Important:
345
+ Exactly two characters are available for each quantum number. Therefore, half
346
+ integer quanta are rounded up ! In addition, capital letters are used to
347
+ indicate quantum numbers larger than 99. E. g. A0 is 100, Z9 is 359. Small
348
+ types are used to signal corresponding negative quantum numbers.
349
+ """
350
+ asc = string .ascii_lowercase
351
+ ASC = string .ascii_uppercase
352
+ newst = '' .join (['-' + str (asc .index (x )+ 10 ) if x in asc else
353
+ str (ASC .index (x )+ 10 ) if x in ASC else
354
+ x for x in st ])
355
+ return int (newst )
356
+
357
+
317
358
class Lookuptable (dict ):
318
359
319
360
def find (self , st , flags ):
0 commit comments