def __init__(self): """Sets up events.changed event, and inits HasTraits. """ super(BaseROI, self).__init__() self.events = Events() self.events.changed = Event(""" Event that triggers when the ROI has changed. What constitues a change varies from ROI to ROI, but in general it should correspond to the region selected by the ROI has changed. Arguments: ---------- roi : The ROI that was changed. """, arguments=['roi']) self.signal_map = dict()
def __init__(self, parameter_name_list): self.events = Events() self.events.active_changed = Event(""" Event that triggers when the `Component.active` changes. The event triggers after the internal state of the `Component` has been updated. Arguments --------- obj : Component The `Component` that the event belongs to active : bool The new active state """, arguments=["obj", 'active']) self.parameters = [] self.init_parameters(parameter_name_list) self._update_free_parameters() self.active = True self._active_array = None self.isbackground = False self.convolved = True self.parameters = tuple(self.parameters) self._id_name = self.__class__.__name__ self._id_version = '1.0' self._position = None self.model = None self.name = '' self._whitelist = { '_id_name': None, 'name': None, 'active_is_multidimensional': None, '_active_array': None, 'active': None } self._slicing_whitelist = {'_active_array': 'inav'} self._slicing_order = ( 'active', 'active_is_multidimensional', '_active_array', )
def __init__(self): self._twins = set() self.events = Events() self.events.value_changed = Event(""" Event that triggers when the `Parameter.value` changes. The event triggers after the internal state of the `Parameter` has been updated. Arguments --------- obj : Parameter The `Parameter` that the event belongs to value : {float | array} The new value of the parameter """, arguments=["obj", 'value']) self.std = None self.component = None self.grad = None self.name = '' self.units = '' self._linear = False self.map = None self.model = None self._whitelist = { '_id_name': None, 'value': None, 'std': None, 'free': None, 'units': None, 'map': None, '_bounds': None, 'ext_bounded': None, 'name': None, '_linear': None, 'ext_force_positive': None, 'twin_function_expr': None, 'twin_inverse_function_expr': None, 'self': ('id', None), } self._slicing_whitelist = {'map': 'inav'}
def __init__(self, axes_manager, **kwargs): super(ResizableDraggableWidgetBase, self).__init__( axes_manager, **kwargs) if not self.axes: self._size = np.array([1]) self.size_step = 1 # = one step in index space self._snap_size = True self.events.resized = Event(doc=""" Event that triggers when the widget was resized. The event triggers after the internal state of the widget has been updated. This event does not differentiate on how the size of the widget was changed, so it is the responsibility of the user to suppress events as neccessary to avoid closed loops etc. Arguments: ---------- obj: The widget that was resized. """, arguments=['obj']) self.no_events_while_dragging = False self._drag_store = None
def __init__(self): # Data attributes self.data = None self.axes_manager = None self.ax = None self.auto_update = True # Properties self.marker = None self._marker_properties = {} # Events self.events = Events() self.events.closed = Event(""" Event triggered when a marker is closed. Arguments --------- marker : Marker The marker that was closed. """, arguments=['obj']) self._closing = False
def test_interactive_function_return_None(self): e = Event() def function_return_None(): print('function called') hs.interactive(function_return_None, e) e.trigger()