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
Hyperspy 1.62 crashes if the image has an offset > 0. This code example taken from the documentation gives the error traceback below if I dont force the offset to 0. Have the same issue with older data which used to work with code like this and where the image origin is not (0,0) .
holo = hs.datasets.example_signals.object_hologram()
# enabling this 2 lines prevents the crash
#holo.axes_manager[0].offset = 0
#holo.axes_manager[1].offset = 0
roi = hs.roi.Line2DROI(x1=465.577, y1=445.15, x2=169.4, y2=387.731, linewidth=0)
holo.plot()
ss = roi.interactive(holo)
error trace:
ValueError Traceback (most recent call last)
<ipython-input-23-b859ff1fe3d5> in <module>
5 roi = hs.roi.Line2DROI(x1=465.577, y1=445.15, x2=169.4, y2=387.731, linewidth=0)
6 holo.plot()
----> 7 ss = roi.interactive(holo)
8 ss.plot()
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\roi.py in interactive(self, signal, navigation_signal, out, color, snap, **kwargs)
382 if navigation_signal is not None:
383 if navigation_signal not in self.signal_map:
--> 384 self.add_widget(navigation_signal, color=color, snap=snap,
385 axes=kwargs.get("axes", None))
386 if (self.update not in
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\roi.py in add_widget(self, signal, axes, widget, color, snap, **kwargs)
460 widget.color = color
461 if hasattr(widget, 'snap_all'):
--> 462 widget.snap_all = snap
463 else:
464 widget.snap_position = snap
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\widget.py in <lambda>(s, v)
617
618 snap_all = property(lambda s: s.snap_size and s.snap_position,
--> 619 lambda s, v: s._set_snap_all(v))
620
621 def increase_size(self):
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\widget.py in _set_snap_all(self, value)
613 def _set_snap_all(self, value):
614 # Snap position first, as snapped size can depend on position.
--> 615 self.snap_position = value
616 self.snap_size = value
617
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\widget.py in <lambda>(s, v)
442
443 snap_position = property(lambda s: s._snap_position,
--> 444 lambda s, v: s._set_snap_position(v))
445
446 def connect(self, ax):
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\widget.py in _set_snap_position(self, value)
436 self._snap_position = value
437 if value:
--> 438 snap_value = self._do_snap_position(self._pos)
439 if np.any(self._pos != snap_value):
440 self._pos = snap_value
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\_widgets\line2d.py in _do_snap_position(self, value)
189 value = np.array(value) if value is not None else self._pos
190
--> 191 ret1 = super(Line2DWidget, self)._do_snap_position(value[0, :])
192 ret2 = super(Line2DWidget, self)._do_snap_position(value[1, :])
193
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\drawing\widget.py in _do_snap_position(self, value)
430 value = np.array(value) if value is not None else self._pos
431 for i, ax in enumerate(self.axes):
--> 432 value[i] = ax.index2value(ax.value2index(value[i]))
433 return value
434
C:\develop\anaconda\envs\hyperspy\lib\site-packages\hyperspy\axes.py in value2index(self, value, rounding)
542 return index
543 else:
--> 544 raise ValueError("The value is out of the axis limits")
545
546 def index2value(self, index):
ValueError: The value is out of the axis limits
The text was updated successfully, but these errors were encountered:
Hyperspy 1.62 crashes if the image has an offset > 0. This code example taken from the documentation gives the error traceback below if I dont force the offset to 0. Have the same issue with older data which used to work with code like this and where the image origin is not (0,0) .
error trace:
The text was updated successfully, but these errors were encountered: