dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
22 stars 16 forks source link

CylindricalTargetting origin should be a numpy array #890

Closed drodarie closed 1 month ago

drodarie commented 1 month ago

Currently the origin parameter of CylindricalTargetting is a list[float]. However, its get_targets function use it as a numpy array (line 200):

[...]
simdata.placement[model].load_positions()[:, axes] - self.origin**2, # <- exponential operation does not work here.
[...]

I suggest to change origin type to a numpy array.

origin: np.ndarray[float] = config.attr(type=types.ndarray(dtype=float))

Also the filtering of the cells is not performed correctly: the axis to sum the distances should be 1 instead of 0 line 198:

np.sum(
    simdata.placement[model].load_positions()[:, axes] - self.origin**2,
    axis=1,
)