diff --git a/examples/meta.yaml b/examples/meta.yaml index fec7514..1ecf494 100644 --- a/examples/meta.yaml +++ b/examples/meta.yaml @@ -3,17 +3,11 @@ # Folder-level metadata that applies to all plots in this folder title: "Analysis Results" -description: "Comprehensive analysis of ttbar events in Run 2 data" +description: "ttbar" experiment: "CMS" dataset: "Run2_2016_nano_v9" analysis_type: "ttbar_analysis" -# Author information -author: - name: "Klaus Schmidt" - email: "kschmidt@example.com" - institution: "Example University" - # Analysis parameters that apply to all plots in this folder parameters: luminosity: "35.9 fb^-1" diff --git a/orchestration/metadata.py b/orchestration/metadata.py index a8b64d3..d7c993d 100644 --- a/orchestration/metadata.py +++ b/orchestration/metadata.py @@ -31,7 +31,7 @@ def load_metadata_file(metadata_path: Path) -> Dict[str, Any]: """ if not metadata_path.exists(): return {} - + try: with metadata_path.open('r', encoding='utf-8') as f: suffix_lower = metadata_path.suffix.lower() @@ -63,12 +63,14 @@ def load_folder_metadata(folder_path: Path) -> Dict[str, Any]: metadata_path = folder_path / filename if metadata_path.exists(): return load_metadata_file(metadata_path) - + return {} -def merge_metadata(parent_metadata: Dict[str, Any], - child_metadata: Dict[str, Any]) -> Dict[str, Any]: +def merge_metadata( + parent_metadata: Dict[str, Any], + child_metadata: Dict[str, Any] +) -> Dict[str, Any]: """ Merge parent and child metadata, with child values overriding parent values. @@ -85,9 +87,10 @@ def merge_metadata(parent_metadata: Dict[str, Any], return merged -def resolve_metadata_for_plot(plot_path: Path, - inherited_metadata: Dict[str, Any] - ) -> Dict[str, Any]: +def resolve_metadata_for_plot( + plot_path: Path, + inherited_metadata: Dict[str, Any] +) -> Dict[str, Any]: """ Resolve metadata for a specific plot by merging inherited metadata with plot-specific metadata. @@ -101,21 +104,22 @@ def resolve_metadata_for_plot(plot_path: Path, """ plot_stem = plot_path.stem plot_dir = plot_path.parent - + # Check for plot-specific metadata files for suffix in ['.yaml', '.yml', '.json']: plot_metadata_path = plot_dir / f"{plot_stem}{suffix}" if plot_metadata_path.exists(): plot_metadata = load_metadata_file(plot_metadata_path) return merge_metadata(inherited_metadata, plot_metadata) - + # No plot-specific metadata found, return inherited metadata return inherited_metadata.copy() -def save_metadata_cache(web_dir: Path, - plot_metadata_cache: Dict[str, Dict[str, Any]] - ) -> None: +def save_metadata_cache( + web_dir: Path, + plot_metadata_cache: Dict[str, Dict[str, Any]] +) -> None: """ Save plot metadata cache to meta_cache.json in the web directory. diff --git a/templates/gallery.html b/templates/gallery.html index a0ee24c..8ee0e5e 100644 --- a/templates/gallery.html +++ b/templates/gallery.html @@ -41,7 +41,7 @@ {{ item.name }} -
{{ item.name }}