You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When CircuitNodeIds is converted to a numpy array it turns into a (N, 2) array rather than an array of N unique identifiers.
This causes issues when using e.g. np.isin, np.intersect1d.
I propose defining a custom dtype https://numpy.org/devdocs/reference/arrays.dtypes.html with both population name and id contained within it. This does mean specifying a maximum number of bytes for the population names.
We could potentially have multiple dtypes occupying different amounts of space, allowing long population names to be recast to the longer version if necessary.
There may be a way to ensure that CircuitNodeIds are automatically converted to the appropriate dtype when np.array is called on them, though I am not aware of it.
Otherwise, I guess a .toarray() method would do.
I can implement this in the next month or two, if others think it is a good idea.
The text was updated successfully, but these errors were encountered:
CircuitNodeIds is converted to a numpy array it turns into
Interesting. When you say converted, do you mean np.array(some_node_ids), or implicitly like in np.isin(foo, some_node_ids) or in some other case? I think an example of what you're doing would be helpful.
When I do np.array(some_node_ids) I get an (N, 2) array.
when I use np.isin I just get strange results - explainable by isin interpereting the population names and ids as distinct values.
This comes up if I have some custom way of constraining a cell sample (e.g. relative position within a layer) and want to further restrict this by something else.
e.g. np.intersect1d(ids_in_depth_bin, martiotti_cells)
When CircuitNodeIds is converted to a numpy array it turns into a (N, 2) array rather than an array of N unique identifiers.
This causes issues when using e.g. np.isin, np.intersect1d.
I propose defining a custom dtype https://numpy.org/devdocs/reference/arrays.dtypes.html with both population name and id contained within it. This does mean specifying a maximum number of bytes for the population names.
We could potentially have multiple dtypes occupying different amounts of space, allowing long population names to be recast to the longer version if necessary.
There may be a way to ensure that CircuitNodeIds are automatically converted to the appropriate dtype when np.array is called on them, though I am not aware of it.
Otherwise, I guess a .toarray() method would do.
I can implement this in the next month or two, if others think it is a good idea.
The text was updated successfully, but these errors were encountered: