@@ -76,16 +76,17 @@ def set_default_options(self, **kwargs):
76
76
"""
77
77
self .data .update (self ._parse_kwargs (** kwargs ))
78
78
79
- def get_species_ids (self , regex_str = None , * , reflags = 0 , recache = False ):
79
+ def get_species_ids (self , species_regex = None , * , reflags = 0 , recache = False ):
80
80
"""
81
81
Get a dictionary of "species" IDs, where species refers to the molecule
82
82
name, mass, and chemical composition.
83
83
84
84
Parameters
85
85
----------
86
- regex_str : str
87
- String to compile into an re, if specified. Searches table for
88
- species whose names match
86
+ species_regex : str
87
+ String to search for among the species names, if specified.
88
+ The string will be compiled into a regular expression using the
89
+ python `re` module.
89
90
reflags : int
90
91
Flags to pass to `re`.
91
92
recache : bool
@@ -95,7 +96,7 @@ def get_species_ids(self, regex_str=None, *, reflags=0, recache=False):
95
96
--------
96
97
>>> import re
97
98
>>> import pprint # unfortunate hack required for documentation testing
98
- >>> rslt = Splatalogue.get_species_ids(regex_str ='Formaldehyde')
99
+ >>> rslt = Splatalogue.get_species_ids(species_regex ='Formaldehyde')
99
100
>>> pprint.pprint(rslt)
100
101
{'03023 H2CO - Formaldehyde': '194',
101
102
'03106 H213CO - Formaldehyde': '324',
@@ -107,7 +108,7 @@ def get_species_ids(self, regex_str=None, *, reflags=0, recache=False):
107
108
'03301 D213CO - Formaldehyde': '1220',
108
109
'03315 HDC18O - Formaldehyde': '21141',
109
110
'03410 D2C18O - Formaldehyde': '21140'}
110
- >>> rslt = Splatalogue.get_species_ids(regex_str ='H2CO')
111
+ >>> rslt = Splatalogue.get_species_ids(species_regex ='H2CO')
111
112
>>> pprint.pprint(rslt)
112
113
{'03023 H2CO - Formaldehyde': '194',
113
114
'03109 H2COH+ - Hydroxymethylium ion': '224',
@@ -125,9 +126,9 @@ def get_species_ids(self, regex_str=None, *, reflags=0, recache=False):
125
126
'08903 CH3CHNH2COOH - II - α-Alanine': '1322'}
126
127
>>> # note the whitespace, preventing H2CO within other
127
128
>>> # more complex molecules
128
- >>> Splatalogue.get_species_ids(regex_str =' H2CO ')
129
+ >>> Splatalogue.get_species_ids(species_regex =' H2CO ')
129
130
{'03023 H2CO - Formaldehyde': '194'}
130
- >>> Splatalogue.get_species_ids(regex_str =' h2co ', reflags=re.IGNORECASE)
131
+ >>> Splatalogue.get_species_ids(species_regex =' h2co ', reflags=re.IGNORECASE)
131
132
{'03023 H2CO - Formaldehyde': '194'}
132
133
133
134
"""
@@ -136,8 +137,8 @@ def get_species_ids(self, regex_str=None, *, reflags=0, recache=False):
136
137
if not hasattr (self , '_species_ids' ):
137
138
self ._species_ids = load_species_table .species_lookuptable (recache = recache )
138
139
139
- if regex_str is not None :
140
- return self ._species_ids .find (regex_str , flags = reflags )
140
+ if species_regex is not None :
141
+ return self ._species_ids .find (species_regex , flags = reflags )
141
142
else :
142
143
return self ._species_ids
143
144
@@ -319,7 +320,7 @@ def _parse_kwargs(self, *, min_frequency=None, max_frequency=None,
319
320
payload ['sid[]' ] = []
320
321
elif chemical_name is not None :
321
322
if parse_chemistry_locally :
322
- species_ids = self .get_species_ids (regex_str = chemical_name , reflags = chem_re_flags )
323
+ species_ids = self .get_species_ids (species_regex = chemical_name , reflags = chem_re_flags )
323
324
if len (species_ids ) == 0 :
324
325
raise ValueError ("No matching chemical species found." )
325
326
payload ['sid[]' ] = list (species_ids .values ())
0 commit comments