From a828f423fd940067d298e4a070f5db27aba4be5a Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 13 Nov 2021 23:16:56 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=91=8C=20Handle=20missing=20SVD=20by?= =?UTF-8?q?=20computing=20them=20if=20missing=20in=20plots=20that=20use=20?= =?UTF-8?q?them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyglotaran_extras/plotting/plot_data.py | 3 +++ pyglotaran_extras/plotting/plot_svd.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/pyglotaran_extras/plotting/plot_data.py b/pyglotaran_extras/plotting/plot_data.py index 84d2b2f2..7ca49654 100644 --- a/pyglotaran_extras/plotting/plot_data.py +++ b/pyglotaran_extras/plotting/plot_data.py @@ -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 @@ -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) diff --git a/pyglotaran_extras/plotting/plot_svd.py b/pyglotaran_extras/plotting/plot_svd.py index be955577..21ddcbfe 100644 --- a/pyglotaran_extras/plotting/plot_svd.py +++ b/pyglotaran_extras/plotting/plot_svd.py @@ -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: @@ -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) From cf036b783eb25b58b57d2cb1260885be0ed952e9 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sat, 13 Nov 2021 23:34:57 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=A7=20Disallow=20xarray=20versions?= =?UTF-8?q?=20breaking=20plotting=20in=20integration=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index c983d6b1..208b067a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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