-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix targetting class to be neuron compatible #898
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good addition, just some optimization problems. You create intermediary lists and use N^2 lookup where you probably don't need it
if (model := by_name.get(model_name)) is not None: | ||
ps_ids = list(simdata.placement[model].load_ids()) | ||
ids_here = [ps_ids.index(ids_i) for ids_i in ids if ids_i in ps_ids] | ||
dict_target[model] = simdata.populations[model][ids_here] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this piece of code supposed to do? It's written very inefficiently, if I understand the input/output relation perhaps we can optimize it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, my understanding of ByIdTargetting
is that it should select those cell models with (global) id as in ids
.
Originally ids
was used as index in the subpopulation of each simdata
: simdata.populations[model][ids]
(kind of local id).
Here ps_ids
has the cellmodel ids of that specific simdata
, then ids_here
finds whether and where any of the ids
that we are looking for is in ps_ids
(like np.where).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give a numeric example with let's say 3 or 4 elements per array so I can visualize the transformation?
shortcut Co-authored-by: Robin De Schepper <[email protected]>
Describe the work done
CellTypeFilter
whenget_targets()
method is called.