Skip to content

Comments

New Coalignment API#293

Open
nabobalis wants to merge 126 commits intosunpy:mainfrom
nabobalis:coalign_pr
Open

New Coalignment API#293
nabobalis wants to merge 126 commits intosunpy:mainfrom
nabobalis:coalign_pr

Conversation

@nabobalis
Copy link
Member

@nabobalis nabobalis commented Nov 18, 2025

Since I lack write access now, I copied #207 here.

This should be squash merged

Fixes #302 by removing it. I didn't fix anything with anything else.

Deus1704 and others added 30 commits June 12, 2024 17:31
few fixes in refs

fixing the refs
importing funcs

testing import

i think final

final nail

explicit imports
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
Co-authored-by: Nabil Freij <nabil.freij@gmail.com>
@wtbarnes wtbarnes mentioned this pull request Jan 9, 2026
7 tasks
@wtbarnes
Copy link
Member

wtbarnes commented Feb 12, 2026

I do not understand why this changelog check is failing...

Most of the other test fails are fixed by #301

@nabobalis nabobalis requested a review from wtbarnes February 12, 2026 06:24
@nabobalis
Copy link
Member Author

I do not understand why this changelog check is failing...

I think since there are two and one is not for this PR.

@wtbarnes
Copy link
Member

I do not understand why this changelog check is failing...

I think since there are two and one is not for this PR.

Ah I didn't realize that other one got modified.

@Cadair Cadair added the No Changelog Entry Needed Skip all changelog checks. label Feb 18, 2026
Copy link
Member

@Cadair Cadair left a comment

Choose a reason for hiding this comment

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

This looks really good.

One general thing is that spacing around operators is chaotic in this PR.

]


class AffineParams(NamedTuple):
Copy link
Member

Choose a reason for hiding this comment

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

mostly out of curiosity. Why NamedTuple here rather than say dataclass?

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason, would you prefer a dataclass?

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to a dataclass.


.. note::

This function is intended to correct maps with inaccurate metadata.
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth explaining here that this only handles affine transform like modification of the metadata?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure

Comment on lines +124 to +128
# Particularly for this method, there is no change in the rotation or scaling,
# hence the hardcoded values of scale to 1.0 & rotation to identity matrix
scale = np.array([1.0, 1.0])
rotation_matrix = np.eye(2)
return AffineParams(scale=scale, rotation_matrix=rotation_matrix, translation=(x_shift, y_shift))
Copy link
Member

Choose a reason for hiding this comment

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

This is a more concrete example of my comment about NamedTuple vs something else. Something else could have defaults of unity for everything? (Is explicit better though? maybe?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not fussed.

Copy link
Member

Choose a reason for hiding this comment

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

🤷‍♂️ I don't have a strong opinion here. We could always switch to using a dataclass later on.

Comment on lines 3 to 12
.. automodapi:: sunkit_image.coalignment.match_template

.. automodapi:: sunkit_image.coalignment.phase_cross_correlation

.. automodapi:: sunkit_image.coalignment.interface
:no-inheritance-diagram:
:skip: coalign

.. automodapi:: sunkit_image.coalignment.register
:no-heading:
Copy link
Member

Choose a reason for hiding this comment

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

These have the wrong heading levels, they should be sub-headings to sunkit_image.coalignment.

Copy link
Member Author

Choose a reason for hiding this comment

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

I revamped the entire reference section instead

Copy link
Member

Choose a reason for hiding this comment

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

This looks way better to me. Thanks!

]

# Global Dictionary to store the registered methods and their names
REGISTERED_METHODS = {}
Copy link
Member

Choose a reason for hiding this comment

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

This probably isn't thread-safe 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

How would we make it thread safe?

Copy link
Member

Choose a reason for hiding this comment

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

No idea, but we should probably at least track it. Maybe Albert has some ideas given his work on sunpy.

Comment on lines 55 to 60
# NOTE: Currently, the only metadata updates that are supported are shifts in
# the reference coordinate. Once other updates are supported, this check can be removed.
if not (affine_params.rotation_matrix == np.eye(2)).all():
raise NotImplementedError('Changes to the rotation metadata are currently not supported.')
if not (affine_params.scale == np.array([1,1])).all():
raise NotImplementedError('Changes to the pixel scale metadata are currently not supported.')
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 open an issue for this? and document that they are currently unsupported? Also edit these error messages to tell people that they should come ask us about them if they have a use for them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a message to open an issue with a link.

@nabobalis
Copy link
Member Author

I handled the rename and updating the api docs.
When we are ok with these changes, I plan to ruff format the PR/repo

@@ -1 +1,7 @@
Granule Detection (`sunkit_image.granule`)
Copy link
Member

Choose a reason for hiding this comment

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

This one is mislabeled. It should be STARA.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@nabobalis
Copy link
Member Author

Looks like tox update decided to break things.

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

Labels

No Changelog Entry Needed Skip all changelog checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revert numpy pin in testing Add a coalignment example to the gallery Refactor the coalignment module

4 participants