Skip to content

Commit ec0d4b6

Browse files
committed
add test data to setup
fix mistake remote tests pass now fix docs code style fixes (whitespace) rst whitespace text (I don't think my code highlighter works right for rst files...) restore an unintentionally-deleted line (but this probably won't fix the failure b/c this "response" is still not defined... we need this example to use the previous as context...)
1 parent 2c08127 commit ec0d4b6

File tree

5 files changed

+37
-31
lines changed

5 files changed

+37
-31
lines changed

astroquery/linelists/cdms/core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ def _parse_result(self, response, verbose=False):
252252
col_starts=list(starts.values()),
253253
format='fixed_width', fast_reader=False)
254254

255-
256255
result['FREQ'].unit = u.MHz
257256
result['ERR'].unit = u.MHz
258257

@@ -268,7 +267,6 @@ def _parse_result(self, response, verbose=False):
268267
dtype=int)
269268
result[qnind] = intcol
270269

271-
272270
# if there is a crash at this step, something went wrong with the query
273271
# and the _last_query_temperature was not set. This shouldn't ever
274272
# happen, but, well, I anticipate it will.

astroquery/linelists/cdms/setup_package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
def get_package_data():
88

9-
paths_test = [os.path.join('data', 'CO.data')]
9+
paths_test = [os.path.join('data', 'CO.data'),
10+
os.path.join('data', 'HC7S.data')]
1011
paths_data = [os.path.join('data', 'catdir.cat')]
1112

1213
return {'astroquery.linelists.cdms.tests': paths_test,

astroquery/linelists/cdms/tests/test_cdms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
'Ju', 'Jl', "vu", "F1u", "F2u", "F3u", "vl", "Ku", "Kl",
1111
"F1l", "F2l", "F3l", "name", "MOLWT", "Lab"])
1212

13+
1314
def data_path(filename):
1415

1516
data_dir = os.path.join(os.path.dirname(__file__), 'data')

astroquery/linelists/cdms/tests/test_cdms_remote.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from astropy.table import Table
55

66
from astroquery.linelists.cdms import CDMS
7+
from .test_cdms import colname_set
78

89

910
@pytest.mark.remote_data
@@ -15,8 +16,8 @@ def test_remote():
1516
molecule="018505 H2O+")
1617
assert isinstance(tbl, Table)
1718
assert len(tbl) == 116
18-
assert set(tbl.keys()) == set(['FREQ', 'ERR', 'LGAIJ', 'DR', 'ELO', 'GUP',
19-
'TAG', 'QNFMT', 'Ju', 'Jl', "vu", "vl", "Ku", "Kl", "F", "name"])
19+
# when 'temperature_for_intensity = 0', we use LGAIJ instead of LGINT
20+
assert set(tbl.keys()) == (colname_set | {'LGAIJ'}) - {'LGINT'}
2021

2122
assert tbl['FREQ'][0] == 505366.7875
2223
assert tbl['ERR'][0] == 49.13
@@ -32,8 +33,7 @@ def test_remote_300K():
3233
molecule="018505 H2O+")
3334
assert isinstance(tbl, Table)
3435
assert len(tbl) == 116
35-
assert set(tbl.keys()) == set(['FREQ', 'ERR', 'LGINT', 'DR', 'ELO', 'GUP',
36-
'TAG', 'QNFMT', 'Ju', 'Jl', "vu", "vl", "Ku", "Kl", "F", "name"])
36+
assert set(tbl.keys()) == colname_set
3737

3838
assert tbl['FREQ'][0] == 505366.7875
3939
assert tbl['ERR'][0] == 49.13
@@ -50,8 +50,7 @@ def test_remote_regex():
5050

5151
assert isinstance(tbl, Table)
5252
assert len(tbl) == 557
53-
assert set(tbl.keys()) == set(['FREQ', 'ERR', 'LGINT', 'DR', 'ELO', 'GUP',
54-
'TAG', 'QNFMT', 'Ju', 'Jl', "vu", "vl", "Ku", "Kl", "F", "name"])
53+
assert set(tbl.keys()) == colname_set
5554

5655
assert set(tbl['name']) == {'H2CN', 'HC-13-N, v=0'}
5756

docs/linelists/cdms/cdms.rst

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ each setting yields:
3333
... min_strength=-500,
3434
... molecule="028503 CO",
3535
... get_query_payload=False)
36-
>>> response.pprint(max_width=100)
37-
FREQ ERR LGINT DR ELO GUP TAG QNFMT Ju Ku vu Jl Kl vl F name
38-
MHz MHz MHz nm2 1 / cm
39-
----------- ------ ------- --- -------- --- ------ ----- --- --- --- --- --- --- --- -------
40-
115271.2018 0.0005 -5.0105 2 0.0 3 -28503 101 1 -- -- -- -- -- 0 CO, v=0
41-
230538.0 0.0005 -4.1197 2 3.845 5 -28503 101 2 -- -- -- -- -- 1 CO, v=0
42-
345795.9899 0.0005 -3.6118 2 11.535 7 -28503 101 3 -- -- -- -- -- 2 CO, v=0
43-
461040.7682 0.0005 -3.2657 2 23.0695 9 -28503 101 4 -- -- -- -- -- 3 CO, v=0
44-
576267.9305 0.0005 -3.0118 2 38.4481 11 -28503 101 5 -- -- -- -- -- 4 CO, v=0
45-
691473.0763 0.0005 -2.8193 2 57.6704 13 -28503 101 6 -- -- -- -- -- 5 CO, v=0
46-
806651.806 0.005 -2.6716 2 80.7354 15 -28503 101 7 -- -- -- -- -- 6 CO, v=0
47-
921799.7 0.005 -2.559 2 107.6424 17 -28503 101 8 -- -- -- -- -- 7 CO, v=0
36+
>>> response.pprint(max_width=120)
37+
FREQ ERR LGINT DR ELO GUP MOLWT TAG QNFMT Ju Ku vu F1u F2u F3u Jl Kl vl F1l F2l F3l name Lab
38+
MHz MHz MHz nm2 1 / cm u
39+
----------- ------ ------- --- -------- --- ----- --- ----- --- --- --- --- --- --- --- --- --- --- --- --- ------- ----
40+
115271.2018 0.0005 -5.0105 2 0.0 3 28 503 101 1 -- -- -- -- -- 0 -- -- -- -- -- CO, v=0 True
41+
230538.0 0.0005 -4.1197 2 3.845 5 28 503 101 2 -- -- -- -- -- 1 -- -- -- -- -- CO, v=0 True
42+
345795.9899 0.0005 -3.6118 2 11.535 7 28 503 101 3 -- -- -- -- -- 2 -- -- -- -- -- CO, v=0 True
43+
461040.7682 0.0005 -3.2657 2 23.0695 9 28 503 101 4 -- -- -- -- -- 3 -- -- -- -- -- CO, v=0 True
44+
576267.9305 0.0005 -3.0118 2 38.4481 11 28 503 101 5 -- -- -- -- -- 4 -- -- -- -- -- CO, v=0 True
45+
691473.0763 0.0005 -2.8193 2 57.6704 13 28 503 101 6 -- -- -- -- -- 5 -- -- -- -- -- CO, v=0 True
46+
806651.806 0.005 -2.6716 2 80.7354 15 28 503 101 7 -- -- -- -- -- 6 -- -- -- -- -- CO, v=0 True
47+
921799.7 0.005 -2.559 2 107.6424 17 28 503 101 8 -- -- -- -- -- 7 -- -- -- -- -- CO, v=0 True
4848

4949

5050

@@ -80,16 +80,23 @@ The units of the columns of the query can be displayed by calling
8080
DR int64 Column 0
8181
ELO float64 1 / cm Column 0
8282
GUP int64 Column 0
83+
MOLWT int64 u Column 0
8384
TAG int64 Column 0
8485
QNFMT int64 Column 0
8586
Ju int64 Column 0
8687
Ku int64 MaskedColumn 8
8788
vu int64 MaskedColumn 8
88-
Jl int64 MaskedColumn 8
89+
F1u int64 MaskedColumn 8
90+
F2u int64 MaskedColumn 8
91+
F3u int64 MaskedColumn 8
92+
Jl int64 Column 0
8993
Kl int64 MaskedColumn 8
9094
vl int64 MaskedColumn 8
91-
F int64 Column 0
95+
F1l int64 MaskedColumn 8
96+
F2l int64 MaskedColumn 8
97+
F3l int64 MaskedColumn 8
9298
name str7 Column 0
99+
Lab bool Column 0
93100

94101
These come in handy for converting to other units easily, an example using a
95102
simplified version of the data above is shown below:
@@ -100,14 +107,14 @@ simplified version of the data above is shown below:
100107
FREQ ERR ELO
101108
MHz MHz 1 / cm
102109
----------- ------ --------
103-
115271.2018 0.0005 0.0
104-
230538.0 0.0005 3.845
105-
345795.9899 0.0005 11.535
106-
461040.7682 0.0005 23.0695
107-
576267.9305 0.0005 38.4481
108-
691473.0763 0.0005 57.6704
109-
806651.806 0.005 80.7354
110-
921799.7 0.005 107.6424
110+
115271.2018 0.0005 0.0
111+
230538.0 0.0005 3.845
112+
345795.9899 0.0005 11.535
113+
461040.7682 0.0005 23.0695
114+
576267.9305 0.0005 38.4481
115+
691473.0763 0.0005 57.6704
116+
806651.806 0.005 80.7354
117+
921799.7 0.005 107.6424
111118
>>> response['FREQ'].quantity
112119
<Quantity [115271.2018, 230538. , 345795.9899, 461040.7682, 576267.9305,
113120
691473.0763, 806651.806 , 921799.7 ] MHz>

0 commit comments

Comments
 (0)