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

Numerical overflows while running surforama demo #22

Closed
saugatkandel opened this issue Mar 15, 2024 · 6 comments
Closed

Numerical overflows while running surforama demo #22

saugatkandel opened this issue Mar 15, 2024 · 6 comments

Comments

@saugatkandel
Copy link

I am trying out surforama demo, and it looks quite interesting! However, I am running into frequent numerical overflow issues when I change the extend/contact surface and the surface thickness. There are ranges of values of both where I get the warning:
/hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/surforama/app.py:161: RuntimeWarning: overflow encountered in byte_scalars!
in the terminal. The surface looks completely black at these regions.

@saugatkandel
Copy link
Author

And another error:

ValueError                                Traceback (most recent call last)
File /hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/surforama/app.py:218, in QtSurforama.update_colors_based_on_sampling(self=<surforama.app.QtSurforama object>, value=6)
    215         all_samples.append(sample_value)
    217 # Calculate min and max across all sampled values
--> 218 samples_min = np.min(all_samples)
        all_samples = []
        np.min = <function amin at 0x7f80eb9b1440>
        np = <module 'numpy' from '/hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/numpy/__init__.py'>
    219 samples_max = np.max(all_samples)
    221 # Normalize and update colors based on the mean value
    222 # of samples for each point

File <__array_function__ internals>:180, in amin(*args=([],), **kwargs={})

File /hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/numpy/core/fromnumeric.py:2918, in amin(a=[], axis=None, out=None, keepdims=<no value>, initial=<no value>, where=<no value>)
   2802 @array_function_dispatch(_amin_dispatcher)
   2803 def amin(a, axis=None, out=None, keepdims=np._NoValue, initial=np._NoValue,
   2804          where=np._NoValue):
   2805     """
   2806     Return the minimum of an array or minimum along an axis.
   2807 
   (...)
   2916     6
   2917     """
-> 2918     return _wrapreduction(a, np.minimum, 'min', axis, None, out,
        np = <module 'numpy' from '/hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/numpy/__init__.py'>
        a = []
        np.minimum = <ufunc 'minimum'>
        axis = None
        out = None
        keepdims = <no value>
        initial = <no value>
        where = <no value>
   2919                           keepdims=keepdims, initial=initial, where=where)

File /hpc/projects/group.czii/saugat.kandel/miniforge3/envs/napari-sk/lib/python3.11/site-packages/numpy/core/fromnumeric.py:86, in _wrapreduction(obj=[], ufunc=<ufunc 'minimum'>, method='min', axis=None, dtype=None, out=None, **kwargs={'initial': <no value>, 'keepdims': <no value>, 'where': <no value>})
     83         else:
     84             return reduction(axis=axis, out=out, **passkwargs)
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
        passkwargs = {}
        obj = []
        axis = None
        dtype = None
        out = None
        ufunc = <ufunc 'minimum'>

ValueError: zero-size array to reduction operation minimum which has no identity

@LorenzLamm
Copy link
Contributor

Hey @saugatkandel ,
I encountered the same issue with the overflow values and tried to fix it in #23.

In which situation did you encounter your other issue? Was it also with the demo example?

@saugatkandel
Copy link
Author

@LorenzLamm This was with the demo. I will try the fix later today, thanks!

@kephale
Copy link
Member

kephale commented Mar 20, 2024

@saugatkandel the fix is merged (#23)!

@kevinyamauchi
Copy link
Contributor

Hey, @saugatkandel ! Thanks for reporting this bug. I just cut a new release on pypi (0.0.3) that includes the fix by @LorenzLamm (#23).

You can install the new version with pip install --upgrade surforama.

Do you still see this issue with the new version?

@kevinyamauchi
Copy link
Contributor

I think this is fixed by #23, so I will close this for now. If anybody encounters this issue, please feel free to comment and we re-open the issue!

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

No branches or pull requests

4 participants