Geometry¶
Functions for parsing geometry data
-
yass.geometry.
find_channel_neighbors
(geom, radius)[source]¶ Compute a neighbors matrix by using a radius
Parameters: - geom: np.array
Array with the cartesian coordinates for the channels
- radius: float
Maximum radius for the channels to be considered neighbors
Returns: - numpy.ndarray (n_channels, n_channels)
Symmetric boolean matrix with the i, j as True if the ith and jth channels are considered neighbors
-
yass.geometry.
make_channel_groups
(n_channels, neighbors, geom)[source]¶ [DESCRIPTION]
Parameters: - n_channels: int
Number of channels
- neighbors: numpy.ndarray
Neighbors matrix
- geom: numpy.ndarray
geometry matrix
Returns: - list
List of channel groups based on [?]
-
yass.geometry.
make_channel_index
(neighbors, channel_geometry, steps=1)[source]¶ Compute an array whose whose ith row contains the ordered (by distance) neighbors for the ith channel
-
yass.geometry.
n_steps_neigh_channels
(neighbors_matrix, steps)[source]¶ Compute a neighbors matrix by considering neighbors of neighbors
Parameters: - neighbors_matrix: numpy.ndarray
Neighbors matrix
- steps: int
Number of steps to still consider channels as neighbors
Returns: - numpy.ndarray (n_channels, n_channels)
Symmetric boolean matrix with the i, j as True if the ith and jth channels are considered neighbors
-
yass.geometry.
order_channels_by_distance
(reference, channels, geom)[source]¶ Order channels by distance using certain channel as reference
Parameters: - reference: int
Reference channel
- channels: np.ndarray
Channels to order
- geom
Geometry matrix
Returns: - numpy.ndarray
1D array with the channels ordered by distance using the reference channels
- numpy.ndarray
1D array with the indexes for the ordered channels
-
yass.geometry.
parse
(path, n_channels)[source]¶ Parse a geometry txt (one x, y pair per line, separated by spaces) or a npy file with shape (n_channels, 2), where every row contains a x, y pair
- path: str
- Path to geometry file
- n_channels: int
- Number of channels
Returns: - numpy.ndarray
2-dimensional numpy array where each row contains the x, y coordinates for a channel
Examples
from yass import geometry
geom = geometry.parse(‘path/to/geom.npy’, n_channels=500) geom = geometry.parse(‘path/to/geom.txt’, n_channels=500)