fix: Fix targetting class to be neuron compatible#898
Conversation
Helveg
left a comment
There was a problem hiding this comment.
Good addition, just some optimization problems. You create intermediary lists and use N^2 lookup where you probably don't need it
shortcut Co-authored-by: Robin De Schepper <robin.deschepper93@gmail.com>
There was a problem hiding this comment.
The ByIdTargetting is inefficient:
- It uses
if ids in ps_idsN times, with inside of itps_ids.index~> O(2 * n^2). This will explode and never finish if someone copies a list of 1000 cell ids into a 100k cell simulation. - It's conceptually going roundabout: it relies on
ps.load_idswhich takes the chunk local ids and combines it with the chunk stats and expands them into global ids, to then look up the position of a global id in the expanded global ids, to then arrive back at the local id.
The fundamental task here is to take an array of global ids and to express it in local ids of a given PS. This is a missing piece of logic it seems (@drodarie could you look through the PS/CS and ConnectivitySetIterator interface classes and bsb-hdf5.. I feel like I wrote this already).
If you want to implement this efficiently, you would have to write a new piece of logic in bsb-hdf5 and/or NeuronPopulation that uses the PlacementSets chunks, and the chunk_stats and uses simple arithmetics to calculate the local id of each global id. @drodarie could you help Danilo piece this together?
|
With this commit i will use a method, that i've added to bsb-hdf5, to convert global ids into local ids. |
Describe the work done
CellTypeFilterwhenget_targets()method is called.