Decompose.Proportional#
Decompose.Proportional.py
- safe_log10(x)#
Compute the base-10 logarithm of x, ensuring numerical stability. :param x: The input value(s) for which to compute the logarithm. :type x: float or array-like
- Returns:
The base-10 logarithm of the input value(s), with a lower bound to avoid logarithm of zero or negative values.
- Return type:
float or array-like
- get_proportional_slices(x, y, proportions, debug_ax=None)#
Get slices of x and y based on the specified proportions. Each slice corresponds to a component whose area is proportional to the given proportions.
- Parameters:
x (array-like) – The x values of the data.
y (array-like) – The y values of the data.
proportions (array-like) – The proportions for each component. Should sum to 1.
debug_ax (matplotlib.axes.Axes, optional) – An optional axis for debugging plots. If provided, the cumulative curve and slice boundaries will be plotted on this axis.
- Returns:
A list of slices corresponding to the proportional areas of each component.
- Return type:
list of slice
- estimate_initial_params(x, y, moment)#
Estimate initial parameters for the egh function based on the given data and moment.
- Parameters:
x (array-like) – The x values of the data.
y (array-like) – The y values of the data.
moment (Moment) – The moment object containing statistical information about the data.
- Returns:
params – The estimated parameters for the egh function: (height, mean, std, tau).
- Return type:
array-like
- debug_plot(ax, x, xslices, plot_params)#
Plot the initial decomposition parameters for debugging.
- Parameters:
ax (matplotlib.axes.Axes) – The axis on which to plot the debug information.
x (array-like) – The x values of the data.
xslices (list of slice) – The slices corresponding to each component.
plot_params (array-like) – The parameters for each component to be plotted.
- Return type:
None
- decompose_proportionally(icurve, proportions, debug=False)#
Decompose the given data (x, y) into components based on the specified proportions. Each component is modeled using the egh function from molass.SEC.Models.Simple.
- Parameters:
icurve (ICurve) – The intensity elution curve to be decomposed.
proportions (array-like) – The proportions for each component. Should sum to 1.
debug (bool, optional) – If True, enable debug mode to visualize the decomposition process. Default is False.
- Returns:
result – The result of the optimization containing the optimized parameters.
- Return type:
OptimizeResult