Skip to content

Commit

Permalink
Add compat layer for fitted_data to fit rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnel committed Sep 14, 2024
1 parent d3aef4c commit d37865d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pyglotaran_extras/compat/convert_result_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
from pyglotaran_extras.compat.compat_result import CompatResult


def _adjust_fitted_data(ds: xr.Dataset, *, cleanup: bool = False) -> None:
"""Rename fit to fitted_data."""
if "fit" in ds.data_vars:
ds["fitted_data"] = ds["fit"]
if cleanup:
ds = ds.drop_vars("fit")

def _adjust_concentrations(ds: xr.Dataset, *, cleanup: bool = False) -> None:
"""Adjust the concentrations to spectra names."""
# Check for species associated concentration variables
Expand Down Expand Up @@ -148,6 +155,7 @@ def convert_dataset(dataset: xr.Dataset, cleanup: bool = False) -> xr.Dataset:
_adjust_activation_to_irf(converted_ds, cleanup=cleanup)
_adjust_estimations_to_spectra(converted_ds, cleanup=cleanup)
_adjust_concentrations(converted_ds, cleanup=cleanup)
_adjust_fitted_data(converted_ds, cleanup=cleanup)

if (
"weighted_root_mean_square_error" not in converted_ds.attrs
Expand Down

0 comments on commit d37865d

Please sign in to comment.