2.3. ECT

class ect.ect.ECT(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.int32'>)[source]

A class to calculate the Euler Characteristic Transform (ECT) from an input EmbeddedComplex, using a set of directions to project the complex onto and thresholds to filter the projections.

The result is a matrix where entry M[i,j] is \(\chi(K_{a_i})\) for the direction \(\omega_j\) where \(a_i\) is the ith entry in self.thresholds, and \(\omega_j\) is the jth entry in self.directions.

num_dirs

The number of directions to consider in the matrix.

Type:

int

num_thresh

The number of thresholds to consider in the matrix.

Type:

int

directions

The directions to consider for projection.

Type:

Directions

bound_radius

Either None, or a positive radius of the bounding circle.

Type:

float

Example
>>> from ect import ECT, EmbeddedComplex
>>> from ect import EmbeddedGraph
>>> complex = EmbeddedComplex()
>>> complex.add_node(0, [0, 0])
>>> complex.add_node(1, [1, 0])
>>> complex.add_edge(0, 1)
>>> ect = ECT(num_dirs=10, num_thresh=10) # chooses 10 uniform directions and 10 thresholds
>>> result = ect.calculate(complex)
>>> result.plot()
__init__(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.int32'>)[source]

Initialize ECT calculator with either a Directions object or sampling parameters

Parameters:
  • directions – Optional pre-configured Directions object

  • num_dirs – Number of directions to sample (ignored if directions provided)

  • num_thresh – Number of threshold values (required if directions not provided)

  • bound_radius – Optional radius for bounding circle

  • thresholds – Optional array of thresholds

  • dtype – Data type for output array

calculate(graph, theta=None, override_bound_radius=None)[source]
class ect.sect.SECT(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.float32'>)[source]

A class to calculate the Smooth Euler Characteristic Transform (SECT). Inherits from ECT and applies smoothing to the final result.

__init__(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.float32'>)[source]

Initialize SECT calculator with smoothing parameter

Parameters:
  • directions – Optional pre-configured Directions object

  • num_dirs – Number of directions to sample (ignored if directions provided)

  • num_thresh – Number of threshold values (required if directions not provided)

  • bound_radius – Optional radius for bounding circle

  • thresholds – Optional array of thresholds

  • dtype – Data type for output array

calculate(graph, theta=None, override_bound_radius=None)[source]

Calculate Smooth Euler Characteristic Transform (SECT)

Parameters:
  • graph – The input graph to calculate the SECT for

  • theta – The angle in [0,2π] for the direction to calculate the SECT

  • override_bound_radius – Optional override for bounding radius

Returns:

The smoothed transform result containing the matrix,

directions, and thresholds

Return type:

ECTResult

class ect.dect.DECT(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.float32'>, scale=10.0)[source]

A class to calculate the Differentiable Euler Characteristic Transform (DECT)

__init__(directions=None, num_dirs=None, num_thresh=None, bound_radius=None, thresholds=None, dtype=<class 'numpy.float32'>, scale=10.0)[source]

Initialize DECT calculator

calculate(graph, scale=None, theta=None, override_bound_radius=None)[source]

Calculate Differentiable Euler Characteristic Transform (DECT)