fractopo.analysis.parameters module

Analysis and plotting of geometric and topological parameters.

fractopo.analysis.parameters.branches_intersect_boundary(branch_types: ndarray) ndarray

Get array of if branches have E-component (intersects target area).

fractopo.analysis.parameters.convert_counts(counts: dict[str, float | int | Real]) dict[str, int]

Convert float and int value in counts to ints only.

Used by branches and nodes count calculators.

fractopo.analysis.parameters.counts_to_point(counts: dict[str, int], is_nodes: bool, scale: int = 100) tuple[float, float, float] | None

Create ternary point from node_counts.

The order is important: for nodes: X, I, Y and for branches: CC, II, CI.

fractopo.analysis.parameters.decorate_branch_ax(ax: Axes, tax: TernaryAxesSubplot, counts: dict[str, int])

Decorate ternary branch plot.

fractopo.analysis.parameters.decorate_count_ax(ax: Axes, tax: TernaryAxesSubplot, label_counts: dict[str, int], is_nodes: bool)

Decorate ternary count plot.

fractopo.analysis.parameters.decorate_xyi_ax(ax: Axes, tax: TernaryAxesSubplot, counts: dict[str, int])

Decorate xyi plot.

fractopo.analysis.parameters.determine_branch_type_counts(branch_types: ndarray, branches_defined: bool) dict[str, float | int | Real]

Determine branch type counts.

fractopo.analysis.parameters.determine_node_type_counts(node_types: ndarray, branches_defined: bool) dict[str, float | int | Real]

Determine node type counts.

fractopo.analysis.parameters.determine_set_counts(set_names: Sequence[str], set_array: ndarray) dict[str, int]

Determine counts in for each set.

fractopo.analysis.parameters.determine_topology_parameters(trace_length_array: ndarray, area: float, branches_defined: bool, correct_mauldon: bool, node_counts: dict[str, float | int | Real] | None, branch_length_array: ndarray | None) dict[str, float]

Determine geometric (and topological) parameters.

Number of traces (and branches) are determined by node counting.

The passed trace_length_array should be non-weighted.

fractopo.analysis.parameters.initialize_ternary_ax(ax: Axes, tax: TernaryAxesSubplot) dict

Decorate ternary ax for both XYI and branch types.

Returns a font dict for use in plotting text.

fractopo.analysis.parameters.initialize_ternary_branches_points(ax, tax)

Initialize ternary branches plot ax and tax.

fractopo.analysis.parameters.initialize_ternary_points(ax: Axes, tax: TernaryAxesSubplot)

Initialize ternary points figure ax and tax.

fractopo.analysis.parameters.plot_branch_plot_ax(counts: dict[str, int], label: str, tax: TernaryAxesSubplot, color: str | None = None)

Plot ternary branch plot to tax.

fractopo.analysis.parameters.plot_parameters_plot(topology_parameters_list: list[dict[str, float]], labels: list[str], colors: list[str] | None = None)

Plot topological parameters.

fractopo.analysis.parameters.plot_set_count(set_counts: dict[str, int], label: str) tuple[Figure, Axes]

Plot set counts.

fractopo.analysis.parameters.plot_ternary_plot(counts_list: list[dict[str, int]], labels: list[str], is_nodes: bool, colors: list[str | None] | None = None) tuple[Figure, Axes, TernaryAxesSubplot]

Plot ternary plot.

Same function is used to plot both XYI and branch type ternary plots.

fractopo.analysis.parameters.plot_xyi_plot_ax(counts: dict[str, int], label: str, tax: TernaryAxesSubplot, color: str | None = None)

Plot XYI pointst to given ternary axis (tax).

fractopo.analysis.parameters.tern_plot_branch_lines(tax)

Plot line of random assignment of nodes to branches to a branch ternary tax.

Line positions taken from NetworkGT open source code. Credit to: https://github.com/BjornNyberg/NetworkGT

Parameters:

tax (ternary.TernaryAxesSubplot) – Ternary axis to plot to

fractopo.analysis.parameters.tern_plot_the_fing_lines(tax: TernaryAxesSubplot, cs_locs: tuple[float, ...] = (1.3, 1.5, 1.7, 1.9))

Plot connections per branch parameter to XYI-plot.

If not using the pre-determined locations the texts will not be correctly placed as they use absolute positions and labels.

Parameters:
  • tax – Ternary axis to plot to.

  • cs_locs – Pre-determined locations for the lines.

fractopo.analysis.parameters.tern_yi_func(c, x)

Plot Connections per branch threshold line to branch ternary plot.

Uses absolute values.

fractopo.analysis.parameters.ternary_heatmapping(x_values: ndarray, y_values: ndarray, i_values: ndarray, number_of_bins: int, scale_divider: float = 1.0, ax: Axes | None = None) tuple[Figure, TernaryAxesSubplot]

Plot ternary heatmap.

Modified from: https://github.com/marcharper/python-ternary/issues/81

fractopo.analysis.parameters.ternary_point_kwargs(alpha=1.0, zorder=4, s: float = 25, marker='X')

Plot point to a ternary figure.

fractopo.analysis.parameters.ternary_text(text: str, ax: Axes)

Add ternary text about counts.