diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a042f3..e0cfa17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ SPDX-License-Identifier: EUPL-1.2 - `Machine.block` command to directly control block temperatures. - Certificate support for SSL, and new connection recommendations. +- Stage lines and event spans now are now not plotted if they are outside of the selected time range / stages. ## Version 0.11.0 diff --git a/src/qslib/__init__.py b/src/qslib/__init__.py index 1e241c5..8cfefce 100644 --- a/src/qslib/__init__.py +++ b/src/qslib/__init__.py @@ -6,7 +6,7 @@ from .experiment import Experiment from .machine import Machine, MachineStatus, RunStatus from .plate_setup import PlateSetup, Sample -from .processors import NormRaw, NormToMaxPerWell, NormToMeanPerWell, SmoothEMWMean +from .processors import NormRaw, NormToMaxPerWell, NormToMeanPerWell, SmoothEMWMean, SmoothWindowMean from .protocol import CustomStep, Protocol, Stage, Step from .scpi_commands import AccessLevel diff --git a/src/qslib/experiment.py b/src/qslib/experiment.py index eacd2d5..6726195 100644 --- a/src/qslib/experiment.py +++ b/src/qslib/experiment.py @@ -2562,6 +2562,12 @@ def _annotate_stages( for _, s in self.stages.iterrows(): if s.stage == "PRERUN" or s.stage == "POSTRUN": continue + # + + xlim = ax.get_xlim() + if not (xlim[0] <= s.start_seconds / 3600.0 <= xlim[1]): + continue + xtrans = ax.get_xaxis_transform() ax.axvline( s.start_seconds / 3600.0, @@ -2590,6 +2596,10 @@ def _annotate_events(self, ax): ] cli = [cl[cl > x][0] if len(cl[cl > x]) > 0 else None for x in opi] for x1, x2 in zip(opi, cli): + xlim = ax.get_xlim() + if not (xlim[0] <= self.events.loc[x1, "hours"] <= xlim[1] or + (x2 is not None and xlim[0] <= self.events.loc[x2, "hours"] <= xlim[1])): + continue ax.axvspan( self.events.loc[x1, "hours"], self.events.loc[x2, "hours"] if x2 is not None else None, @@ -2605,6 +2615,10 @@ def _annotate_events(self, ax): ] cli = [cl[cl > x][0] if len(cl[cl > x]) > 0 else None for x in opi] for x1, x2 in zip(opi, cli): + xlim = ax.get_xlim() + if not (xlim[0] <= self.events.loc[x1, "hours"] <= xlim[1] or + (x2 is not None and xlim[0] <= self.events.loc[x2, "hours"] <= xlim[1])): + continue ax.axvspan( self.events.loc[x1, "hours"], self.events.loc[x2, "hours"] if x2 is not None else None,