Baseline.BaselineUtils#

Baseline.BaselineUtils.py

molass_lpm_impl(x, y, **kwargs)#

Linear plus minimum baseline implementation.

Parameters:
  • x (array-like) – The x-values of the data.

  • y (array-like) – The y-values of the data.

  • kwargs (dict) – Additional keyword arguments to pass to the baseline computation function.

Returns:

baseline – The computed baseline values.

Return type:

array-like

molass_uvdiff_impl(x, y, **kwargs)#

UV difference baseline implementation.

Parameters:
  • x (array-like) – The x-values of the data.

  • y (array-like) – The y-values of the data.

  • kwargs (dict) – Additional keyword arguments to pass to the baseline computation function.

Returns:

baseline – The computed baseline values.

Return type:

array-like

molass_integral_impl(x, y, **kwargs)#

Integral baseline implementation.

Parameters:
  • x (array-like) – The x-values of the data.

  • y (array-like) – The y-values of the data.

  • kwargs (dict) – Additional keyword arguments to pass to the baseline computation function.

Returns:

baseline – The computed baseline values.

Return type:

array-like

pybaselines_asls_impl(x, y, **kwargs)#

Asymmetric least squares baseline implementation using pybaselines.

Parameters:
  • x (array-like) – The x-values of the data.

  • y (array-like) – The y-values of the data.

  • kwargs (dict) – Additional keyword arguments to pass to the baseline computation function.

Returns:

baseline – The computed baseline values.

Return type:

array-like

pybaselines_imor_impl(x, y, **kwargs)#

Improved modified polynomial fitting baseline implementation using pybaselines.

Parameters:
  • x (array-like) – The x-values of the data.

  • y (array-like) – The y-values of the data.

  • kwargs (dict) – Additional keyword arguments to pass to the baseline computation function.

Returns:

baseline – The computed baseline values.

Return type:

array-like

pybaselines_mormol_impl(x, y, **kwargs)#

Morphological operations baseline implementation using pybaselines. :param x: The x-values of the data. :type x: array-like :param y: The y-values of the data. :type y: array-like :param kwargs: Additional keyword arguments to pass to the baseline computation function. :type kwargs: dict

Returns:

baseline – The computed baseline values.

Return type:

array-like

iterlen(a)#

Get the length of an iterable, or 1 if it is not iterable.

Parameters:

a (any) – The object to check.

Returns:

length – The length of the iterable, or 1 if it is not iterable.

Return type:

int

get_baseline_func(method)#

Get the baseline function(s) corresponding to the given method(s).

Parameters:

method (str, callable, or list/tuple of str/callable) – The method(s) to get the baseline function(s) for. If a single method is given, it will be used for both UV and XR baselines. If a list or tuple of two methods is given, the first will be used for UV and the second for XR. Each method can be either a string (key in METHOD_DICT) or a callable (custom function).

Returns:

functions – A list containing the baseline function for UV and XR, respectively.

Return type:

list of callables

get_uv_baseline_func(method)#

Get the UV baseline function corresponding to the given method.

Parameters:

method (str, callable, or list/tuple of str/callable) – The method(s) to get the baseline function(s) for. If a single method is given, it will be used for both UV and XR baselines. If a list or tuple of two methods is given, the first will be used for UV and the second for XR. Each method can be either a string (key in METHOD_DICT) or a callable (custom function).

Returns:

function – The baseline function for UV.

Return type:

callable

get_xr_baseline_func(method)#

Get the XR baseline function corresponding to the given method.

Parameters:

method (str, callable, or list/tuple of str/callable) – The method(s) to get the baseline function(s) for. If a single method is given, it will be used for both UV and XR baselines. If a list or tuple of two methods is given, the first will be used for UV and the second for XR. Each method can be either a string (key in METHOD_DICT) or a callable (custom function).

Returns:

function – The baseline function for XR.

Return type:

callable