@@ -76,14 +76,14 @@ 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 , * , restr = None , reflags = 0 , recache = False ):
79
+ def get_species_ids (self , regex_str = 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
- restr : str
86
+ regex_str : str
87
87
String to compile into an re, if specified. Searches table for
88
88
species whose names match
89
89
reflags : int
@@ -95,7 +95,7 @@ def get_species_ids(self, *, restr=None, reflags=0, recache=False):
95
95
--------
96
96
>>> import re
97
97
>>> import pprint # unfortunate hack required for documentation testing
98
- >>> rslt = Splatalogue.get_species_ids(restr ='Formaldehyde')
98
+ >>> rslt = Splatalogue.get_species_ids(regex_str ='Formaldehyde')
99
99
>>> pprint.pprint(rslt)
100
100
{'03023 H2CO - Formaldehyde': '194',
101
101
'03106 H213CO - Formaldehyde': '324',
@@ -107,7 +107,7 @@ def get_species_ids(self, *, restr=None, reflags=0, recache=False):
107
107
'03301 D213CO - Formaldehyde': '1220',
108
108
'03315 HDC18O - Formaldehyde': '21141',
109
109
'0348 D2C18O - Formaldehyde': '21140'}
110
- >>> rslt = Splatalogue.get_species_ids(restr ='H2CO')
110
+ >>> rslt = Splatalogue.get_species_ids(regex_str ='H2CO')
111
111
>>> pprint.pprint(rslt)
112
112
{'03023 H2CO - Formaldehyde': '194',
113
113
'03109 H2COH+ - Hydroxymethylium ion': '224',
@@ -125,9 +125,9 @@ def get_species_ids(self, *, restr=None, reflags=0, recache=False):
125
125
'08903 CH3CHNH2COOH - II - α-Alanine': '1322'}
126
126
>>> # note the whitespace, preventing H2CO within other
127
127
>>> # more complex molecules
128
- >>> Splatalogue.get_species_ids(restr =' H2CO ')
128
+ >>> Splatalogue.get_species_ids(regex_str =' H2CO ')
129
129
{'03023 H2CO - Formaldehyde': '194'}
130
- >>> Splatalogue.get_species_ids(restr =' h2co ', reflags=re.IGNORECASE)
130
+ >>> Splatalogue.get_species_ids(regex_str =' h2co ', reflags=re.IGNORECASE)
131
131
{'03023 H2CO - Formaldehyde': '194'}
132
132
133
133
"""
@@ -136,8 +136,8 @@ def get_species_ids(self, *, restr=None, reflags=0, recache=False):
136
136
if not hasattr (self , '_species_ids' ):
137
137
self ._species_ids = load_species_table .species_lookuptable (recache = recache )
138
138
139
- if restr is not None :
140
- return self ._species_ids .find (restr , flags = reflags )
139
+ if regex_str is not None :
140
+ return self ._species_ids .find (regex_str , flags = reflags )
141
141
else :
142
142
return self ._species_ids
143
143
@@ -319,7 +319,7 @@ def _parse_kwargs(self, *, min_frequency=None, max_frequency=None,
319
319
payload ['sid[]' ] = []
320
320
elif chemical_name is not None :
321
321
if parse_chemistry_locally :
322
- species_ids = self .get_species_ids (restr = chemical_name , reflags = chem_re_flags )
322
+ species_ids = self .get_species_ids (regex_str = chemical_name , reflags = chem_re_flags )
323
323
if len (species_ids ) == 0 :
324
324
raise ValueError ("No matching chemical species found." )
325
325
payload ['sid[]' ] = list (species_ids .values ())
0 commit comments