fact-project / aict-tools

Reproducible Artificial Intelligence for Cherenkov Telescopes
MIT License
6 stars 6 forks source link

Support more complex conditions in apply cuts #114

Open maxnoe opened 4 years ago

maxnoe commented 4 years ago
maxnoe commented 4 years ago

Maybe also using pandas eval or numexpr directly for this like in the feature generation is a good idea

LukasNickel commented 4 years ago

Wouldn't this be a use case for pandas query? https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.query.html#pandas.DataFrame.query

LukasNickel commented 4 years ago

How would the configuration syntax for the logical or conditions look like anyway? I think the current syntax might be to limited for that. We could (if we go with eval/query) go for something like:

selection:
    - intensity > 50
    - num_islands < 5
    - width > 0 and width < 10
    - telescope == 'LST' or telescope == 'MST'
    - run == 1 or run == 5

This way every line equals one boolean expression and all of them are joined with a logical and.

But maybe there is a better, backwards compatible way?