Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

danilobenozzo
Copy link
Contributor

@danilobenozzo danilobenozzo commented Oct 31, 2024

Describe the work done

  • Add an option to get all global IDs with CellTypeFilter when get_targets() method is called.
  • Add spherical targetting per cell types.
  • ByIdTargetting fixed to use global IDs

@github-actions github-actions bot added the fix label Oct 31, 2024
Copy link
Contributor

@Helveg Helveg left a 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

bsb/simulation/targetting.py Outdated Show resolved Hide resolved
Comment on lines +167 to +170
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]
Copy link
Contributor

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.

Copy link
Contributor Author

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).

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants