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

Would it be better to notify the users that calculate_solar_rotate_shift and mapsequence_coalign_by_rotation mainly work on SDO cutout data? #186

Open
yjzhu-solar opened this issue Feb 21, 2024 · 2 comments

Comments

@yjzhu-solar
Copy link

Provide a general description of the issue or problem.

I am trying to use calculate_solar_rotate_shift and mapsequence_coalign_by_rotation to remove solar rotation in the Solar Orbiter EUI/HRI data. However, I found these functions are not designed to derotate the images except for SDO cutout data.

For example, in mapsequence_coalign_by_rotation, the xshift and yshift in arcsecs are converted to pixels by

xshift_keep[i] = xshift_arcseconds[i] / m.scale[0]
yshift_keep[i] = yshift_arcseconds[i] / m.scale[1]

which assumes a diagonal rotation matrix PC_ij. There are similar treatments in calculate_match_template_shift and mapsequence_coalign_by_match_template but they cancel each other.

In addition, the rotation shift in arcseconds is calculated by the difference between the coordinates of the reference layer center and the derotated map center,

new_coordinate = solar_rotate_coordinate(m.center, observer=rotate_to_this_layer.observer_coordinate, **kwargs)
xshift_arcseconds[i] = new_coordinate.Tx - rotate_to_this_layer.center.Tx
yshift_arcseconds[i] = new_coordinate.Ty - rotate_to_this_layer.center.Ty

and this only works when all maps in the sequence have the same center Tx and Ty. Considering the worst scenario that the center coordinates vary significantly along the latitudinal direction, then the routine will shift the image to compensate the solar rotation and the difference in Ty.

@ayshih
Copy link
Member

ayshih commented Feb 21, 2024

Thanks! Rather than any notification, we should fix these bugs:

For example, in mapsequence_coalign_by_rotation, the xshift and yshift in arcsecs are converted to pixels by

xshift_keep[i] = xshift_arcseconds[i] / m.scale[0]
yshift_keep[i] = yshift_arcseconds[i] / m.scale[1]

which assumes a diagonal rotation matrix PC_ij.

Yup, the code should use the PCij matrix.

In addition, the rotation shift in arcseconds is calculated by the difference between the coordinates of the reference layer center and the derotated map center,

new_coordinate = solar_rotate_coordinate(m.center, observer=rotate_to_this_layer.observer_coordinate, **kwargs)
xshift_arcseconds[i] = new_coordinate.Tx - rotate_to_this_layer.center.Tx
yshift_arcseconds[i] = new_coordinate.Ty - rotate_to_this_layer.center.Ty

and this only works when all maps in the sequence have the same center Tx and Ty.

Sure, and I think replacing rotate_to_this_layer.center.T... with m.center.T... should fix that.

@yjzhu-solar
Copy link
Author

Thanks for the reply! I really appreciate that these bugs can be fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants