Skip to content

Commit

Permalink
added method to fit data in DataSet1D formar
Browse files Browse the repository at this point in the history
  • Loading branch information
andped10 committed Nov 1, 2024
1 parent b670869 commit 18ad31c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/easyreflectometry/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import scipp as sc
from easyscience.fitting import AvailableMinimizers
from easyscience.fitting.multi_fitter import MultiFitter as EasyScienceMultiFitter
from easyscience.fitting import FitResults

from easyreflectometry.data import DataSet1D
from easyreflectometry.model import Model


Expand Down Expand Up @@ -54,6 +56,15 @@ def fit(self, data: sc.DataGroup, id: int = 0) -> sc.DataGroup:
)
return new_data

def fit_data_set_1d(self, data: DataSet1D) -> FitResults:
"""
Perform the fitting and populate the DataGroups with the result.
:param data: DataGroup to be fitted to and populated
:param method: Optimisation method
"""
return self.easy_science_multi_fitter.fit(data.x, data.y, weights=data.ye)

def switch_minimizer(self, minimizer: AvailableMinimizers) -> None:
"""
Switch the minimizer for the fitting.
Expand Down

0 comments on commit 18ad31c

Please sign in to comment.