Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix tests for pytest>=8.0.0 #617

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fixed a bug where the time between frames was incorrectly not excluded when calling [`ImageStack.frame_timestamp_ranges()`](https://lumicks-pylake.readthedocs.io/en/latest/_api/lumicks.pylake.ImageStack.html#lumicks.pylake.ImageStack.frame_timestamp_ranges) with `include_dead_time=False`. Note that `Scan` and `Kymo` are not affected.
* Fixed a bug where [`ImageStack.plot_correlated()`](https://lumicks-pylake.readthedocs.io/en/v1.3.0/_api/lumicks.pylake.ImageStack.html#lumicks.pylake.ImageStack.plot_correlated) was not excluding the dead time between frames.
* Changed the `DateTime` tag on TIFFs exported with Pylake from `Scan` and `Kymo` objects. Before the change, the start and end of the scanning period in nanoseconds was stored. After the change, we store the starting timestamp of the frame, followed by the starting timestamp of the next frame to be consistent with data exported from Bluelake. The scanning time is stored in the field `Exposure time (ms)` on the Description tag.
* Fixed tests to be compatible with `pytest>=8.0.0`.

## v1.3.1 | 2023-12-07

Expand Down
2 changes: 2 additions & 0 deletions lumicks/pylake/force_calibration/tests/test_touchdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def test_exp_sine_fits(decay, amplitude, frequency, phase_shift):
np.testing.assert_allclose(par, frequency, rtol=1e-6)


@pytest.mark.filterwarnings("ignore:Covariance of the parameters could not be estimated")
@pytest.mark.filterwarnings("ignore:Surface detection failed")
def test_insufficient_data(mack_parameters):
stage_positions, simulation = simulate_touchdown(102.5, 103.5, 0.01, mack_parameters)

Expand Down
4 changes: 3 additions & 1 deletion lumicks/pylake/kymotracker/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def two_gaussians_1d():

@pytest.fixture
def blank_kymo():
return generate_kymo(
kymo = generate_kymo(
"",
np.ones((1, 10)),
pixel_size_nm=1000,
Expand All @@ -75,6 +75,8 @@ def blank_kymo():
samples_per_pixel=1,
line_padding=0,
)
kymo._motion_blur_constant = 0
return kymo


@pytest.fixture
Expand Down
16 changes: 13 additions & 3 deletions lumicks/pylake/kymotracker/tests/test_kymotrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,9 @@ def test_fit_binding_times_nonzero(blank_kymo, blank_kymo_track_args):
r"analysis. If you wish to not see this warning, filter the tracks with "
r"`lk.filter_tracks` with a minimum length of 2 samples.",
):
dwelltime_model = tracks.fit_binding_times(1)
dwelltime_model = tracks.fit_binding_times(
n_components=1, observed_minimum=True, discrete_model=False
)
np.testing.assert_equal(dwelltime_model.dwelltimes, [4, 4, 4, 4])
np.testing.assert_equal(dwelltime_model._observation_limits[0], 4)
np.testing.assert_allclose(dwelltime_model.lifetimes[0], [0.4])
Expand Down Expand Up @@ -1145,6 +1147,7 @@ def test_kymotrack_group_diffusion_filter():
image = np.random.randint(0, 20, size=(10, 10, 3))
kwargs = dict(line_time_seconds=10e-3, start=np.int64(20e9), pixel_size_um=0.05, name="test")
kymo = _kymo_from_array(image, "rgb", **kwargs)
kymo._motion_blur_constant = 0

base_coordinates = (
np.arange(1, 10),
Expand Down Expand Up @@ -1407,8 +1410,15 @@ def test_invalid_ensemble_diffusion(blank_kymo):
def test_ensemble_diffusion_different_attributes():
line_times = (1, 0.5)
pixel_sizes = (0.1, 0.05)
kwargs = [{"line_time_seconds": t, "pixel_size_um": s} for t in line_times for s in pixel_sizes]
kymos = [_kymo_from_array(np.random.poisson(5, (25, 25, 3)), "rgb", **k) for k in kwargs]
multi_kwargs = [
{"line_time_seconds": t, "pixel_size_um": s} for t in line_times for s in pixel_sizes
]
kymos = []
for kwargs in multi_kwargs:
kymo = _kymo_from_array(np.random.poisson(5, (25, 25, 3)), "rgb", **kwargs)
kymo._motion_blur_constant = 0
kymos.append(kymo)

tracks = [
KymoTrackGroup(
[KymoTrack(np.arange(5), np.random.uniform(3, 5, 5), k, "green", 0) for _ in range(5)]
Expand Down