Skip to content

Commit 969b662

Browse files
committed
fixed make examples run, still check model result attrs
1 parent a827ab5 commit 969b662

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/raman_fitting/deconvolution_models/fit_models.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def fit_models(self, model_selection):
108108
logger.warning(
109109
f"{self._qcnm} fit_model failed for {modname}: {model}, because:\n {e}"
110110
)
111+
111112
self.FitResults.update(**_fittings)
112113

113114
def run_fit(self, model, _data, method="leastsq", **kws):
@@ -204,11 +205,16 @@ def model_result(self, value):
204205
if hasattr(value, "_modelname"):
205206
_mod_lbl = f'Model_{getattr(value,"_modelname")}'
206207
self.model_name_lbl = _mod_lbl
208+
209+
# TODO remove
210+
# from pprint import pprint
211+
# print('===== /n',value._int_lbl,'/n')
207212

208-
self.raw_data_lbl = value.data.name
213+
self.raw_data_lbl = value._int_lbl
209214

210215
self._model_result = value
211-
216+
217+
# TODO rewrite class and attirbuter setter
212218
self.make_result()
213219

214220
def make_result(self):
@@ -328,11 +334,18 @@ def prep_components(self):
328334
# FittingParams = pd.DataFrame(fit_params_od,index=[peak_model])
329335
_fit_comps_data = OrderedDict({"RamanShift": self.model_result.userkws["x"]})
330336
_fit_comps_data.update(self.model_result.eval_components())
337+
338+
# TODO take out
339+
# print('===/n',self.model_result, '/n')
340+
# print('===/n',self.model_result.__dict__.keys(), '/n')
341+
342+
331343
_fit_comps_data.update(
332344
{
333345
self.model_name_lbl: self.model_result.best_fit,
334346
"residuals": self.model_result.residual,
335-
self.model_result.data.name: self.model_result.data,
347+
# TODO check attributes of model_result
348+
self.model_result._int_lbl: self.model_result.data,
336349
}
337350
)
338351
FittingComps = pd.DataFrame(_fit_comps_data)

0 commit comments

Comments
 (0)