fractopo.analysis.anisotropy module

Anisotropy of connectivity determination utilities.

fractopo.analysis.anisotropy.determine_anisotropy_classification(branch_classification)

Return value based on branch classification.

Only C-C branches have a value, but this can be changed here. Classification can differ from ‘C - C’, ‘C - I’, ‘I - I’ (e.g. ‘C - E’) in which case a value (0) is still returned.

Parameters:

branch_classification (str) – Branch classification string.

Return type:

int

Returns:

Classification encoded as integer.

E.g.

>>> determine_anisotropy_classification("C - C")
1
>>> determine_anisotropy_classification("C - E")
0
fractopo.analysis.anisotropy.determine_anisotropy_sum(azimuth_array, branch_types, length_array, sample_intervals=array([0, 30, 60, 90, 120, 150]))

Determine the sums of branch anisotropies.

Parameters:
  • azimuth_array (ndarray) – Array of branch azimuth values.

  • branch_types (ndarray) – Array of branch type classication strings.

  • length_array (ndarray) – Array of branch lengths.

  • sample_intervals (ndarray) – Array of the sampling intervals.

Return type:

Tuple[ndarray, ndarray]

Returns:

Sums of branch anisotropies.

E.g.

>>> from pprint import pprint
>>> azimuths = np.array([20, 50, 60, 70])
>>> lengths = np.array([2, 5, 6, 7])
>>> branch_types = np.array(["C - C", "C - C", "C - C", "C - I"])
>>> pprint(determine_anisotropy_sum(azimuths, branch_types, lengths))
(array([ 8.09332329, 11.86423103, 12.45612765,  9.71041492,  5.05739707,
        2.15381611]),
 array([  0,  30,  60,  90, 120, 150]))
fractopo.analysis.anisotropy.determine_anisotropy_value(azimuth, branch_type, length, sample_intervals=array([0, 30, 60, 90, 120, 150]))

Calculate anisotropy of connectivity for a branch.

Based on azimuth, branch_type and length. Value is calculated for preset angles (sample_intervals = np.arange(0, 179, 30))

E.g.

Anisotropy for a C-C classified branch:

>>> determine_anisotropy_value(50, "C - C", 1)
:rtype: :sphinx_autodoc_typehints_type:`\:py\:class\:\`\~numpy.ndarray\``
array([0.64278761, 0.93969262, 0.98480775, 0.76604444, 0.34202014,

0.17364818])

Other classification for branch:

>>> determine_anisotropy_value(50, "C - I", 1)
array([0, 0, 0, 0, 0, 0])
fractopo.analysis.anisotropy.plot_anisotropy_ax(anisotropy_sum, ax, sample_intervals=array([0, 30, 60, 90, 120, 150]))

Plot a styled anisotropy of connectivity to a given PolarAxes.

Spline done with: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html

fractopo.analysis.anisotropy.plot_anisotropy_plot(anisotropy_sum, sample_intervals)

Plot anisotropy values to new figure.

Return type:

Tuple[Figure, Axes]