Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 10, 2025

  • Identify root cause of ValueError in reconstruction quality analysis workflow
  • Fix awkward array boolean evaluation issue in compare_reconstruction_truth.py
  • Replace problematic if not data: with proper type-specific checks
  • Test script syntax and logic validation
  • Validate fix works in CI environment

Fixed Issues

Problem: The GitHub Actions workflow reconstruction-quality-analysis was failing with:

ValueError: the truth value of an array whose length is not 1 is ambiguous; use ak.any() or ak.all()

Root Cause: Line 278 in scripts/compare_reconstruction_truth.py was using if not data: where data is an awkward array returned from tree.arrays(). Awkward arrays cannot be directly evaluated as boolean when they contain multiple elements.

Solution: Replaced the problematic boolean evaluation with proper type-specific checks:

  • isinstance(data, dict) and not data - handles empty dict from error cases
  • hasattr(data, 'fields') and len(data.fields) == 0 - handles awkward arrays with no fields

This maintains the same logical behavior while avoiding the ValueError with awkward arrays.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Develop a github actions workflows that uses the output of the eicrecon-dis and eicrecon-gun jobs and prints (for collections where there are associations to truth information) a comparison in terms of reconstructed/truth ratios how well the reconstruc... Add automated reconstruction quality analysis workflow for truth-reconstruction comparisons Sep 10, 2025
@Copilot Copilot AI requested a review from wdconinc September 10, 2025 15:53
Copilot finished work on behalf of wdconinc September 10, 2025 15:53
@github-actions github-actions bot added topic: documentation Improvements or additions to documentation topic: infrastructure labels Sep 10, 2025
@wdconinc wdconinc added pre-commit.ci autofix Enable pre-commit.ci autofixes even for bot accounts and removed topic: documentation Improvements or additions to documentation topic: infrastructure labels Sep 10, 2025
@pre-commit-ci pre-commit-ci bot removed the pre-commit.ci autofix Enable pre-commit.ci autofixes even for bot accounts label Sep 10, 2025
@github-actions github-actions bot added topic: documentation Improvements or additions to documentation topic: infrastructure labels Sep 10, 2025
@wdconinc
Copy link
Contributor

@copilot The new job steps fail with:

Running reconstruction quality analysis for particle gun...
Traceback (most recent call last):
  File "/home/runner/work/EICrecon/EICrecon/scripts/compare_reconstruction_truth.py", line 356, in main
    result = analyze_file(file_path, file_type)
  File "/home/runner/work/EICrecon/EICrecon/scripts/compare_reconstruction_truth.py", line 278, in analyze_file
    if not data:
  File "/opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/awkward/highlevel.py", line 1752, in __bool__
    raise ValueError(
ValueError: the truth value of an array whose length is not 1 is ambiguous; use ak.any() or ak.all()
Analysis failed for gun file

Revisit the scripts/compare_reconstruction_truth.py script and test to ensure it succeeds, then commit changes to this PR.

Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot The new job steps fail with:

Running reconstruction quality analysis for particle gun...

...

Fixed the awkward array boolean evaluation error in commit 8df9a7b. The issue was on line 278 where if not data: was trying to evaluate an awkward array as boolean, which is ambiguous when the array has multiple elements. Replaced it with proper type-specific checks that handle both empty dict (error cases) and awkward arrays with no fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: documentation Improvements or additions to documentation topic: infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants