ska-sa / katdal

Data access library for the MeerKAT radio telescope
BSD 3-Clause "New" or "Revised" License
12 stars 13 forks source link

scans don't apply multiple negated tags, or a mix including at least one negated tag, correctly #309

Open adriaanph opened 4 years ago

adriaanph commented 4 years ago

currently, select(scans=["~slew","~stop"]) does nothing. that's because the scan filters are ORed together. same with compscans.

the current behaviour is unexpected since it is reasonable to expect the rules of boolean algebra to apply, i.e. all un-negated tags get ORed while negated tags get ANDed with the rest.

the relevant code appears in katdal/dataset.py line 740, where negated tags are ORed. this OR could simply be changed to AND.

while one may go overboard with this issue and invent a syntax to support complicated sequences of ANDs and ORs, i propose that a reasonable user would be happy to accept that all un-negated tags are ORed together, before being ANDed with the negated tags.

ludwigschwardt commented 4 years ago

Why not just select(scans=['track', 'scan'])? Or is this trickier with compscans?

adriaanph commented 4 years ago

indeed, there are many work-arounds possible, but the issue remains.