sunkit-image
sunkit-image copied to clipboard
Would it be better to notify the users that `calculate_solar_rotate_shift` and `mapsequence_coalign_by_rotation` mainly work on SDO cutout data?
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.
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 byxshift_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.
Thanks for the reply! I really appreciate that these bugs can be fixed!
Given that we have now removed these methods, I'm going to close this. Those looking for equivalent functionality should use this functionality in sunpy: https://docs.sunpy.org/en/stable/generated/gallery/differential_rotation/reprojected_map.html#sphx-glr-generated-gallery-differential-rotation-reprojected-map-py