Skip to content

Commit

Permalink
👌 Handle missing SVD by computing them if missing in plots that use them
Browse files Browse the repository at this point in the history
  • Loading branch information
s-weigand committed Nov 13, 2021
1 parent 619bce0 commit f67ebfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
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
4 changes: 4 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,11 @@ def plot_svd(
linthresh: float = 1,
cycler: Cycler = PlotStyle().cycler,
) -> None:
add_svd_to_dataset(dataset=res, name="singular")
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

0 comments on commit f67ebfd

Please sign in to comment.