branches

get_branch_index(edge_index, edge_degree[, branch_cutting_frequency=1000])

Finds the branch indexes for each branch in the MST.

Parameters
  • edge_index (array) – The node index of the ends of each edge.

  • edge_degree (array) – The degree for the ends of each edge.

  • branch_cutting_frequency (int) – An optimisation parameter, used to remove edges that have already been placed into a branch. This significantly improves the speed of the algorithm as branches that are already constructed are now removed from the branch finder.

Returns

Returns a tuple of the following:

  • branch_index (list) – A list of branches where each branch is a list of the edge index of edges contained in each branch.

  • branch_index_rejected (list) – A list of branches that have not been completed. This will occur only if a subset of the edge indexes of the full tree is provided.

get_branch_index_sub_divide(sub_divisions, edge_index, edge_degree[, box_size=None, edge_x=None, edge_y=None, edge_z=None, phi=None, theta=None, edge_phi=None, edge_theta=None, branch_cutting_frequency=1000, mode='Euclidean', two_dimension=True])

Finds the length of branches for large sets of data where a rapid increase in speed is achieved by subdividing the full data set and finding branches in each sub division and then completing branches that straddle across the divides.

Parameters
  • sub_divisions (int) – The number of divisions used to divide the data set in each axis. Used for speeding up the branch finding algorithm when using many points (> 100000).

  • edge_degree (array) – The degree for the ends of each edge.

  • edge_index (array) – The node index of the ends of each edge.

  • box_size (float) – The size of the ‘2D’ or ‘3D’ box. Of course, this is only applicable if the data was constructed inside a box.

  • edge_x (array) – The cartesian coordinates of the nodes at each end of every edge.

  • edge_y (array) – The cartesian coordinates of the nodes at each end of every edge.

  • edge_z (array) – The cartesian coordinates of the nodes at each end of every edge.

  • phi (array) – The longitude spherical coordinates of the nodes on the sphere.

  • theta (array) – The latitude spherical coordinates of the nodes on the sphere.

  • edge_phi – The longitude spherical coordinates of the nodes at each end of every edge.

  • edge_theta – The latitude spherical coordinates of the nodes at each end of every edge.

  • branch_cutting_frequency (int) – An optimisation parameter, used to remove edges that have already been placed into a branch. This significantly improves the speed of the algorithm as branches that are already constructed are now removed from the branch finder.

  • mode (str) – ‘2D’, ‘3D’ or assumed to be in spherical coordinates.

  • two_dimension (bool) – Determines whether the data set is 2D of 3D.

Returns

Returns a tuple of the following:

  • branch_index (list) – A list of branches where each branch is a list of the edge index of edges contained in each branch.

  • branch_index_rejected (list) – A list of branches that have not been completed. This will occur only if a subset of the edge indexes of the full tree is provided.

get_branch_end_index(edge_index, edge_degree, branch_index)

Gets the index of the nodes at the extreme end of each branch.

Parameters
  • edge_index (array) – The node index of the ends of each edge.

  • edge_degree (array) – The degree for the ends of each edge.

  • branch_index (list) – A list of branches where each branch is a list of the edge index of edges contained in each branch.

Returns

branch_end (array) – The index of the nodes at the ends of each branch.