You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
data = np.random.rand(200,200)
data = data.astype('float32')
hs_data = hs.signals.Signal2D(data)
hs_data.plot()
and apply Gaussian filter, it fails with:
Traceback (most recent call last):
File "/home/mkrajnak/.local/lib/python3.5/site-packages/hyperspyui/plugins/gaussianfilter.py", line 198, in set_preview
self.update()
File "/home/mkrajnak/.local/lib/python3.5/site-packages/hyperspyui/plugins/gaussianfilter.py", line 216, in update
record=False, out=out)
File "/home/mkrajnak/.local/lib/python3.5/site-packages/hyperspyui/plugins/gaussianfilter.py", line 112, in gaussian
im_o[:] = gaussian(im_i, sigma, *args, **kwargs)
File "/home/mkrajnak/.local/lib/python3.5/site-packages/skimage/filters/_gaussian.py", line 118, in gaussian
image = convert_to_float(image, preserve_range)
File "/home/mkrajnak/.local/lib/python3.5/site-packages/skimage/_shared/utils.py", line 243, in convert_to_float
image = img_as_float(image)
File "/home/mkrajnak/.local/lib/python3.5/site-packages/skimage/util/dtype.py", line 336, in img_as_float
return convert(image, np.float64, force_copy)
File "/home/mkrajnak/.local/lib/python3.5/site-packages/skimage/util/dtype.py", line 236, in convert
raise ValueError("Images of type float must be between -1 and 1.")
ValueError: Images of type float must be between -1 and 1.
Any clue?
The text was updated successfully, but these errors were encountered:
blazzter
changed the title
Gaussian smooth fails with float32 in specific case
Gaussian smooth fails with float32
Jul 27, 2017
I think that you've found a bug: in order to make the data palatable for skimage's gaussian filter, the plugin normalises the data making the (wrong) assumption that vmax - vmin > 1.
This can be easily fixed but, @vidartf. why not using ndimage's gaussian filter instead which doesn't require renormalising the images?
why not using ndimage's gaussian filter instead which doesn't require renormalising the images?
If I remember correctly, this might have been a performance issue. The blur should be fast in order to be responsive when interactively changing the sigma.
if I have object:
and apply Gaussian filter, it fails with:
Any clue?
The text was updated successfully, but these errors were encountered: