Skip to content

feature merge for recent functionality#73

Merged
beykyle merged 38 commits intomainfrom
wip-elm
Feb 28, 2026
Merged

feature merge for recent functionality#73
beykyle merged 38 commits intomainfrom
wip-elm

Conversation

@beykyle
Copy link
Copy Markdown
Owner

@beykyle beykyle commented Aug 17, 2025

  • frame transformations for angle
  • Q Spin Rot Func param calculaton in for elastic
  • update notebooks and include them in testing

@beykyle beykyle changed the title add rxn functionality for angle frame transormation feature merge for recent functionality Feb 27, 2026
Copy link
Copy Markdown

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 merges recent scattering/xs functionality, including frame-angle conversion helpers, updated spin observables (adds spin-rotation parameter Q), and expands CI to run example notebooks as tests.

Changes:

  • Add spin-rotation observable Q to elastic differential cross-section calculations and adjust S/T-matrix element extraction.
  • Add Reaction.to_lab_frame() / Reaction.to_cm_frame() helpers and clarify kinematics docs.
  • Update CI to test notebooks and add notebook-related requirements/docs; various notebook/example updates and import cleanups.

Reviewed changes

Copilot reviewed 25 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/jitr/xs/elastic.py Adds Q to ElasticXS and computes Q in differential_elastic_xs; adjusts solver return handling.
src/jitr/xs/quasielastic_pn.py Updates spherical harmonic usage and fixes scalar extraction from S-matrix returns.
src/jitr/reactions/reaction.py Adds CM↔lab angle conversion helpers; adjusts absorption/gamma capture residual construction.
src/jitr/utils/kinematics.py Clarifies lab-frame definition in docstrings.
src/jitr/optical_potentials/wlh.py Tweaks sign convention for an absorptive parameter with explanatory comment.
requirements.txt Adds pytest requirement.
.github/workflows/python-package.yml Expands Python matrix and adds notebook execution tests.
README.md Documents notebook requirements and how to run notebook tests.
test/test_*.py Minor import/format cleanups in tests.
examples/*.py and examples/notebooks/* Notebook updates/additions and example script import cleanups; notebooks intended for CI testing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +531 to +567
def to_lab_frame(self, theta_cm: np.ndarray, Ecm: float, Q: float) -> np.ndarray:
"""
Convert angles from the center-of-mass frame to the laboratory frame
(target rest frame).
Args:
theta_cm (np.ndarray): Angles in the center-of-mass frame in degrees.
Ecm (float): Center-of-mass energy.
Q (float): Q-value of the reaction.
"""
return cm_to_lab_frame(
theta_cm,
self.projectile.m0,
self.target.m0,
self.product.m0,
self.residual.m0,
Ecm,
Q,
)

def to_cm_frame(self, theta_lab: np.ndarray, Elab: float, Q: float) -> np.ndarray:
"""
Convert angles from the laboratory (target rest frame) frame to the
center-of-mass frame.
Args:
theta_lab (np.ndarray): Angles in the laboratory frame in degrees.
Elab (float): Laboratory energy.
Q (float): Q-value of the reaction.
"""
return lab_to_cm_frame(
theta_lab,
self.projectile.m0,
self.target.m0,
self.product.m0,
self.residual.m0,
Elab,
Q,
)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

Reaction.to_lab_frame() / to_cm_frame() unconditionally dereference self.product and self.residual. For processes where either is None (e.g., tot, non, x, and possibly inl depending on configuration), calling these helpers will raise an AttributeError. Consider either (1) validating that product and residual are present and raising a clear ValueError, or (2) moving these methods to only reaction types where they are always defined (e.g., 2-body reactions).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to fix this, I like suggestion (1) this feedback

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 28, 2026

@beykyle I've opened a new pull request, #74, to work on those changes. Once the pull request is ready, I'll request review from you.

@beykyle beykyle merged commit d169faa into main Feb 28, 2026
4 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.

3 participants