ContextLab / ContextLab/supereeg

Locations class

Open
#153 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
38
Forks
19
PR merge metrics
No merged PRs in 30d

Description

We could add a "se.Locations" object that stores locations for Model and Brain objects
- We could attach some convenience functions to the object (e.g. automatically store the unique locations, do sorting, support indexing, etc.)
- We could also attach "mapping" functions: e.g. locs.get_mapper() would return a function that accepts a model or brain object (with any locations) and returns a new model (or brain) with the same locations as Locations. This would be something like: `return lambda x: x.update_locs(self.locs)`
- We could also easily add (crude) support for Nifti objects by adding an update_locs to Nifti objects (just convert to a brain object, then call update_locs, then convert back to a nifti object). Then all main SuperEEG datatypes would be supported.
- This would make mapping between different models convenient– e.g. using one subject's model to make predictions about someone else's data. We could also provide pickled functions (if pickle supports functions) that take any model, brain object, or nifti object, and convert it to a pre-specified set of locations (e.g. the set of locations in the standard 2mm MNI brain). This could be convenient for generating figures.
- Other convenience functions:
- locs.merge(new_locs): add in a new set of locations, sort, and compute the unique rows
- locs.n_locs: return self.shape[0] (no longer need to have a separate n_locs field)
- comparison or matching functions (e.g. returning indices where one Location object's locations match another's). This could be useful for indexing brain and model objects.
- locs.is_subset(x): return True if and only if the locations in self.locs are all contained in x.locs
- locs.is_superset(x): return True if and only if the locations in x.locs are all contained in self.locs

Overall, this could serve to consolidate and organize many of the helper functions under a common object.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names Model, Brain, and Nifti objects but identifies no files or tests. First map their existing location handling and update_locs helpers, then resolve the intended Locations API from the proposed merge, mapping, matching, subset, and indexing behavior. Done means an agreed, tested abstraction covering the supported object types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.