def __init__(self, signal1D, dictionary=None): super(Model1D, self).__init__() self.signal = signal1D self.axes_manager = self.signal.axes_manager self._plot = None self._position_widgets = {} self._adjust_position_all = None self._plot_components = False self._suspend_update = False self._model_line = None self._adjust_position_all = None self.axis = self.axes_manager.signal_axes[0] self.axes_manager.events.indices_changed.connect( self.fetch_stored_values, []) self.channel_switches = np.array([True] * len(self.axis.axis)) self.chisq = signal1D._get_navigation_signal() self.chisq.change_dtype("float") self.chisq.data.fill(np.nan) self.chisq.metadata.General.title = ( self.signal.metadata.General.title + ' chi-squared') self.dof = self.chisq._deepcopy_with_new_data( np.zeros_like(self.chisq.data, dtype='int')) self.dof.metadata.General.title = (self.signal.metadata.General.title + ' degrees of freedom') self.free_parameters_boundaries = None self._low_loss = None self.convolved = False self.components = ModelComponents(self) if dictionary is not None: self._load_dictionary(dictionary) self.inav = ModelSpecialSlicers(self, True) self.isig = ModelSpecialSlicers(self, False) self._whitelist = { 'channel_switches': None, 'convolved': None, 'free_parameters_boundaries': None, 'low_loss': ('sig', None), 'chisq.data': None, 'dof.data': None } self._slicing_whitelist = { 'channel_switches': 'isig', 'low_loss': 'inav', 'chisq.data': 'inav', 'dof.data': 'inav' }
def __init__(self, image, dictionary=None): self.image = image self.signal = self.image self.axes_manager = self.signal.axes_manager self._plot = None self._position_widgets = {} self._adjust_position_all = None self._plot_components = False self._suspend_update = False self._model_line = None self._adjust_position_all = None self.xaxis, self.yaxis = np.meshgrid( self.axes_manager.signal_axes[0].axis, self.axes_manager.signal_axes[1].axis) self.axes_manager.events.indices_changed.connect( self.fetch_stored_values, []) self.channel_switches = np.ones(self.xaxis.shape, dtype=bool) self.chisq = image._get_navigation_signal() self.chisq.change_dtype("float") self.chisq.data.fill(np.nan) self.chisq.metadata.General.title = self.signal.metadata.General.title + \ ' chi-squared' self.dof = self.chisq._deepcopy_with_new_data( np.zeros_like(self.chisq.data, dtype='int')) self.dof.metadata.General.title = self.signal.metadata.General.title + \ ' degrees of freedom' self.free_parameters_boundaries = None self.convolved = False self.components = ModelComponents(self) if dictionary is not None: self._load_dictionary(dictionary) self.inav = ModelSpecialSlicers(self, True) self.isig = ModelSpecialSlicers(self, False) self._whitelist = { 'channel_switches': None, 'convolved': None, 'free_parameters_boundaries': None, 'chisq.data': None, 'dof.data': None} self._slicing_whitelist = { 'channel_switches': 'isig', 'chisq.data': 'inav', 'dof.data': 'inav'}