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.
We could add a "se.Locations" object that stores locations for Model and Brain objects
return lambda x: x.update_locs(self.locs)
Overall, this could serve to consolidate and organize many of the helper functions under a common object.