Background substraction is a necessary component of reflectometry reduction, where the background scattering is removed from the reflected intensity.
Herein are some functions to enable that for a two-dimensional detector image, as well as simple dataclasses in which we can store some information relating to the background subtraction, and any fitting that we might have carried out.
- class islatu.background.BkgSubInfo(bkg: float, bkg_e: float, bkg_sub_function: Callable, fit_info: Optional[FitInfo] = None)¶
A simple data class in which we can store information relating to a background subtraction.
- bkg: float¶
- bkg_e: float¶
- bkg_sub_function: Callable¶
- class islatu.background.FitInfo(popt: ndarray, pcov: ndarray, fit_function: Callable)¶
A simple dataclass in which we can store data relating to the quality of a fit.
- fit_function: Callable¶
- pcov: ndarray¶
- popt: ndarray¶
- islatu.background.fit_gaussian_1d(image: Image, params_0=None, bounds=None, axis=0)¶
Fit a one-dimensional Gaussian function with some ordinate offset to an image with uncertainty. This is achieved by averaging in a given
axisbefore performing the fit. Return the results, and index of the offset.
image – The islatu image object to fit.
list, optional) – An initial guess at the parameters. Defaults to values based on the image.
tuple, optional) – Bounds for the fitting. Defaults to values based on the image.
int) – The dimension along which the averaging will be performed.
array_like: The results (with uncertainties) for each
of the 6 parameters fit.
int: The index of the offset.
None: As it is not possible to describe the reflected
- Return type
- islatu.background.roi_subtraction(image, list_of_regions: List[Region])¶
Carry out background subtraction by taking a series of rectangular regions of interested (ROIs) as being fair Poissonian measurements of the background.
image – The islatu.image.Image object from which we should subtract background from.
list_of_regions – A list of instances of the Regions class corresponding to background regions.
- islatu.background.univariate_normal(data, mean, sigma, offset, factor)¶
Produce a univariate normal distribution.
array_like) – Abscissa data.
float) – Mean (horizontal).
float) – Variance (horizontal).
float) – Offset from the 0 for the ordinate, this is the background level.
float) – Multiplicative factor for area of normal distribution.
Ordinate data for univariate normal distribution.
- Return type