diff --git a/src/toolbox_scs/routines/boz.py b/src/toolbox_scs/routines/boz.py index 25ac0a2e9d524ec78d9ae959811ffc062f83e691..f4818596020ff7df430696764393a9186cb6adf7 100644 --- a/src/toolbox_scs/routines/boz.py +++ b/src/toolbox_scs/routines/boz.py @@ -122,7 +122,7 @@ class parameters(): return self.mask_idx def flat_field_guess(self, guess=None): - """Set the flat field guess parameter for the fit and returns it. + """Set the flat-field guess parameter for the fit and returns it. Inputs ------ @@ -147,7 +147,7 @@ class parameters(): def set_flat_field(self, plane, prod_th=None, ratio_th=None): - """Set the flat field plane definition.""" + """Set the flat-field plane definition.""" if type(plane) is not list: self.flat_field = plane.tolist() else: @@ -158,7 +158,7 @@ class parameters(): self.flat_field_ratio_th = ratio_th def get_flat_field(self): - """Get the flat field plane definition.""" + """Get the flat-field plane definition.""" if self.flat_field is None: return None else: @@ -265,7 +265,7 @@ class parameters(): f += f'rois threshold: {self.rois_th}\n' 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'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' f += f'use hexagons: {self.use_hex}\n' f += f'enforce mirror symmetry: {self.force_mirror}\n' @@ -722,7 +722,7 @@ def inspect_rois(data_mean, rois, threshold=None, allrois=False): return fig -# Flat field related functions +# Flat-field related functions def _plane_flat_field(p, roi, params): """Compute the p plane over the given roi. @@ -752,7 +752,7 @@ def _plane_flat_field(p, roi, params): def compute_flat_field_correction(rois, params, plot=False): - """Compute the plane field correction on beam rois. + """Compute the plane-field correction on beam rois. Inputs ------ @@ -762,7 +762,7 @@ def compute_flat_field_correction(rois, params, plot=False): Returns ------- - numpy 2D array of the flat field correction evaluated over one DSSC ladder + numpy 2D array of the flat-field correction evaluated over one DSSC ladder (2 sensors) """ flat_field = np.ones((128, 512)) @@ -799,7 +799,7 @@ def inspect_flat_field_domain(avg, rois, prod_th, ratio_th, vmin=None, vmax=None Inputs ------ - avg: module average image with no saturated shots for the flat field + avg: module average image with no saturated shots for the flat-field determination rois: dictionnary or ROIs prod_th, ratio_th: tuple of floats for low and high threshold on @@ -875,7 +875,7 @@ def inspect_plane_fitting(avg, rois, domain=None, vmin=None, vmax=None): Inputs ------ - avg: module average image with no saturated shots for the flat field + avg: module average image with no saturated shots for the flat-field determination rois: dictionnary of rois domain: list of domain mask for the -1st and +1st order @@ -935,7 +935,7 @@ def plane_fitting_domain(avg, rois, prod_th, ratio_th): Inputs ------ - avg: module average image with no saturated shots for the flat field + avg: module average image with no saturated shots for the flat-field determination rois: dictionnary or rois containing the 3 beams ['n', '0', 'p'] with '0' as the reference beam in the middle @@ -990,7 +990,7 @@ def plane_fitting_domain(avg, rois, prod_th, ratio_th): def plane_fitting(params): - """Fit the plane flat field normalization. + """Fit the plane flat-field normalization. Inputs ------ @@ -1087,7 +1087,7 @@ def ff_refine_crit(p, alpha, params, arr_dark, arr, tid, rois, def ff_refine_fit(params): - """Refine the flat field fit by minimizing data spread. + """Refine the flat-field fit by minimizing data spread. Inputs ------ @@ -1209,7 +1209,7 @@ def nl_crit(p, domain, alpha, arr_dark, arr, tid, rois, mask, flat_field, tid: train id of arr data rois: ['n', '0', 'p', 'sat'] rois mask: mask fo good pixels - flat_field: zone plate flat field correction + flat_field: zone plate flat-field correction sat_level: integer, default 511, at which level pixel begin to saturate Returns @@ -1526,7 +1526,7 @@ def inspect_correction(params, gain=None): f.colorbar(img, ax=axs, label='events') axs[0, 0].set_title('raw') - axs[0, 1].set_title('flat field') + axs[0, 1].set_title('flat-field') axs[0, 2].set_title('non-linear') axs[0, 0].set_ylabel(r'-1$^\mathrm{st}$/0$^\mathrm{th}$ order') @@ -1652,8 +1652,8 @@ def process_module(arr, tid, dark, rois, mask=None, sat_level=511, rois: dictionnary of rois mask: default None, mask of ignored pixels sat_level: integer, default 511, at which level pixel begin to saturate - flat_field: default None, flat field correction - F_INL: default None, non linear correction function given as a + flat_field: default None, flat-field correction + F_INL: default None, non-linear correction function given as a lookup table with 9 bits integer input Returns @@ -1684,8 +1684,8 @@ def process_module(arr, tid, dark, rois, mask=None, sat_level=511, for n in rois.keys(): r_sat[n] = da.any(r[n] >= sat_level, axis=(2, 3)) - # TODO: flat field should not be applied on intra darks - # # change flat field dimension to match data + # TODO: flat-field should not be applied on intra darks + # # change flat-field dimension to match data # if flat_field is not None: # temp = np.ones_like(dark) # temp[::2, :, :] = flat_field[:, :] @@ -1698,7 +1698,7 @@ def process_module(arr, tid, dark, rois, mask=None, sat_level=511, r[n] = r[n] - rd[n] if flat_field is not None: - # TODO: flat field should not be applied on intra darks + # TODO: flat-field should not be applied on intra darks # ff = flat_field[:, rois[n]['yl']:rois[n]['yh'], # rois[n]['xl']:rois[n]['xh']] ff = flat_field[rois[n]['yl']:rois[n]['yh'], @@ -1734,7 +1734,7 @@ def process(Fmodel, arr_dark, arr, tid, rois, mask, flat_field, sat_level=511): arr: data rois: ['n', '0', 'p', 'sat'] rois mask: mask of good pixels - flat_field: zone plate flat field correction + flat_field: zone plate flat-field correction sat_level: integer, default 511, at which level pixel begin to saturate Returns