Skip to content

Commit

Permalink
ci: close figures before issuing another plot
Browse files Browse the repository at this point in the history
This prevents `mpl` from warning us about layout changes when tight_layout() gets called twice.
  • Loading branch information
JoepVanlier committed Jul 11, 2023
1 parent daaa1cf commit c9b2353
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lumicks/pylake/piezo_tracking/tests/test_piezo_tracking.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import numpy as np
import matplotlib.pyplot as plt
from lumicks.pylake.channel import Slice, Continuous, TimeSeries
from lumicks.pylake.piezo_tracking.piezo_tracking import (
DistanceCalibration,
Expand Down Expand Up @@ -83,6 +84,9 @@ def distance1(self):
def test_plots():
distance_calibration = DistanceCalibration(*trap_pos_camera_distance(), 1)
distance_calibration.plot()
# Needed since otherwise second plot will issue warning about changing layout (since they both
# call tight_layout()
plt.close('all')
distance_calibration.plot_residual()


Expand Down
2 changes: 2 additions & 0 deletions lumicks/pylake/population/tests/test_dwelltimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,12 @@ def test_plots(exponential_data):
dataset = exponential_data["dataset_2exp"]
fit = DwelltimeModel(dataset["data"], 1, **dataset["parameters"].observation_limits)
fit.hist()
plt.close('all')

np.random.seed(123)
bootstrap = fit.calculate_bootstrap(iterations=2)
bootstrap.hist()
plt.close('all')

with pytest.warns(DeprecationWarning):
bootstrap.plot()
Expand Down

0 comments on commit c9b2353

Please sign in to comment.