@@ -255,14 +255,18 @@ def calculate_displacement_unit_factor(
255255 non_rigid_gradient : float , unit_locations : np .array , drift_start_um : np .array , drift_stop_um : np .array
256256) -> np .array :
257257 """
258- In the case of introducing non-rigid drift, a set of scaling
259- factors (one per unit) is generated for scaling the displacement
260- as a function of unit position.
258+ Introduces a non-rigid drift across the probe, this is a linear
259+ scaling of the displacement based on the unit position.
260+
261+ To introduce non-rigid drift, a set of scaling factors (one per unit)
262+ are generated. These scale the displacement applied to each unit
263+ as a function of unit position. The smaller the `non_rigid_gradient`,
264+ the larger the influence of the unit position is on scaling the
265+ displacement (more non-linearity).
261266
262267 The projections of the gradient vector (x, y)
263268 and unit locations (x, y) are normalised to range between
264269 0 and 1 (i.e. based on relative location to the gradient).
265- These factors are scaled by `non_rigid_gradient`.
266270
267271 Parameters
268272 ----------
@@ -272,6 +276,7 @@ def calculate_displacement_unit_factor(
272276 that are based on unit location. This sets the weighting given to the factors
273277 based on unit locations. When 1, the factors will all equal 1 (no effect),
274278 when 0, the scaling factor based on unit location will be used directly.
279+ Smaller number results in more nonlinearity.
275280 unit_locations : np.array
276281 The unit location with shape (num_units, 2)
277282 drift_start_um : np.array
@@ -295,6 +300,7 @@ def calculate_displacement_unit_factor(
295300 factors = 1 - factors
296301
297302 f = np .abs (non_rigid_gradient )
303+ print ("f" , f )
298304 displacement_unit_factor = factors * (1 - f ) + f
299305
300306 return displacement_unit_factor
0 commit comments