APIο
pyEulerCurves moduleο
- class pyEulerCurves.ECC_from_bitmap(*args: Any, **kwargs: Any)ο
Bases:
TransformerMixin,BaseEstimatorTransformer that computes the Euler Characteristic Curve (ECC) from a bitmap image using cubical complexes.
This transformer is compatible with scikit-learn pipelines and interprets the input as a binary or grayscale bitmap, computing the ECC based on connected components formed by cubical cells (voxels or pixels).
- Parameters:
periodic_boundary (bool or list of bool, default=False) β Specifies whether to use periodic boundary conditions in each spatial dimension. If a list is provided, it must match the number of dimensions of the bitmap.
workers (int, default=1) β Number of parallel workers to use for computing local contributions.
- n_features_ο
Number of features (flattened bitmap size) seen during fit.
- Type:
int
- contributions_listο
List of local Euler characteristic contributions computed from the bitmap.
- Type:
list of np.ndarray
- number_of_simplicesο
Estimated total number of cells (0D to top-dimensional) in the cubical complex.
- Type:
int
Initialize the ECC_from_bitmap transformer.
- Parameters:
periodic_boundary (bool or list of bool, default=False) β Whether to apply periodic boundary conditions in each dimension.
workers (int, default=1) β Number of parallel workers.
- fit(X, y=None)ο
Fit the transformer to the input bitmap.
- Parameters:
X ({array-like, sparse matrix}, shape (n_samples, n_features)) β The training input samples, typically flattened bitmap arrays.
y (None) β Ignored. This parameter exists for compatibility with scikit-learn pipelines.
- Returns:
self β Fitted transformer.
- Return type:
object
- transform(X)ο
Compute the Euler Characteristic Curve (ECC) from bitmap images.
- Parameters:
X ({array-like, sparse matrix}, shape (n_samples, n_features)) β Flattened input bitmaps. Each row is treated as a bitmap image.
- Returns:
ecc β A list of [filtration_value, Euler_characteristic] pairs representing the ECC computed from the bitmap.
- Return type:
list of [float, int]
- class pyEulerCurves.ECC_from_pointcloud(*args: Any, **kwargs: Any)ο
Bases:
TransformerMixin,BaseEstimatorTransformer that computes Euler Characteristic Curves (ECCs) from a point cloud using Vietoris-Rips or Alpha filtrations.
This transformer is compatible with scikit-learn pipelines and computes local contributions to the Euler characteristic, assembling them into a global ECC.
- Parameters:
epsilon (float, default=0) β Threshold parameter for Vietoris-Rips filtration. Controls the scale at which simplices are created.
max_dimension (int, default=-1) β Maximum homology dimension to consider. If set to -1, all dimensions are used.
workers (int, default=1) β Number of worker processes to use in parallel computation.
complex_type ({'VR', 'alpha'}, default='VR') β Type of simplicial complex used for ECC computation. Use βVRβ for Vietoris-Rips and βalphaβ for Alpha complex.
dbg (bool, default=False) β If True, enables debug output for internal steps.
measure_times (bool, default=False) β If True, records timing information for different steps of the computation.
- n_features_ο
Number of features seen during fit.
- Type:
int
- contributions_listο
Local Euler characteristic contributions for each sample.
- Type:
list of np.ndarray
- num_simplices_listο
Number of simplices used in each ECC computation.
- Type:
list of int
- largest_dimension_listο
Largest homology dimension computed for each point cloud.
- Type:
list of int
- timesο
If measure_times is True, contains the durations of computations.
- Type:
list of float
- num_simplicesο
Total number of simplices over all samples.
- Type:
int
Initialize the ECC_from_pointcloud transformer.
- Parameters:
epsilon (float, default=0) β Vietoris-Rips filtration scale parameter.
max_dimension (int, default=-1) β Maximum homology dimension to consider.
workers (int, default=1) β Number of parallel workers.
complex_type ({'VR', 'alpha'}, default='VR') β Type of simplicial complex used to compute ECCs. Choose βVRβ for Vietoris-Rips or βalphaβ for Alpha complex.
dbg (bool, default=False) β Enable debug output.
measure_times (bool, default=False) β Enable timing measurement.
- fit(X, y=None)ο
Fit the transformer on input data X.
- Parameters:
X ({array-like, sparse matrix}, shape (n_samples, n_features)) β The training input samples.
y (None) β Ignored. This parameter exists for compatibility with scikit-learn pipelines.
- Returns:
self β Fitted transformer.
- Return type:
object
- transform(X)ο
Compute the Euler Characteristic Curve (ECC) for the given point cloud(s).
- Parameters:
X ({array-like, sparse matrix}, shape (n_samples, n_features)) β The input point cloud data. Each row corresponds to a single point cloud.
- Returns:
ecc β A list of [filtration_value, Euler_characteristic] pairs representing the Euler Characteristic Curve computed from the entire dataset.
- Return type:
list of [float, int]
- pyEulerCurves.difference_ECC(ecc1, ecc2, max_f)ο
Compute the L1 distance between two Euler Characteristic Curves (ECCs) up to a maximum filtration value.
- Parameters:
ecc1 (list of [float, int]) β First ECC as a list of [filtration, EC].
ecc2 (list of [float, int]) β Second ECC as a list of [filtration, EC].
max_f (float) β The maximum filtration value to consider.
- Returns:
difference β The total L1 distance between the two ECCs over [0, max_f].
- Return type:
float
- pyEulerCurves.plot_euler_curve(e_list, this_ax=None, with_lines=False, **kwargs)ο
Plot an Euler Characteristic Curve (ECC).
- Parameters:
e_list (list of [float, int]) β The ECC to plot, as a list of [filtration, Euler characteristic] pairs.
this_ax (matplotlib.axes.Axes, optional) β Axes object to draw the plot onto. If None, uses current Axes.
with_lines (bool, default=False) β If True, draws step-style horizontal and vertical lines between points.
**kwargs (dict) β Additional keyword arguments passed to matplotlib scatter.
- Returns:
this_ax β The matplotlib axes containing the plot.
- Return type:
matplotlib.axes.Axes