How do I query multiple keywords linked with an AND in an EVTGEN dataset? I tried e.g. atom.match_metadata(field=‘keywords’, value=r"(?=.*top)(?=.*Alternative)")
atom.match_metadata(field=‘keywords’, value=(‘top’, ‘Alternative’))
atom.match_metadata(field=‘keywords’, value=[‘top’, ‘Alternative’]), but none of these worked.
Oooo, that’s a good question @rakhi . I don’t think we’re supporting that yet, but we could.
@gguerrie , what do you think? Regex support? Or just multiple keywords in a list / tuple? We’d just need a little special handling in atom, I think?
Best,
Zach
Ahoy!
Do you mind trying:
pip install git+https://github.com/atlas-outreach-data-tools/atlasopenmagic.git@gguerrie-match-multiple
And then doing:
import atlasopenmagic as atom
atom.match_metadata(field='keywords', value=['2electron', 'jets'])
[('700320', 'Sh_2211_Zee_maxHTpTV2_BFilter'), ('700321', 'Sh_2211_Zee_maxHTpTV2_CFilterBVeto'), ('700322', 'Sh_2211_Zee_maxHTpTV2_CVetoBVeto'), ('700358', 'Sh_2211_Zee2jets_Min_N_TChannel')]
This should give you the intersection.
If it’s ok, we can push it into prod.
Thanks for the quick response! Tried it but no dice (error message below)
Collecting git+https://github.com/atlas-outreach-data-tools/atlasopenmagic.git@gguerrie-match-multiple
Cloning
(to revision gguerrie-match-multiple) to /tmp/pip-req-build-gogdxkav
Running command git clone --filter=blob:none --quiet
/tmp/pip-req-build-gogdxkav
WARNING: Did not find branch or tag ‘gguerrie-match-multiple’, assuming revision or ref.
Running command git checkout -q gguerrie-match-multiple
error: pathspec ‘gguerrie-match-multiple’ did not match any file(s) known to git
error: subprocess-exited-with-error
× git checkout -q gguerrie-match-multiple did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× git checkout -q gguerrie-match-multiple did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Right, sorry about that.
We actually deleted that branch because now is already in the main one.
You should be able to run:
pip install git+https://github.com/atlas-outreach-data-tools/atlasopenmagic.git
And do the tests above.
Let us know!
1 Like
It works, fab!! Thanks!