Skip to content
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

refactor: avoid addWhiteboardAlias in truth tracking examples #3936

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AJPfleger
Copy link
Contributor

@AJPfleger AJPfleger commented Dec 2, 2024

The aliases might be confusing in these examples, since they are redefining previously used names. This might be a bit clearer, which objects are used and makes it hopefully easier to understand the examples.

Summary by CodeRabbit

  • New Features

    • Updated handling of track data to use "selected-tracks" across various output writers for improved clarity and consistency in data processing.
  • Bug Fixes

    • Removed unnecessary whiteboard aliases to streamline the data flow in tracking functions.
  • Documentation

    • Method signatures updated for clarity, though core functionality remains unchanged.

@AJPfleger AJPfleger added the 🚧 WIP Work-in-progress label Dec 2, 2024
Copy link

coderabbitai bot commented Dec 2, 2024

Walkthrough

Changes made in the pull request focus on the runTruthTrackingGsf, runTruthTrackingGx2f, and runTruthTrackingKalman functions across three Python scripts. The primary modification involves updating the handling of track inputs, switching from "tracks" to "selected-tracks" for various output writers. This includes removing unnecessary whiteboard aliases and ensuring consistent data flow for track data management. The core logic and parameters of the functions remain unchanged, with the overall structure intact.

Changes

File Path Change Summary
Examples/Scripts/Python/truth_tracking_gsf.py Updated runTruthTrackingGsf to replace "tracks" with "selected-tracks" for several writers. Removed a whiteboard alias for "tracks".
Examples/Scripts/Python/truth_tracking_gx2f.py Updated runTruthTrackingGx2f to replace "tracks" with "selected-tracks" for writers. Removed aliasing for "tracks".
Examples/Scripts/Python/truth_tracking_kalman.py Updated runTruthTrackingKalman to replace "tracks" with "selected-tracks" for writers. Removed two whiteboard aliases.

Possibly related PRs

Suggested labels

Component - Examples, automerge, Track Finding

In the code, changes we see,
"Tracks" now "selected-tracks" be.
Writers updated, aliases gone,
A clearer path, the data's drawn.
Jedi wisdom in the flow,
Streamlined tracking, onward we go! 🌌✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AJPfleger AJPfleger added this to the next milestone Dec 2, 2024
@github-actions github-actions bot added the Component - Examples Affects the Examples module label Dec 2, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
Examples/Scripts/Python/truth_tracking_kalman.py (1)

Line range hint 126-164: A pattern of wisdom, established this has!

Across all three tracking implementations - GSF, GX2F, and Kalman - a consistent pattern now flows. Direct references to selected tracks, clarity they bring. Future maintainers, grateful they will be, hmm.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6cbf203 and 381b392.

📒 Files selected for processing (3)
  • Examples/Scripts/Python/truth_tracking_gsf.py (3 hunks)
  • Examples/Scripts/Python/truth_tracking_gx2f.py (3 hunks)
  • Examples/Scripts/Python/truth_tracking_kalman.py (3 hunks)
🔇 Additional comments (3)
Examples/Scripts/Python/truth_tracking_gsf.py (1)

126-126: Consistent use of selected tracks, approve I do!

Wise changes these are, hmm. Direct reference to "selected-tracks" now exists, matching the selector's output it does. Clarity this brings to the code's intent, yes.

Also applies to: 138-138, 149-149

Examples/Scripts/Python/truth_tracking_gx2f.py (1)

126-126: Harmonious changes across implementations, I sense!

Like its GSF companion, this file now speaks clearly of selected tracks. Consistency across the codebase, brought this has. Strong with the Force, these changes are!

Also applies to: 138-138, 149-149

Examples/Scripts/Python/truth_tracking_kalman.py (1)

142-142: Complete the circle, these changes do!

Like its siblings, this implementation now speaks of selected tracks directly. A path to clarity, this change creates. Removed the confusing aliases are, hmm.

Verify the removal of aliases and their impact, we must:

Also applies to: 154-154, 164-164

✅ Verification successful

Consistent and harmonious, these changes are!

In all three truth tracking implementations - Kalman, GSF, and GX2F - the same pattern of "selected-tracks" we see. No whiteboard aliases in these tracking files remain, hmm. A unified approach, this creates!

The Force shows us that other files still use addWhiteboardAlias, but for different purposes they do - simulation and reconstruction their domains are. Disturb them, these changes do not.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining addWhiteboardAlias usage in truth tracking examples
rg "addWhiteboardAlias" "Examples/Scripts/Python/truth_tracking_*.py"

# Verify consistent usage of selected-tracks
rg "selected-tracks" "Examples/Scripts/Python/truth_tracking_*.py"

Length of output: 304


Script:

#!/bin/bash
# First, find the correct path using fd
fd "truth_tracking_kalman.py"

# Search for any remaining addWhiteboardAlias usage in Python files
rg "addWhiteboardAlias" --type py

# Verify consistent usage of selected-tracks in Python files
rg "selected-tracks" --type py

Length of output: 4850

Copy link

github-actions bot commented Dec 2, 2024

📊: Physics performance monitoring for 381b392

Full contents

physmon summary

@andiwand
Copy link
Contributor

andiwand commented Dec 2, 2024

The main idea with reassigning "tracks" is that this is name is expected by downstream algorithms like ambisolver or vertexing. In principle these algorithms can also be run after one of the truth tracking chains

Copy link

sonarqubecloud bot commented Dec 2, 2024

@AJPfleger AJPfleger added 🚧 WIP Work-in-progress and removed 🚧 WIP Work-in-progress labels Dec 2, 2024
@AJPfleger
Copy link
Contributor Author

@andiwand oha, that seems useful 😊
I want to look a bit deeper into that, because we are aliasing quite frequently and at some places also use non-aliased variants like "kf_tracks". With my current knowledge, it seems, that "tracks" should/might point to the container after all updates, but should not be relied on. Do you remember any discussions in that direction, you could point me to?

@@ -73,7 +73,6 @@ def runTruthTrackingKalman(
outputParticles="particles_input",
)
)
s.addWhiteboardAlias("particles", "particles_input")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andiwand Do you remember if that alias is actually needed? We have it only in the KF but do not even use it here. Potentially, we should also add it to the other chains then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we were using "particles" in some downstream truth matching or simulation at some point. As far as I can see this should be "particles_selected" these days and "particles" might not be used anymore.

I think this is one of the paths in the script we never test?

@andiwand
Copy link
Contributor

andiwand commented Dec 3, 2024

@andiwand oha, that seems useful 😊 I want to look a bit deeper into that, because we are aliasing quite frequently and at some places also use non-aliased variants like "kf_tracks". With my current knowledge, it seems, that "tracks" should/might point to the container after all updates, but should not be relied on. Do you remember any discussions in that direction, you could point me to?

I think this was never officially discussed. I implemented that after facing several problems without aliases. My thought was that for examples "tracks" should hold the "most recent" version of all our tracks. So for example the KF fit would create "kf_tracks", then we point "tracks" to that and afterwards we select them and name it "selected_tracks" and again point "tracks" to that. With the idea being that any downstream algorithm which relies on tracks can just use "tracks" as a reference. This then works with an without selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module 🚧 WIP Work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants