-
Notifications
You must be signed in to change notification settings - Fork 272
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
Improved configuration of reference metadata #1889
Improved configuration of reference metadata #1889
Conversation
- Added user-defined CONTEXT metadata, which can be added to the config file - Made `metadata.Instrument` a configurable class similar to `metadata.Contact` so values can be overridden in config files The result is one can create a config file containing: ```yaml DataWriter: Instrument: site: CTA-North class_: Subarray id_: alpha version: Prod5b ``` And that information will be written to the file's reference headers: ```sh ctapipe-fileinfo output.h5 ... INSTRUMENT: CLASS: Subarray ID: alpha SITE: CTA-North SUBTYPE: unspecified TYPE: unspecified VERSION: Prod5b ... ```
Codecov Report
@@ Coverage Diff @@
## master #1889 +/- ##
==========================================
+ Coverage 92.04% 92.06% +0.02%
==========================================
Files 189 189
Lines 14842 14881 +39
==========================================
+ Hits 13661 13700 +39
Misses 1181 1181
Continue to review full report at Codecov.
|
This is true for |
True, so maybe I'll just stick with the underscores (since they are at least needed for the id column). It's not too bad. Or I could rename it |
so they appear in the help message (not perfect, but better than not appearing)
use case:
The user expects that the metadata in the output file's header is useful, for example to build a file catalog necessary to retrieve the data later.
what this PR adds:
Part of the reference metadata was already configurable (the Contact info), this adds two additional user-configurable parts:
Instrument
metadata (not to be confused with the InstrumentDescription, this is just id information about the instrument, in this case the subarray used). This lets the user set the subarray name, version, and other instrument-related attributes. If they are not specified, they are automatically filled as before (or left unspecified)CONTEXT
metadata, which is fully user-defined and allows an additional set of context-specific headers to be added as key-value pairs.changes
file
metadata.Instrument
a configurable class similar tometadata.Contact
so values can be overridden in config filesThe result is one can create a config file for a subarray definition like:
And that information will be written to the file's reference headers:
Similarly the arbitrary CONTEXT metadata can be set as follows:
Using spaces between keys allows a hierarchy (we could also support dots or similar)
This is useful for example for storing parameters that are not automatically read from the MC files into the
SimulationConfigContainer
, or for storing things like calibration versions, etc.Still todo:
issues
id_
andclass_
attributes have underscores to avoid linter/IDE complaints about python name conflicts (even if they do not conflict). This is a bit ugly, could consider removing them and just deal with complaints