Skip to content

Add reference frame support#1

Merged
MohamedElashri merged 2 commits intomainfrom
reference_frames
Apr 3, 2025
Merged

Add reference frame support#1
MohamedElashri merged 2 commits intomainfrom
reference_frames

Conversation

@MohamedElashri
Copy link
Owner

This PR introduce a new Frame class providing a comprehensive framework for relativistic reference frame transformations.

This will introduce the following methods for constructing frames

  • Frame.rest(): Create a stationary reference frame
  • Frame.from_lvec(): Create a frame in which a specified Lorentz vector is at rest
  • Frame.center_of_mass(): Create a center-of-mass frame from a collection of particles

And the following methods for frames transformations

  • LVec.to_frame(): Transform a vector directly to a specified reference frame
  • LVec.transform_frame(): Transform a vector between two explicit reference frames

And updating the docs to include the new frame with example about how it can be used.

@MohamedElashri MohamedElashri requested a review from Copilot April 3, 2025 18:50
@MohamedElashri MohamedElashri self-assigned this Apr 3, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new Frame class for handling relativistic reference frame transformations, including creating rest frames, constructing a frame from a Lorentz vector, and computing the center-of-mass frame. It also adds corresponding tests, updates documentation, and provides examples to illustrate these new features.

  • Adds a new Frame class with methods rest(), from_lvec(), and center_of_mass().
  • Implements transformation methods (to_frame and transform_frame) in LVec.
  • Updates tests, examples, and docs to demonstrate the new reference frame functionality.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lvec/tests/test_frame.py New tests validating proper Frame behavior and transformations
lvec/lvec.py Updated boost method and added to_frame and transform_frame methods
lvec/frame.py New Frame class implementation
lvec/init.py Exports Frame class
examples/README.md Updated example index to include reference frame usage
examples/10_reference_frames.py New example demonstrating reference frame creation and transformation
docs/README.md Documentation updated to include a section on reference frames
README.md Main documentation updated with code examples for Frame usage

Because I just forgot to reverse this

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@MohamedElashri MohamedElashri merged commit 81996cc into main Apr 3, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments