curvature#

Calculate various curvature metrics for traces.

Attributes#

Functions#

angle_diff_signed(v1, v2)

Calculate the signed angle difference between two point vecrtors in 2D space.

discrete_angle_difference_per_nm_circular(...)

Calculate the discrete angle difference per nm along a trace.

discrete_angle_difference_per_nm_linear(...)

Calculate the discrete angle difference per nm along a trace.

calculate_curvature_stats_image(→ None)

Perform curvature analysis for a whole image of grains.

Module Contents#

curvature.LOGGER#
curvature.angle_diff_signed(v1: numpy.typing.NDArray[numpy.float64], v2: numpy.typing.NDArray[numpy.float64])#

Calculate the signed angle difference between two point vecrtors in 2D space.

Positive angles are clockwise, negative angles are counterclockwise.

Parameters:
  • v1 (npt.NDArray[np.float64]) – First vector.

  • v2 (npt.NDArray[np.float64]) – Second vector.

Returns:

The signed angle difference in radians.

Return type:

float

curvature.discrete_angle_difference_per_nm_circular(trace_nm: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]#

Calculate the discrete angle difference per nm along a trace.

Parameters:

trace_nm (npt.NDArray[np.float64]) – The coordinate trace, in nanometre units.

Returns:

The discrete angle difference per nm.

Return type:

npt.NDArray[np.float64]

curvature.discrete_angle_difference_per_nm_linear(trace_nm: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]#

Calculate the discrete angle difference per nm along a trace.

Parameters:

trace_nm (npt.NDArray[np.float64]) – The coordinate trace, in nanometre units.

Returns:

The discrete angle difference per nm.

Return type:

npt.NDArray[np.float64]

curvature.calculate_curvature_stats_image(topostats_object: topostats.classes.TopoStats) None#

Perform curvature analysis for a whole image of grains.

Curvature statistics are added to the Molecule.curvature_stats attribute of the traces that are being processed.

Parameters:

topostats_object (TopoStats) – TopoStats object with attribute grain_crop. Should be post-splining.