Skip to content

Commit

Permalink
Don't have stage and event lines change x axis limits.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgevans committed Aug 28, 2024
1 parent e9585da commit fa4a430
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/qslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions src/qslib/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit fa4a430

Please sign in to comment.