-
Notifications
You must be signed in to change notification settings - Fork 14
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
Make in-place selections the default for data access #175
Comments
Is this still sth we want to achieve, so shall we move this to a dedicated project @pantaray ? |
I'm not sure, to be honest. That's probably something we should play around with a little to decide if it even makes sense. So I don't see any current project this really fits in well. |
Ok then I'll put it into our 'nice-to-have eventually' project ;) |
Or what about returning the What we havedata.selectdata(toilim=[0, 1], in_place=True)
# access selected times of 1st trial
data.time[0][data.selection.time[0]] Proposalmy_selection = data.selectdata(toilim=[0, 1], in_place=True)
# access selected times of 1st trial
my_selection.time[0] I think that could be a nice interface, at least for our own post-processing like plotting, what u think @pantaray? EDIT: We also have # this is a `Selector` object
selector = data.selection
# however setting does not work
data.selection = selector
>>> AttributeError: 'Selector' object has no attribute 'keys' For things like storing/reverting selections an explicit setter which accepts |
I'm not sure I fully understand the proposal. Doing something like |
So storing and reverting selections now got addressed by simply memorizing the initial # now modify and re-apply selection
select = data.selection.select.copy()
select['trials'] = fit_trl_idx
data.selectdata(select, inplace=True) work without any known problems. The next step me and @dfsp-spirit discussed is the EDIT: |
- preparation for plugging an Indexer into Selector.trials - might be a good idea to also have a `trial_ids` property in base_data actually - addresses #175
- Indexer indices are relative to the selected trials - not sure if the Indexer itself works as really expected - addresses #175 Changes to be committed: modified: syncopy/datatype/base_data.py
With the new idx = dataobject.selection.freq
# index selection, only one `freq` for all trials
freq = dataobject.freq[idx] This is not suitable for the public API of course. |
We should consider deprecating public in-place selections (but keep them in the dev API, of course). Currently we do not find a strong argument to keep them. |
Explore UI/UX options to have in-place selections be present "inherently" by injecting the selection in all relevant property getters. For instance, if
data
contains 128 channels, 92 of which are selected (in-place), thendata.channel.size == 92
. It might be a good idea to issue aSPYInfo
message every time a property is accessed with an active in-place selection attached.The text was updated successfully, but these errors were encountered: