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

133 feat generalize ar calculations chi center polarizations reflections #147

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

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?

@@ -161,6 +484,434 @@ def collate_AR_stack(sample,energy):
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.

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
4 participants