Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🩹 Handle missing SVD attributes #45

Merged
merged 2 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyglotaran_extras/plotting/plot_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import cast

import matplotlib.pyplot as plt
from glotaran.io.prepare_dataset import add_svd_to_dataset
from matplotlib.axis import Axis

from pyglotaran_extras.io.load_data import load_data
Expand Down Expand Up @@ -58,6 +59,8 @@ def plot_data_overview(
dataset.data.plot(x="time", ax=data_ax, center=False)
else:
dataset.data.plot(ax=data_ax)

add_svd_to_dataset(dataset=dataset, name="data")
plot_lsv_data(dataset, lsv_ax)
plot_sv_data(dataset, sv_ax)
plot_rsv_data(dataset, rsv_ax)
Expand Down
7 changes: 7 additions & 0 deletions pyglotaran_extras/plotting/plot_svd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from typing import TYPE_CHECKING

from glotaran.io.prepare_dataset import add_svd_to_dataset

from pyglotaran_extras.plotting.style import PlotStyle

if TYPE_CHECKING:
Expand All @@ -20,9 +22,14 @@ def plot_svd(
linthresh: float = 1,
cycler: Cycler = PlotStyle().cycler,
) -> None:
if "weighted_residual" in res:
add_svd_to_dataset(dataset=res, name="weighted_residual")
else:
add_svd_to_dataset(dataset=res, name="residual")
plot_lsv_residual(res, axes[0, 0], linlog=linlog, linthresh=linthresh, cycler=cycler)
plot_rsv_residual(res, axes[0, 1], cycler=cycler)
plot_sv_residual(res, axes[0, 2], cycler=cycler)
add_svd_to_dataset(dataset=res, name="data")
plot_lsv_data(res, axes[1, 0], linlog=linlog, linthresh=linthresh, cycler=cycler)
plot_rsv_data(res, axes[1, 1], cycler=cycler)
plot_sv_data(res, axes[1, 2], cycler=cycler)
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ packages = find:
install_requires =
matplotlib>=3.3.0
pyglotaran>=0.3.0
xarray!=0.20.0,!=0.20.1,>=0.16.2
python_requires = >=3.8,<3.10
zip_safe = True

Expand Down