Skip to content

parameterization

BoundaryParameterization

Bases: Parametrization, ABC

boundaries = boundaries instance-attribute

__init__(cycles, boundaries)

CycleBoundary

Bases: BoundaryParameterization

Using the boundaries calculated by BoundaryFilter, this class calculates for each cycle around which of the boundaries it is going.

compute()

Compute the boundaries for each cycle. Labels have values 0 to len(boundaries).

Returns:

Type Description
ndarray[int]

np.ndarray[int]: labels for each boundary

fit_plane(bnd)

For each cycle, project it to the best fitting 2D plane of the boundary.

Parameters:

Name Type Description Default
bnd Boundary

The boundary to be projected.

required

Returns:

Type Description
tuple

pd.series: the projected coordinates for each cycle.

tuple

np.ndarray: the centroid of the projected boundary.

runs_around_hole(point, vertices) staticmethod

Function to find if a 2D point is enclosed by a loop. It does this by first converting the 2D space into a complex plane. The x coordinates become the real parts and the y coordinates the imaginary parts. It then uses the residue theorem with the point as a pole. This will yield either 0 or 2pii. If it is 0, the point does not lie within the loop. residue > 6 is returned to account for rounding errors.

Parameters:

Name Type Description Default
point tuple[float, float]

2D point for which to test if the loop runs around it.

required
vertices tuple[float, float]

2D vertex coordinates of the loop.

required

Returns:

Name Type Description
bool bool

True if the point lies within the loop.

CycleCenter

Bases: Parametrization

Calculates the cycle center for each cycle.

weighted = False instance-attribute

__init__(cycles)

compute()

Compute the center of each cycle.

set_weighted(weighted=True)

CycleCv

Bases: Parametrization

Calculates the conduction velocity of a cycle

compute()

Cycles datagrame with

CycleIntersect

Bases: Parametrization

Calculates, for each cycle, if it intersects with itself.

compute()

Compute if a cycle intersects with itself.

CycleNormal

Bases: Parametrization

Calcualtes the normal vector for each cycle

compute()

CycleWindingNumber

Bases: BoundaryParameterization

Calculates the winding number of a cycle around a boundary. The winding number determines if a cycle loops around a point. If this is the case, the winding number is 2π, otherwise it's 0.

calculate_winding_number(vertices, point)

Calculates the winding number of a cycle around a point. The winding number is 2π if the cycle loops around the boundary and 0 outherwise

Parameters:

Name Type Description Default
vertices ndarray

2D coordinates of all vertices in the cycle.

required
point ndarray

2D coordinates of a point around which the winding number will be calculated.

required

Returns:

Name Type Description
float float

The winding number of the cycle.

compute()

Calculates the winding number of a cycle around a boundary. This number is within the interval [0, 2π]

For each boundary, a boundary different to itself is selected. Then, using this boundary's normal and centroid, the mesh is rotated such that its normal is along the z-axis. Next, the data is mapped (stretched out) onto a sphere. Finally, the data will be projected onto a plane.

This procedure prevents cycles looping around boundaries on differnt sides of the mesh to be detected as looping around both boundaries.

Returns:

Name Type Description
cycles DataFrame

Dataframe of cycles with an additional column 'winding number'.

Parametrization

Bases: ABC

Parameterization add properties to a cycle.

cycles = cycles instance-attribute

__init__(cycles)

compute() abstractmethod