-
Notifications
You must be signed in to change notification settings - Fork 33
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
New URLConfig protocols - list-to-array and list-to-dict #1104
New URLConfig protocols - list-to-array and list-to-dict #1104
Conversation
@LuisSanchez25 thanks for this PR, I think its important to mention that these protocols can be used independently from xedocs and describe them in a generic manner in the comments and naming within the code. |
I made a few changes including comments. All that is missing are tests. |
Tests also fail because of:
I'll change the testing to fix this |
github closed this PR by accident but the failing tests should be resolved in #1105 |
Thanks @JoranAngevaare ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the changes I requested already.
@JoranAngevaare any comments before we merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only smaller suggestions, if you like any of them, you can add them but this state is already good. Thanks!
Co-authored-by: Joran R. Angevaare <joranangevaare@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good!
…gurations
Before you submit this PR: make sure to put all operations-related information in a wiki-note, a PR should be about code and is publicly accessible
What does the code in this PR do / what does it improve?
This code enables the user to change the format of the output of the url-protocol, some corrections require dictionaries while others require arrays. In Xedocs all of the data is stored in lists therefore this transformation stage is necessary to enable us to change the format of the output to a dictionary or an array.
Can you briefly describe how it works?
It works by taking the output of the URLConfig and depending on the added field changing the output from a list to either a dictionary with keys or an array.
Can you give a minimal working example (or illustrate with a figure)?
This code reprocesses some XENONnT data using a correction stored in xedocs
import cutax
import xedocs as xd
run_id = '047493'
st_xd = cutax.contexts.xenonnt_online()
st_xd.set_config({"rel_extraction_eff":"objects-to-dict://xedocs://"
"rel_extraction_effs"
"?version=v!&context=staging_db&run_id=047122&partition=['ab','cd']&key_attr=partition&value_attr=value"})
kr_ei_xd = st_xd.get_array(run_id, 'event_info')
Please include the following if applicable:
Notes on testing
All italic comments can be removed from this template.