From a6971ae880fac40c429ab36ad14117c90d91474a Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Fri, 8 Jul 2022 13:44:29 +0200 Subject: [PATCH 1/2] Component fitting for the current spin case --- easyDiffractionApp/Logic/Fitting.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/easyDiffractionApp/Logic/Fitting.py b/easyDiffractionApp/Logic/Fitting.py index 9fd76e90..aa3284a4 100644 --- a/easyDiffractionApp/Logic/Fitting.py +++ b/easyDiffractionApp/Logic/Fitting.py @@ -67,6 +67,16 @@ def fit_threading(self): x = exp_data.x y = exp_data.y + component = self.parent.l_experiment.spinComponent() + if component == "Sum": + y = exp_data.y + exp_data.yb + elif component == "Difference": + y = exp_data.y - exp_data.yb + elif component == "Up": + y = exp_data.y + elif component == "Down": + y = exp_data.yb + weights = 1 / exp_data.e kwargs = { From 11c391c075043ff1564b6bab729794321eb0d0f5 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Mon, 11 Jul 2022 12:57:52 +0200 Subject: [PATCH 2/2] make sure unpolarized case always works --- easyDiffractionApp/Logic/Fitting.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/easyDiffractionApp/Logic/Fitting.py b/easyDiffractionApp/Logic/Fitting.py index aa3284a4..f122054d 100644 --- a/easyDiffractionApp/Logic/Fitting.py +++ b/easyDiffractionApp/Logic/Fitting.py @@ -68,14 +68,15 @@ def fit_threading(self): x = exp_data.x y = exp_data.y component = self.parent.l_experiment.spinComponent() - if component == "Sum": - y = exp_data.y + exp_data.yb - elif component == "Difference": - y = exp_data.y - exp_data.yb - elif component == "Up": - y = exp_data.y - elif component == "Down": - y = exp_data.yb + is_polar = self.parent.l_experiment.spin_polarized + y = exp_data.y + exp_data.yb + if is_polar: + if component == "Difference": + y = exp_data.y - exp_data.yb + elif component == "Up": + y = exp_data.y + elif component == "Down": + y = exp_data.yb weights = 1 / exp_data.e