pyfibre.model.tools.fibre_utilities module

pyfibre.model.tools.fibre_utilities.branch_angles(direction, branch_vector, branch_r)[source]
pyfibre.model.tools.fibre_utilities.check_2D_arrays(array1, array2, thresh=1)[source]

Returns indices where values of array1 are within thresh distance of array2

Parameters
  • array1 (array_like) – Array to be inspected

  • array2 (array_like) – Array to be inspected, does not need to be same size as array1

  • thresh (int, optional) – Threshold distance to return the corresponding array indices

Returns

  • array1_indices (array_like of int) – Indices of array1 that meet threshold critera

  • array2_indices (array_like of int) – Indices of array2 that meet threshold critera

pyfibre.model.tools.fibre_utilities.cos_sin_theta_2D(vector, r_vector)[source]

Returns cosine and sine of angles of intersecting vectors between even and odd indices

Parameters
  • vector (array_like, (float); shape=(n_vector, n_dim)) – Array of displacement vectors between connecting beads

  • r_vector (array_like, (float); shape=(n_vector)) – Array of radial distances between connecting beads

Returns

  • cos_the (array_like (float); shape=(n_vector/2)) – Cosine of the angle between each pair of displacement vectors

  • sin_the (array_like (float); shape=(n_vector/2)) – Sine of the angle between each pair of displacement vectors

  • r_prod (array_like (float); shape=(n_vector/2)) – Product of radial distance between each pair of displacement vectors

pyfibre.model.tools.fibre_utilities.distance_matrix(node_coord)[source]

Calculate distances between each index value of node_coord

pyfibre.model.tools.fibre_utilities.get_edge_list(graph, max_degree=2)[source]

Get a list of edges between nodes that contain less that max_degree edges

pyfibre.model.tools.fibre_utilities.get_node_coord_array(graph)[source]

Return a numpy array containing xy attributes of all nodes in graph

pyfibre.model.tools.fibre_utilities.get_node_degree_array(graph)[source]

Return a numpy array containing number of edges for each node in graph

pyfibre.model.tools.fibre_utilities.new_branches(image, coord, ring_filter, max_thresh=0.2)[source]

Find local maxima in image within max_thresh of coord, excluding pixels in ring filter

pyfibre.model.tools.fibre_utilities.reduce_coord(coord, weights=None, thresh=1)[source]

Find elements in coord that lie within thresh distance of each other. Remove element with lowest corresponding value.

Parameters
  • coord (array_like) – Set of pixel coordinates to assess

  • weights (array_like, optional) – Importance weights corresponding to each coordinate. If undefined, all coordinates are considered equally

  • thresh (int, optional) – Minimum pixel distance required between coordinates

pyfibre.model.tools.fibre_utilities.remove_redundant_nodes(network, r_thresh=2)[source]

Reduces any two nodes that are within r_thresh distance of each other down to one, by transferring any edges on the least connected node to the most connected node before removing the least connected node

pyfibre.model.tools.fibre_utilities.simplify_network(network)[source]

Simplify all linear sections of network by removing nodes containing 2 degrees

pyfibre.model.tools.fibre_utilities.transfer_edges(network, source, target)[source]

Transfer edges from source node to target