Skip to content

Commit 8da9036

Browse files
committed
update lamda docs for latest changes
1 parent 5904f65 commit 8da9036

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

astroquery/lamda/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class LamdaClass(BaseQuery):
4141

4242
def __init__(self, **kwargs):
4343
super(LamdaClass, self).__init__(**kwargs)
44-
self._moldict_path = os.path.join(self.cache_location,
45-
"molecules.json")
44+
self.moldict_path = os.path.join(self.cache_location,
45+
"molecules.json")
4646

4747
def _get_molfile(self, mol, cache=True, timeout=None):
4848
"""
@@ -112,8 +112,8 @@ def get_molecules(self, cache=True):
112112
"""
113113
if cache and hasattr(self, '_molecule_dict'):
114114
return self._molecule_dict
115-
elif cache and os.path.isfile(self._moldict_path):
116-
with open(self._moldict_path, 'r') as f:
115+
elif cache and os.path.isfile(self.moldict_path):
116+
with open(self.moldict_path, 'r') as f:
117117
md = json.load(f)
118118
return md
119119

@@ -133,7 +133,7 @@ def get_molecules(self, cache=True):
133133
url
134134
for url in datfile_urls}
135135

136-
with open(self._moldict_path, 'w') as f:
136+
with open(self.moldict_path, 'w') as f:
137137
s = json.dumps(molecule_dict)
138138
f.write(s)
139139

docs/lamda/lamda.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,32 @@ query, use:
1414

1515
.. code-block:: python
1616
17-
>>> from astroquery import lamda
18-
>>> lamda.print_mols()
17+
>>> from astroquery.lamda import Lamda
18+
>>> lamda.molecule_dict
1919
20-
A query type must be specified among ``'erg_levels'`` for energy levels,
21-
``'rad_trans'`` for radiative transitions, or ``'coll_rates'`` for collisional
22-
rates. Example queries are show below:
20+
The dictionary is created dynamically from the LAMDA website the first time it
21+
is called, then cached for future use. If there has been an update and you
22+
want to reload the cache, you can find the cache file `molecules.json` and
23+
remove it:
2324

2425
.. code-block:: python
2526
26-
>>> erg_t = lamda.query(mol='co', query_type='erg_levels')
27-
>>> rdt_t = lamda.query(mol='co', query_type='rad_trans')
28-
>>> clr_t = lamda.query(mol='co', query_type='coll_rates')
27+
>>> Lamda.cache_location
28+
u'/Users/your_username/.astropy/cache/astroquery/Lamda'
29+
>>> Lamda.moldict_path
30+
u'/Users/your_username/.astropy/cache/astroquery/Lamda/molecules.json'
31+
>>> os.remove(Lamda.moldict_path)
2932
30-
Catalogs are returned as `~astropy.table.Table` instances. Often molecules have
31-
collisional rates calculate for more than one collisional partner, specify the
32-
order of the partner in the datafile using the ``coll_partner_index`` parameter:
33+
34+
You can query for any molecule in that dictionary.
3335

3436
.. code-block:: python
3537
36-
>>> clr_t0 = lamda.query(mol='co', query_type='coll_rates', coll_partner_index=0)
37-
>>> clr_t1 = lamda.query(mol='co', query_type='coll_rates', coll_partner_index=1)
38+
>>> collrates,radtransitions,enlevels = Lamda.query(mol='co')
39+
40+
Catalogs are returned as `~astropy.table.Table` instances, except for
41+
`collrates`, which is a dictionary of tables, with one table for each
42+
collisional partner.
3843

3944
Reference/API
4045
=============

0 commit comments

Comments
 (0)