Spatial
lineagetree.measure
¶
Functions:
| Name | Description |
|---|---|
compute_k_nearest_neighbours |
Computes the k-nearest neighbors |
compute_spatial_density |
Computes the spatial density of nodes between |
compute_spatial_edges |
Computes the neighbors at a distance |
get_gabriel_graph |
Build the Gabriel graph of the given graph for time point |
compute_k_nearest_neighbours
¶
Computes the k-nearest neighbors
Writes the output in the attribute kn_graph
and returns it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
LineageTree
|
The LineageTree instance. |
required |
|
float
|
number of nearest neighours |
10
|
Returns:
| Type | Description |
|---|---|
dict mapping int to set of int
|
dictionary that maps
a node id to its |
dict mapping int to set of float
|
dictionary that maps
a node id to the distances of its |
Source code in src/lineagetree/measure/spatial.py
compute_spatial_density
¶
compute_spatial_density(
lT: LineageTree,
t_b: int | None = None,
t_e: int | None = None,
th: float = 50,
) -> dict[int, float]
Computes the spatial density of nodes between t_b and t_e.
The results is stored in lT.spatial_density and returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
LineageTree
|
The LineageTree instance. |
required |
|
int
|
starting time to look at, default first time point |
None
|
|
int
|
ending time to look at, default last time point |
None
|
|
float
|
size of the neighbourhood |
50
|
Returns:
| Type | Description |
|---|---|
dict mapping int to float
|
dictionary that maps a node id to its spatial density |
Source code in src/lineagetree/measure/spatial.py
compute_spatial_edges
¶
Computes the neighbors at a distance th
Writes the output in the attribute th_edge
and returns it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
LineageTree
|
The LineageTree instance. |
required |
|
float
|
distance to consider neighbors |
50
|
Returns:
| Type | Description |
|---|---|
dict mapping int to set of int
|
dictionary that maps a node id to its neighbors at a distance |
Source code in src/lineagetree/measure/spatial.py
get_gabriel_graph
¶
get_gabriel_graph(
lT: LineageTree, time: int | Iterable[int] | None = None
) -> dict[int, set[int]]
Build the Gabriel graph of the given graph for time point t.
The Garbiel graph is then stored in lT.Gabriel_graph and returned.
.. warning:: the graph is not recomputed if already computed, even if the point cloud has changed
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
LineageTree
|
The LineageTree instance. |
required |
|
int or Iterable of int
|
time or iterable of times. If not given the gabriel graph will be calculated for all timepoints. |
None
|
Returns:
| Type | Description |
|---|---|
dict of int to set of int
|
A dictionary that maps a node to the set of its neighbors |