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

Clip min eigenvalues to 0 to block negative values in sqrt #89

Merged

Conversation

zoccoler
Copy link
Collaborator

@zoccoler zoccoler commented Oct 4, 2024

This sometimes can happen with floating point representation of very small numbers.

This solves #88 .

This sometimes can happen with floating point representation of very small numbers
@zoccoler
Copy link
Collaborator Author

zoccoler commented Oct 4, 2024

Hi @haesleinhuepf ,

This is a simple fix to solve an issue referred in image.sc here.

Please take a look and feel free to merge it if you agree.

Side-note: I had to pin the napari version for tests to make them work. We should either pin it also in the plugin requirements or update the plugin to make it compatible with newer napari versions. Let me know if you have an opinion on this.

@zoccoler zoccoler requested a review from haesleinhuepf October 4, 2024 07:45
@haesleinhuepf
Copy link
Owner

Hi Marcelo @zoccoler ,

awesome, thanks!

Side-note: I had to pin the napari version for tests to make them work.

What do you think about pinning the version in the tests only? Have you tried the plugin with napari 0.5.0 ? If it still works there, but only the tests are failing, we could implement the version pin here instead by adding "napari==0.4.19":

python -m pip install setuptools tox tox-gh-actions

Thanks for working on this!

Best,
Robert

@zoccoler
Copy link
Collaborator Author

zoccoler commented Oct 4, 2024

What do you think about pinning the version in the tests only?

I thought I did exactly this by pinning it here and not here. Is that correct?

Have you tried the plugin with napari 0.5.0 ?

I tried the plugin an environment with napari>0.5 (0.5.4), and there the following test fails:

================================================================ FAILURES ================================================================
___________________________________________ test_timelapse_analyse_all_timepoints_with_viewer ____________________________________________

make_napari_viewer = <function make_napari_viewer.<locals>.actual_factory at 0x0000014CBC8FDAB0>

    def test_timelapse_analyse_all_timepoints_with_viewer(make_napari_viewer):
        viewer = make_napari_viewer()

        image = np.asarray([
            [[[1, 2], [3, 4]]],
            [[[5, 6], [7, 8]]]
        ])

        labels = np.asarray([
            [[[1, 2], [3, 4]]],
            [[[1, 2], [3, 4]]]
        ])

        viewer.add_image(image)
        labels_layer = viewer.add_labels(labels)

        regionprops_table_all_frames(image, labels, size=False, napari_viewer=viewer)

        df = pd.DataFrame(labels_layer.properties)

>       assert df.shape[0] == 8
E       assert 4 == 8

napari_skimage_regionprops\_tests\test_timelapse.py:83: AssertionError

...

======================================================== short test summary info =========================================================
FAILED napari_skimage_regionprops/_tests/test_timelapse.py::test_timelapse_analyse_all_timepoints_with_viewer - assert 4 == 8
=============================================== 1 failed, 26 passed, 54 warnings in 45.52s ===============================================

It was the same error displayed here with Github actions. Thus, I made this commit and it worked.

I don't know what causes it, but it seems related to the napari version somehow.

@haesleinhuepf
Copy link
Owner

Awesome, thanks for working on this Marcelo!

@haesleinhuepf haesleinhuepf merged commit 2863eb0 into haesleinhuepf:master Oct 5, 2024
10 checks passed
@zoccoler zoccoler deleted the fix_ellipsoid_axis_length_error branch October 7, 2024 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants