math
math
¶
Report math utilities.
SlopeProperties
dataclass
¶
Class that encapsulates slope properties and provides methods to calculate correction values and find slope properties for a given dataset.
Attributes:
Name | Type | Description |
---|---|---|
optimum |
float64
|
The optimum value found during the slope property calculation. |
r_value |
float64
|
The r-value calculated for the slope properties. |
aa1 |
float64
|
The slope of the trend line of the correction index with respect to iteration index. |
bb1 |
float64
|
The exponential decay coefficient calculated for the slope properties. |
Methods:
Name | Description |
---|---|
get_correction |
Returns the correction values for a given input array |
find |
Finds the slope properties for a given dataset |
Source code in cssfinder/reports/math.py
get_correction_count
¶
Return the correction values for a given input array x
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
float64
|
Input array for which correction values will be calculated. |
required |
Returns:
Type | Description |
---|---|
float64
|
The correction values calculated for the input array |
Source code in cssfinder/reports/math.py
find
classmethod
¶
Find the slope properties for a given dataset data
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
NDArray[float64]
|
The dataset for which slope properties will be calculated. |
required |
Returns:
Type | Description |
---|---|
SlopeProperties
|
An instance of the SlopeProperties class representing the slope properties of the input data. |
Source code in cssfinder/reports/math.py
cov
¶
Calculate the covariance between two arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array_1 |
ndarray
|
The first array. |
required |
array_2 |
ndarray
|
The second array. |
required |
Returns:
Type | Description |
---|---|
float
|
The covariance between the two arrays. |
Notes
The covariance is calculated as the mean of the element-wise product of
the deviation from the mean of array_1
and array_2
. In other words,
the covariance measures how much two variables change together, and it
is a measure of the linear relationship between them.
Source code in cssfinder/reports/math.py
trend
¶
Calculate the trend between two arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array_1 |
ndarray
|
The first array. |
required |
array_2 |
ndarray
|
The second array. |
required |
Returns:
Type | Description |
---|---|
float
|
The trend between the two arrays. |
Notes
The trend is calculated as the covariance between the logarithm of
array_1
and array_2
divided by the covariance between the logarithm
of array_1
and itself.
Source code in cssfinder/reports/math.py
offset
¶
Calculate the offset between the two input arrays.
Offset is based on their logarithmic means and a decay trend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array_1 |
ndarray[float64]
|
The first input array. |
required |
array_2 |
ndarray[float64]
|
The second input array. |
required |
Returns:
Type | Description |
---|---|
float64
|
The calculated offset between the two input arrays. |
Raises:
Type | Description |
---|---|
ValueError
|
If the input arrays are empty. |
Examples:
>>> array_1 = np.array([1.0, 2.0, 3.0])
>>> array_2 = np.array([4.0, 5.0, 6.0])
>>> offset(array_1, array_2)
0.01638058574365686
Source code in cssfinder/reports/math.py
find_correction_optimum
¶
Find the optimum correction value for a given input array of values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
ndarray[float64]
|
The input array of values for which to find the optimum correction. |
required |
Returns:
Type | Description |
---|---|
float64
|
The optimum correction value for the input array of values. |
Source code in cssfinder/reports/math.py
R
¶
Calculate the R value for a given input array of values and a correction factor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
ndarray[float64]
|
The input array of values for which to calculate the R value. |
required |
a |
float64
|
The correction factor to use when calculating the R value. |
required |
Returns:
Type | Description |
---|---|
float64
|
The R value for the input array of values and correction factor. |
Source code in cssfinder/reports/math.py
display_short_report
¶
Display short report.