python-neo icon indicating copy to clipboard operation
python-neo copied to clipboard

Block.filter and Segment.filter should do use "OR" but "AND" by default

Open samuelgarcia opened this issue 6 years ago • 2 comments

@JuliaSprenger @mdenker @Kleinjohann

Block.filter and Segment.filter should do use "OR" but "AND" by default.

It is more natural when you do a query to have a list of condition linked by "AND". For instance: data_type='lfp' AND quality == 'good'.

What Block.filter(targetdict=dict(data_type='lfp', quality == 'good'`)) do is data_type='lfp' OR quality == 'good'. I think this is not very intuitive.

The AND statement in filter(...) is implemented with a list of taretdict. I found this very consufing.

For intsance neo.utils.get_events do more or less the same thing have an intinsinct AND by default.

This make the Segment.filter and neo.utils.get_events inconsistent.

What do you think ?

samuelgarcia avatar Nov 05 '19 13:11 samuelgarcia

Suggestion from @mdenker that we add a keyword argument to choose between AND and OR, set to OR by default for backwards compatibility, but with a deprecation warning that the default will change.

apdavison avatar Jul 07 '20 12:07 apdavison