Skip to content

Commit

Permalink
Update spencerfano.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Oct 15, 2024
1 parent ccf1ff7 commit 269a728
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pynonthermal/spencerfano.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SpencerFanoSolver:
sourcevec: npt.NDArray[np.float64]
E_init_ev: float
sfmatrix: npt.NDArray[np.float64]
adata_polars: pd.DataFrame
adata_polars: pd.DataFrame | None

def __init__(
self,
Expand Down Expand Up @@ -177,6 +177,8 @@ def add_ion_ltepopexcitation(self, Z, ion_stage, n_ion, temperature=3000, adata_
derived_transitions_columns=["epsilon_trans_ev", "lambda_angstroms", "lower_g", "upper_g"],
)

assert self.adata_polars is not None

ion = self.adata_polars.filter(pl.col("Z") == Z).filter(pl.col("ion_stage") == ion_stage)

dfpops_thision = ion["levels"].item()
Expand Down Expand Up @@ -732,6 +734,7 @@ def plot_yspectrum(
) -> None:
assert self._solved
fs = 12
fig = None
if axis is None:
fig, axis = plt.subplots(
nrows=1,
Expand Down Expand Up @@ -761,6 +764,7 @@ def plot_yspectrum(
if axis is None:
if outputfilename is not None:
print(f"Saving '{outputfilename}'")
assert fig is not None
fig.savefig(str(outputfilename))
plt.close()
else:
Expand All @@ -769,6 +773,7 @@ def plot_yspectrum(
def plot_channels(self, outputfilename=None, axis=None, xscalelog=False) -> None:
assert self._solved
fs = 12
fig = None
if axis is None:
fig, axis = plt.subplots(
nrows=1,
Expand Down Expand Up @@ -903,6 +908,7 @@ def plot_channels(self, outputfilename=None, axis=None, xscalelog=False) -> None
if axis is None:
if outputfilename is not None:
print(f"Saving '{outputfilename}'")
assert fig is not None
fig.savefig(str(outputfilename))
plt.close()
else:
Expand Down

0 comments on commit 269a728

Please sign in to comment.