Skip to content

Commit

Permalink
add linelist exposure to atom data and reader, built on current
Browse files Browse the repository at this point in the history
  • Loading branch information
jvshields committed Oct 4, 2023
1 parent 14084ae commit 6408f08
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tardis/io/atom_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class AtomData(object):
"photoionization_data",
"yg_data",
"two_photon_data",
"linelist",
]

# List of tuples of the related dataframes.
Expand Down Expand Up @@ -165,7 +166,6 @@ def from_hdf(cls, fname=None):
fname = resolve_atom_data_fname(fname)

with pd.HDFStore(fname, "r") as store:

for name in cls.hdf_names:
try:
dataframes[name] = store.select(name)
Expand All @@ -182,7 +182,6 @@ def from_hdf(cls, fname=None):
# Checks for various collisional data from Carsus files
if "collisions_data" in store:
try:

dataframes["collision_data_temperatures"] = store[
"collisions_metadata"
].temperatures
Expand Down Expand Up @@ -211,6 +210,8 @@ def from_hdf(cls, fname=None):
raise ValueError(
f"Current carsus version, {carsus_version}, is not supported."
)
if "linelist" in store:
dataframes["linelist"] = store["linelist"]

atom_data = cls(**dataframes)

Expand Down Expand Up @@ -273,8 +274,8 @@ def __init__(
photoionization_data=None,
yg_data=None,
two_photon_data=None,
linelist=None,
):

self.prepared = False

# CONVERT VALUES TO CGS UNITS
Expand Down Expand Up @@ -333,6 +334,9 @@ def __init__(

self.two_photon_data = two_photon_data

if linelist is not None:
self.linelist = linelist

self._check_related()

self.symbol2atomic_number = OrderedDict(
Expand Down Expand Up @@ -426,7 +430,6 @@ def prepare_atom_data(
self.macro_atom_data_all is not None
and not line_interaction_type == "scatter"
):

self.macro_atom_data = self.macro_atom_data_all.loc[
self.macro_atom_data_all["atomic_number"].isin(
self.selected_atomic_numbers
Expand Down

0 comments on commit 6408f08

Please sign in to comment.