Skip to content

Conversation

@cbishop4
Copy link
Collaborator

@cbishop4 cbishop4 commented Sep 4, 2024

Hackathon final push for Bijal's AR work.

Copy link
Collaborator Author

@cbishop4 cbishop4 left a comment

Choose a reason for hiding this comment

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

All looks solid; on to testing

img (xarray): xarray to work on
chi (numeric): q about which slice should be centered, in deg
chi_width (numeric): width of slice in each direction, in deg
def slice_chi(self, chi, chi_width=5, do_avg: bool = True):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Couldn't the handling on this be greatly simplified by making use of the _reRange_chi function later? Or is there a reason we don't want to do that?

print(f' Pol 0: {pol0}')
print(f' Pol 90: {pol90}')'''

def _reRange_chi(self, chi):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As somewhat noted above, I think this could maybe be applied more to other functions to greatly simplify them. @pbeaucage , are you married to the "nshift" handling within the slice_chi function? It might be easier to just take everything and anytime you're trying to index chi, you just change those things you're trying to index with to valid values

if (AR_para < AR_perp).all() or (AR_perp < AR_para).all():
warnings.warn('One polarization has a systematically higher/lower AR than the other. Typically this indicates bad intensity values.',stacklevel=2)
# User wants to infer chi centers from beam polarization metadata
if infer_chi_from_pol == True:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Elegant, I like it

Copy link
Collaborator Author

@cbishop4 cbishop4 left a comment

Choose a reason for hiding this comment

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

All looks good with tests

@delongchamp
Copy link
Collaborator

Had a conversation with @pbeaucage about the failing test_AR_unity - looking to refactor that now.

@pbeaucage pbeaucage changed the title 133 feat generalize ar calculations chi center polarizations reflections Generalized, polarization aware anisotropic ratio Apr 1, 2025
@pbeaucage
Copy link
Collaborator

@delongchamp I'm going thru stale PRs and I think (think) the only thing this is hung on is a validation that we expect A of a perfect sine wave to be 0.31478. I feel like you came to a conclusion on an analytical solution to this during the code camp; any chance this survived? Or if enough of us bless that as a heuristic solution, then we can just do that... I'm not picky.

@delongchamp
Copy link
Collaborator

@pbeaucage I'm sorry to be the holdup here but I really want to give this one a more thorough review. IT's difficult to strike a balance between flexibility - calculating A with different strategies such as single, multiple polarization and potentially accomodating biaxiality, and transparency, letting the user know how A is/was calculated.

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.

feat: generalize AR calculations, chi center, polarizations, reflections

5 participants