Skip to content

Commit

Permalink
Fix fitting with inactive components for other fitters
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasaarholt committed Apr 13, 2017
1 parent 2fd4893 commit 1aed949
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hyperspy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ def fit(self, fitter=None, method='ls', grad=False,

signal_axis = self.axis.axis[np.where(self.channel_switches)]
component_data = np.array([component.function(signal_axis)
for component in self if len(component.free_parameters) > 0])
for component in self if len(component.free_parameters) > 0 and component.active])
y = self.get_signal_for_linear_fitting()
params, residuals, rank, singular = linear_lstsq(component_data.T, y)
fit_coefficients = params
Expand All @@ -1261,7 +1261,7 @@ def fit(self, fitter=None, method='ls', grad=False,

signal_axis = self.axis.axis[np.where(self.channel_switches)]
component_data = np.array([component.function(signal_axis)
for component in self if len(component.free_parameters) > 0])
for component in self if len(component.free_parameters) > 0 and component.active])
y = self.get_signal_for_linear_fitting()
output = nnls(component_data.T, y)
fit_coefficients = output[0]
Expand Down

0 comments on commit 1aed949

Please sign in to comment.