Skip to content

Polarization correction #122

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

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

Polarization correction #122

wants to merge 58 commits into from

Conversation

jokasimr
Copy link
Contributor

@jokasimr jokasimr commented Feb 27, 2025

Polarization correction for ESTIA

Only important differences from #108 are in src/ess/estia/calibration.py: https://github.com/scipp/essreflectometry/pull/122/files#diff-df676f2a67f8251976ea2fcc161ea759d49deef6ef66c5adbf01d10665230077

Copy link
Member

Choose a reason for hiding this comment

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

Can we use esspolarization to perform the correction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now we can't because of scipp/esspolarization#84

When that is fixed we should be able to use esspolarization to do the correction.

Comment on lines 24 to 29
def _kronecker_product(A, B):
return [
[A[ia][ja] * B[ib][jb] for ja in range(2) for jb in range(2)]
for ia in range(2)
for ib in range(2)
]
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify why we cannot use np.kron?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 2D arrays containing DataArray are treated by np.kron as 3D arrays, and that makes the result different from what we want.

'''Corrects the intensities for imperfections of polarizing components'''
return _linsolve(self.polarization_matrix, Is)

def correct_intensities_and_normalize_by_reference(self, Is):
Copy link
Member

Choose a reason for hiding this comment

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

Still missing type hints in many places.

@jokasimr
Copy link
Contributor Author

jokasimr commented Jun 3, 2025

Requires scipp/esspolarization#91

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.

2 participants