coonfit.helper#
Utility functions for the coonfit regression workflow.
This module provides supporting functions used during predictor validation and data quality assessment. It includes tools for detecting rank-deficient predictor matrices (which would cause the normal equations to be singular) and for counting the number of usable pixels within a boolean selector mask.
Functions#
|
Check if matrix is rank deficient and identify problematic columns. |
|
Count the number of usable pixels determined by the selector. |
|
Print the fraction of usable pixels. |
Module Contents#
- coonfit.helper.check_rank_deficiency(array, return_by_issue_type=False)[source]#
Check if matrix is rank deficient and identify problematic columns.
Returns a dictionary with column indices (key) and issue description (value). An empty dictionary indicates that no rank deficiency was detected.
- Parameters:
array (NDArray) – Matrix to check for rank deficiency
return_by_issue_type (bool, optional) – If True, returns nested dictionary separating issues by type: {“linear_dependent”: […], “all_zero”: […]}
- Returns:
Problematic columns and their issues. Uses
numpy.linalg.matrix_rank()to determine the rank of the array.- Return type:
See also
get_XT_X_dependency()Check predictors for linear dependency.
- coonfit.helper.usable_pixels_count(selector)[source]#
Count the number of usable pixels determined by the selector.
- Parameters:
selector (NDArray) – Boolean array where True indicates a usable pixel and False indicates a pixel to be excluded
- Returns:
Number of True values in the selector array (count of usable pixels). Uses
numpy.unique()to count occurrences.- Return type:
See also
usable_pixels_info()Print the fraction of usable pixels.
Examples
>>> selector = np.array([True, True, False, True, False]) >>> usable_pixels_count(selector) 3
- coonfit.helper.usable_pixels_info(all_pixels, data_pixels)[source]#
Print the fraction of usable pixels.
- Parameters:
- Return type:
None
See also
usable_pixels_count()Count the number of usable pixels.
Examples
>>> usable_pixels_info(1000, 750) Of all_pixels=1000 there are data_pixels=750, i.e. 75.0% are usable