From 99999124f50670edb6712b8a19a33e13c519b96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Le=20Guyader?= <loic.le.guyader@xfel.eu> Date: Thu, 12 May 2022 17:23:31 +0200 Subject: [PATCH] Adds initial flat field fitting guess parameter --- src/toolbox_scs/routines/boz.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/toolbox_scs/routines/boz.py b/src/toolbox_scs/routines/boz.py index 0f6b7d5..bee93c7 100644 --- a/src/toolbox_scs/routines/boz.py +++ b/src/toolbox_scs/routines/boz.py @@ -61,11 +61,13 @@ class parameters(): self.flat_field = None self.flat_field_prod_th = (5.0, np.PINF) self.flat_field_ratio_th = (np.NINF, 1.2) + self.plane_guess_fit = None self.Fnl = None self.alpha = None self.sat_level = None self.max_iter = None + # temporary data self.arr_dark = None self.tid_dark = None @@ -166,6 +168,7 @@ class parameters(): v['flat_field'] = self.flat_field v['flat_field_prod_th'] = self.flat_field_prod_th v['flat_field_ratio_th'] = self.flat_field_ratio_th + v['plane_guess_fit'] = self.plane_guess_fit v['Fnl'] = self.Fnl v['alpha'] = self.alpha @@ -198,6 +201,7 @@ class parameters(): c.rois_th = v['rois_th'] c.set_flat_field(v['flat_field'], v['flat_field_prod_th'], v['flat_field_ratio_th']) + c.plane_guess_fit = v['plane_guess_fit'] c.set_Fnl(v['Fnl']) c.alpha = v['alpha'] @@ -220,6 +224,7 @@ class parameters(): f += f'rois: {self.rois}\n' f += f'flat field p: {self.flat_field} prod:{self.flat_field_prod_th} ratio:{self.flat_field_ratio_th}\n' + f += f'plane guess fit: {self.plane_guess_fit}\n' if self.Fnl is not None: f += f'dFnl: {np.array(self.Fnl) - np.arange(2**9)}\n' @@ -1040,7 +1045,12 @@ def plane_fitting(params): return d2_2 + d0_2 - p_guess_fit = [-0.2, -0.1, 1, -0.54] + return 1e3*(d2_2 + d0_2) + + if params.plane_guess_fit is None: + p_guess_fit = [-20, 0.0, 1.5, -0.5, -20, 0, 1.5, -0.5 ] + else: + p_guess_fit = params.plane_guess_fit res = minimize(_crit, p_guess_fit) -- GitLab