DataObjects.Curve#
DataObjects.Curve.py
- class Curve(x, y, type=None)#
Bases:
object
A class representing a 1D curve with x and y data.
- x#
The x-values of the curve.
- Type:
array-like
- y#
The y-values of the curve.
- Type:
array-like
- type#
The type of the curve, e.g., ‘i’ for intensity curves. If None, the type is unspecified.
- Type:
str or None
- max_i#
The index of the maximum y-value. Computed on demand. If None, it has not been computed yet.
- Type:
int or None
- max_x#
The x-value corresponding to the maximum y-value. Computed on demand. If None, it has not been computed yet.
- Type:
float or None
- max_y#
The maximum y-value. Computed on demand. If None, it has not been computed yet.
- Type:
float or None
- peaks#
The indices of the peaks in the curve. Computed on demand. If None, it has not been computed yet.
- Type:
list of int or None
- moment#
The moment of the curve. Computed on demand. If None, it has not been computed yet.
- Type:
Moment or None
- spline#
A spline representation of the curve. Computed on demand. If None, it has not been computed yet.
- Type:
UnivariateSpline or None
- diff_spline#
The derivative spline representation of the curve. Computed on demand. If None, it has not been computed yet.
- Type:
UnivariateSpline or None
- get_xy()#
Return the x and y data as a tuple.
- Returns:
A tuple containing the x and y data.
- Return type:
tuple
- set_max()#
Set the maximum value and its index.
- get_max_i()#
Get the index of the maximum y value.
- get_max_y()#
Get the maximum y value.
- get_max_x()#
Get the x value corresponding to the maximum y value.
- get_max_xy()#
Get the (x, y) pair corresponding to the maximum y value.
- get_peaks(debug=False, **kwargs)#
Get the peak positions.
- Parameters:
debug (bool, optional) – If True, enable debug mode.
- Returns:
The list of peak positions (indices of self.x).
- Return type:
list of int
- get_num_major_peaks(**kwargs)#
Get the number of major peaks.
- get_moment()#
Get the moment of the curve. :returns: moment – The moment object representing the moment of the curve. :rtype: Moment
- smooth_copy()#
Return a smoothed copy of the curve. This is a placeholder for actual smoothing logic.
- get_spline()#
Get a spline representation of the curve.
- get_diff_spline()#
Get the derivative of the spline representation of the curve.
- corrected_copy()#
Return a copy of the curve with corrected x values. This is a placeholder for actual correction logic.
- create_icurve(x, M, vector, pickvalue)#
Create an i-curve from a 2D matrix M by picking a row based on pickvalue.
- Parameters:
x (array-like or None) – The x values for the curve. If None, defaults to np.arange(M.shape[1]).
M (2D array-like) – The 2D matrix from which to extract the i-curve.
vector (array-like) – The vector used to determine which row to pick based on pickvalue. Must be sorted.
pickvalue (float) – The value used to select the appropriate row from M.
- Returns:
The resulting i-curve.
- Return type:
- create_jcurve(x, M, j)#
Create a j-curve from a 2D matrix M by picking a column j.
- Parameters:
x (array-like or None) – The x values for the curve. If None, defaults to np.arange(M.shape[0]).
M (2D array-like) – The 2D matrix from which to extract the j-curve.
j (int) – The column index to extract.
- Returns:
The resulting j-curve.
- Return type: