-
Notifications
You must be signed in to change notification settings - Fork 0
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
updated npol_to_mzp transformation by inverting Eq 44 #158
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
==========================================
- Coverage 92.18% 91.65% -0.54%
==========================================
Files 9 9
Lines 550 551 +1
==========================================
- Hits 507 505 -2
- Misses 43 46 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments please. Overall, can you describe why this is an improvement over the existing function?
solpolpy/transforms.py
Outdated
if "Singular matrix" in str(err): | ||
raise ValueError("Conversion matrix is degenerate") | ||
else: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are you trying to raise here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the conversion matrix turns out to be singular and inversion could not be done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But you just have else: raise
without anything actually being raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the else condition in the new push
conv_matrix_inv = np.linalg.inv(conv_matrix) | ||
except np.linalg.LinAlgError as err: | ||
if "Singular matrix" in str(err): | ||
raise ValueError("Conversion matrix is degenerate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a custom error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is derived directly from IMAX module from @lowderchris
input_keys = list(input_collection.keys()) | ||
input_dict = {} | ||
in_list = list(input_collection) | ||
phi = [input_collection[key].meta['POLAR'] for key in input_keys if key != 'alpha']*u.degree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know phi comes from the paper, but it's a bit of an opaque name.
("Z", NDCube(Bmzp[0 * u.degree], wcs=input_collection[input_keys[0]].wcs, mask=mask, meta=metaZ)), | ||
("P", NDCube(Bmzp[60 * u.degree], wcs=input_collection[input_keys[0]].wcs, mask=mask, meta=metaP))] | ||
for p_angle in in_list: | ||
Bmzp_cube = [(key, NDCube(data_mzp_solar[:, :, i, 0], wcs=input_collection[input_keys[0]].wcs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like calling this a cube. It's a list of cubes.
PR summary
What does this PR introduce?
Modifies npol_to_mzp in transforms.py by inverting Eq 44 in DeForest et al (2022)