Generalise the framework beyond jets to arbitrary global objects - #156
Conversation
Several stages assumed the literal "jets" group instead of the configured jets_name, breaking object-agnostic preprocessing for non-"jets" object names. - split_containers: use config.jets_name for batch access; pass jets_name to the H5Reader/H5Writer calls that previously defaulted to "jets". - rw_merge: use config.jets_name for attr_to_write and variables keys; thread jets_name through do_merge_with_weights into its H5Reader/H5Writer. - reweight: pass jets_name to the input H5Reader and the fallback all_vars key. - download_and_prepare: pass jets_name to the metadata H5Reader. Add an end-to-end integration test (and fixture) that renames the mock object group to "objects" and runs split -> weights -> merge with jets_name: objects, asserting the output uses "objects" and no hardcoded "jets" group remains. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Docs preview: https://umami-hep.github.io/umami-preprocessing/pr-156/ |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
==========================================
- Coverage 95.38% 95.34% -0.05%
==========================================
Files 24 24
Lines 2298 2318 +20
==========================================
+ Hits 2192 2210 +18
- Misses 106 108 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
If we assume it work with |
I would love to, but we need to make the changes upstream in Edit: I mis-read what you actually ask for. I implemented it as good as possible, but this will break backward compatibility. |
Generalise the framework beyond jets: the config key that names the main
per-object dataset is renamed from jets_name to global_name, along with all
internal attributes/parameters and the {jets_name} ylabel placeholder.
The external ftag H5Reader/H5Writer keyword (jets_name=) and reader.jets_name
attribute are kept as-is, since they belong to the ftag library API; call
sites now pass jets_name=<config>.global_name.
Breaking change: existing configs must rename the global: jets_name key to
global_name. All in-repo configs, docs, tests and the {global_name} ylabel
placeholder are updated accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dkobylianskii
left a comment
There was a problem hiding this comment.
If we want to make it general, it's better to clean all jet references in the code now (except atlas-ftag-tools dependence)
For backward compatibility with old configs we could add a small helper in the config parsing, that will map |
Rename every jet-named config option and code identifier in UPP to object-agnostic global_object names (e.g. num_jets -> num_global_objects, equal_jets -> equal_global_objects, .jets -> .global_objects, add_jet_vars -> add_global_vars, add_jet_flavour_label -> add_global_object_label, unique_jets -> unique_global_objects, jet_counts -> global_object_counts), addressing the PR #156 review. Old configs keep working: PreprocessingConfig.from_file recursively remaps deprecated keys to their new names on load and warns. The atlas-ftag-tools boundary is left untouched: ftag H5Reader/H5Writer keyword args (jets_name=, equal_jets=, num_jets=), reader/writer attributes (reader.num_jets, estimate_available_jets, get_attr("unique_jets")), the h5 data-format attribute strings, and physics flavour names (bjets/cjets/taujets/ghost*). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Done in 98d956a. Every jet-named config option and code identifier is now object-agnostic ( |
Added. |
Align with the object-agnostic ftag H5Reader/H5Writer API and rename the remaining jet-named touchpoints: ftag kwargs/attributes (jets_name, num_jets, equal_jets, estimate_available_jets) and the output h5 metadata attribute strings (num_jets, unique_jets, jet_counts) to their global_object equivalents.
Restore the jet-flavoured default variable labels in _default_variable_labels (pt/eta/mass), and rename the remaining N_Jets sample-check log label to N_Objects.
Derive the output h5 metadata attribute names from global_name instead of hardcoding them, so a config with global_name=jets again writes unique_jets / num_jets / jets_counts (restoring backward compatibility for jet datasets), while a custom name yields unique_<name> / num_<name> / <name>_counts.
|
I updated atlas-ftag-tools and puma in here. Now the removal of |
dkobylianskii
left a comment
There was a problem hiding this comment.
Thanks @afroch , it's a nice step towards generalization.
However, we are still depend on flavours in configs, so it won't work with anything except jets
Rename the user-facing settings flavour_config -> class_config, flavour_category -> class_category and the per-component flavours -> classes across the config schema, in-repo configs and tests. Old keys are remapped on load via LEGACY_KEY_MAP so existing configs keep working with a deprecation warning. Internal flavour identifiers and the flavour_label output attribute are unchanged.
class_config is annotated Path | None, so it was skipped by the Path resolution loop in __post_init__ and, unlike other path fields, resolved against the CWD instead of base_dir. Resolve it against base_dir like vds_dir so a relative class_config next to the config is found.
Add a Custom classes section to the configuration docs describing the class definition yaml schema and how class_config generalises the framework beyond jets. Add an end-to-end reweighting test that renames the mock object group and drives the pipeline with a custom class_config (relative path) defining non-standard classes, asserting the output carries the custom class labels.
|
@dkobylianskii you're right that the config previously spoke only in jet-flavour terms. This is now addressed: Custom classes for any object type. The class definitions are no longer tied to the atlas-ftag-tools bundled jet flavours — point Renamed the settings to match. To drop the jet-flavour framing, the three user-facing options are now Documented + proven end-to-end. There's a new Custom classes section in the config docs, and a The one thing intentionally left as-is is the |
nikitapond
left a comment
There was a problem hiding this comment.
This seems like a pretty simple MR - just renaming jets to global_object to make it more easily understandable when used outside of flavour/jet tagging work. I've looked through the code briefly, but as its mainly just a renaming and tests pass so I'm approving.
Summary
This pull request introduces the following changes
jetsgroup and silently broke with a custom nameglobal_objectnames (jets_name→global_name,num_jets→num_global_objects,equal_jets→equal_global_objects,add_jet_vars→add_global_vars,add_jet_flavour_label→add_global_object_label, …)H5Reader/H5WriterAPI is now object-agnostic (global_objects_name,num_global_objects,equal_global_objects)global_name:unique_<name>,num_<name>,<name>_counts— soglobal_name: jetsstill writesunique_jets/num_jets, keeping downstream readers workingbjets,cjets, …), the default object name (jets) and the defaultJet …plot labels unchangedRelates to the following issues
Conformity