naclib.util
Some useful functions for ST-polynomial decomposition.
By Edo van Veen @ Nynke Dekker Lab, TU Delft (2021)
- naclib.util.find_neighbours(locs0, locs1, threshold)
For each coordinate in locs0 (shape (N, 2)), find the nearest coordinate in locs1 (shape (M, 2)), within some threshold distance. Returns a np.array, with mapping_0to1[i] = j connecting a spot index i from locs0 to a spot index j from locs1. If no neighbor is found, j == -1.
- naclib.util.loc_to_unitcircle(locs_abs, fig_size, center=None, rescale=1)
Rescale locs_abs (shape (N, 2)) from pixel coordinates to unit circle coordinates, using the figure size fig_size (list of 2 ints). Optionally, a pixel location can be chosen manually to become the unit circle center, and an additional rescale factor can be given.
- naclib.util.make_pairs(locs0, locs1, mapping_0to1)
Using the mapping_0to1 map from find_neighbours(), make two ordered lists of spots. At each index i, locs0_pairs[i] and locs1_pairs[i] are neighbours.
- naclib.util.unitcircle_to_loc(locs, fig_size, center=None, rescale=1)
Rescale locs (shape (N, 2)) from unit circle coordinates to pixel coordinates, using the figure size fig_size (list of 2 ints). Optionally, a pixel location can be chosen manually for the unit circle center to transform to, and an additional rescale factor can be given.