-
Notifications
You must be signed in to change notification settings - Fork 270
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
Prefix containers #833
Prefix containers #833
Conversation
Codecov Report
@@ Coverage Diff @@
## master #833 +/- ##
==========================================
+ Coverage 73.52% 73.58% +0.06%
==========================================
Files 211 211
Lines 12066 12102 +36
==========================================
+ Hits 8871 8905 +34
- Misses 3195 3197 +2
Continue to review full report at Codecov.
|
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.
Very very useful feature, thank you @maxnoe.
The way I understand it, the user can change the prefix as he likes, right? |
Not really intended. The prefix is a class member of the container.
|
group_name, | ||
add_prefix=False, | ||
mode='w', | ||
root_uep='/', |
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.
what is a "uep" ?
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.
"The user entry point to the object tree attached to the HDF5 file is represented in the root_uep attribute". From http://www.pytables.org/usersguide/libref/file_class.html
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.
We want to get rid of root_uep
. We want to merge it with the group_name
.
This is definitely the behavior we need - the main use case is that we will have for example multiple image cleanings and multiple hillas parameterizations that will be stored in the output file, so we want to be able to change the prefix for each one. E.g. if you have multiple image cleanings, for example (loose and tight), you might have a dict inside your container like: cont.hillas['tight'] = hillas_parameters(...)
cont.hillas['loose'] = hillas_parameters(...) then you want to have outputs like:
I guess that functionality can be in addition to the one added here (both are useful - a global classname prefix, and an "instance" prefix) |
9e9c68c
to
2351a33
Compare
I updated this to enable instance level prefixes and moved the Containers now have a class variable Unfortunately this was not possible differently, since python does not allow class variables to initiliaze @kosack can you review again? |
Codecov Report
@@ Coverage Diff @@
## master #833 +/- ##
==========================================
+ Coverage 78.11% 78.21% +0.09%
==========================================
Files 185 185
Lines 10557 10593 +36
==========================================
+ Hits 8247 8285 +38
+ Misses 2310 2308 -2
Continue to review full report at Codecov.
|
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.
just minor change - don't use tempdir, rather pytest's fixture instead. Otherwise looks good.
* master: Major coordinate refactoring, fixes cta-observatory#899, cta-observatory#900, cta-observatory#505, cta-observatory#416 (cta-observatory#896) speed up is_compatible; makes event_source factory faster (cta-observatory#927) Prefix containers (cta-observatory#833) remove optional deps in order to fix tests (cta-observatory#925) Charge Resolution Update (cta-observatory#827) Remove serializer, fixes cta-observatory#887 (cta-observatory#913) deleted summary.html - accidentally committed file (cta-observatory#919) # Conflicts: # ctapipe/tools/extract_charge_resolution.py # examples/simple_event_writer.py
This allows writing multiple containers using a prefix for each column in the hdfwriter.
This enables writing duplicated keys (e.g.
ReconstructedShower.alt
,MCEvent.alt
).By default the prefix is
cls.__name__.lower().replace('Container', '')