Converting amplitudes between polarization models#98
Open
nkhusid wants to merge 3 commits intomaxisi:mainfrom
Open
Converting amplitudes between polarization models#98nkhusid wants to merge 3 commits intomaxisi:mainfrom
nkhusid wants to merge 3 commits intomaxisi:mainfrom
Conversation
Owner
|
great! a few requests:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new method, get_generic_amplitude(), in result.py to convert amplitudes from the aligned model to those of the generic model by integrating the angular factors.
- Added get_generic_amplitude() method
- Converts aligned model "A" values to generic model amplitudes by computing angular factors
- Validates input by checking for the existence of the "cosi" key in the posterior data
Comments suppressed due to low confidence (1)
ringdown/result.py:976
- Consider adding a docstring for get_generic_amplitude() to describe its purpose, input expectations, and returned output for future maintainability.
def get_generic_amplitude(self):
| cosi = self.posterior.cosi.values | ||
| swsh = utils.swsh.construct_sYlm(-2, mode.l, mode.m) | ||
| ylm_p = swsh(cosi) | ||
| ylm_m = swsh(-cosi) |
There was a problem hiding this comment.
Ensure that the shapes of ylm_p, ylm_m, and C are consistent for element-wise multiplication to avoid broadcasting issues; consider asserting or documenting the expected dimensions.
Suggested change
| ylm_m = swsh(-cosi) | |
| ylm_m = swsh(-cosi) | |
| # Assert shape consistency | |
| assert C.shape == ylm_p.shape == ylm_m.shape, ( | |
| f"Shape mismatch: C.shape={C.shape}, ylm_p.shape={ylm_p.shape}, ylm_m.shape={ylm_m.shape}" | |
| ) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For the aligned polarization model, the$\enspace_{-2}Y_{\ell m} \enspace$ are factored out of the mode amplitudes, whereas no constraints on polarizations (the generic model) allows us to absorb the angular factors into the intrinsic mode amplitudes. I have written a method in
Aparameter is different from that of the generic model; when enforcing equatorial plane symmetry (the aligned model), the angular factorsresult.pycalledget_generic_amplitude()which converts theAoutputted by the aligned model into that of the generic model.