Skip to content

Commit

Permalink
Merge pull request #632 from radis/auto_import_exomol_states
Browse files Browse the repository at this point in the history
[Minor] Secondary xaxis & download of .states.bz2 file
  • Loading branch information
minouHub committed Nov 4, 2023
2 parents cefd9a2 + 8666c1b commit 0cb1a25
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
13 changes: 9 additions & 4 deletions radis/api/exomolapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,15 @@ def __init__(
self.def_file = self.path / pathlib.Path(molec + ".def")
self.broad_file = self.path / pathlib.Path(molecbroad + ".broad")

mgr = self.get_datafile_manager()
if not self.def_file.exists():
self.download(molec, extension=[".def"])
if not self.pf_file.exists():
self.download(molec, extension=[".pf"])
if not self.states_file.exists():
if (
not self.states_file.exists()
and not mgr.cache_file(self.states_file).exists()
):
self.download(molec, extension=[".states.bz2"])
if (not self.broad_file.exists()) and self.broadf:
self.download(molec, extension=[".broad"])
Expand Down Expand Up @@ -1073,7 +1077,6 @@ def __init__(
)

# load states
mgr = self.get_datafile_manager()
if cache == "regen" and mgr.cache_file(self.states_file).exists():
if self.verbose:
print("Removing existing file ", mgr.cache_file(self.states_file))
Expand Down Expand Up @@ -1218,15 +1221,17 @@ def __init__(

mgr.write(mgr.cache_file(trans_file), trans)

def set_broadening_coef(self, df, alpha_ref_def=None, n_Texp_def=None, output=None, add_columns=True):
def set_broadening_coef(
self, df, alpha_ref_def=None, n_Texp_def=None, output=None, add_columns=True
):
"""setting broadening parameters
Parameters
----------
df: Data Frame
alpha_ref: set default alpha_ref and apply it. None=use self.alpha_ref_def
n_Texp_def: set default n_Texp and apply it. None=use self.n_Texp_def
add_columns: adds alpha_ref and n_Texp columns to df
add_columns: adds alpha_ref and n_Texp columns to df
Returns
-------
Expand Down
8 changes: 7 additions & 1 deletion radis/lbl/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,13 @@ def eq_spectrum_gpu(
return s

def eq_spectrum_gpu_interactive(
self, var="transmittance", slit_function=0.0, mpl_backend='', plotkwargs={}, *vargs, **kwargs
self,
var="transmittance",
slit_function=0.0,
mpl_backend="",
plotkwargs={},
*vargs,
**kwargs,
) -> Spectrum:
"""
Expand Down
4 changes: 3 additions & 1 deletion radis/spectrum/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,9 @@ def clean_error_msg(string):

from radis.phys.convert import cm2nm, div_safe, nm2cm

if "cm⁻¹" in ylabel:
if ax.child_axes != []:
pass
elif "cm⁻¹" in ylabel:
secx = ax.secondary_xaxis(
"top", functions=(div_safe(cm2nm), div_safe(nm2cm))
)
Expand Down

0 comments on commit 0cb1a25

Please sign in to comment.