persist_spatial.smoothed_expression

Functions

distance_to_measure_point(→ float)

Computes the dtm at a single point.

distance_to_measure_weighted(→ numpy.ndarray)

Computes the distance to measure at each point.

Module Contents

persist_spatial.smoothed_expression.distance_to_measure_point(weights: numpy.ndarray, distances: numpy.ndarray, m: float) float

Computes the dtm at a single point.

Given a sorted vector of probability masses and squared distances to the neighbours of a single point, computes the distance to measure at that point. To be called on by smoothed_expression.distance_to_measure_weighted().

Parameters:
  • weights (np.ndarray) – Probability masses at neighbour points, pre sorted by increasing distance from central vertex.

  • distances (np.ndarray) – Squared distances to neighbour vertices, in increasing order.

  • m (float) – Threshold probability mass to compute distance to. Should lie in (0,1).

Returns:

Distance to measure at input point.

Return type:

float

persist_spatial.smoothed_expression.distance_to_measure_weighted(weights: numpy.ndarray, dmat: numpy.ndarray, m: float) numpy.ndarray

Computes the distance to measure at each point.

Given a vector of expression weights, a well-well distance matrix, and an ordered list of distances from the central vertex in a radial network, computes the distance to measure at each vertex. Designed to be called upon by compute_persistence.run_persistence()

Parameters:
  • weights (np.ndarray) – Expression in each well, should be normalised to sum to 1. Dimensions n_wells x 1

  • dmat (np.ndarray) – Well-well distance matrix where dmat[i,j] = d(well_i, well_j). Dimensions n_wells x n_wells

  • network_distances (np.ndarray) – Sorted array of distances from a central well to its nearest neighbour wells, distances[i] = d(central vertex, ith nearest other vertex). Dimensions n_wells x 1.

  • m (float) – Probability mass threshold to use in distance to measure calculations. Should lie in (0,1).

Returns:

Distance to measure at each well. Dimensions n_wells x 1.

Return type:

np.ndarray