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

[FIX] _transform_plot_args was converting to degrees instead of coord_unit #14251

Merged
merged 3 commits into from Mar 30, 2023
Merged

[FIX] _transform_plot_args was converting to degrees instead of coord_unit #14251

merged 3 commits into from Mar 30, 2023

Conversation

nabobalis
Copy link
Contributor

Discovered this when trying to plot a coordinate using a gWCS.

I am unsure how to unit test this.

@Cadair Cadair added 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x labels Jan 4, 2023
@Cadair Cadair added this to the v5.0.6 milestone Jan 4, 2023
@Cadair
Copy link
Member

Cadair commented Jan 4, 2023

Thanks @nabobalis !

Given you can't create a WCS with coord_type longitude and a coord_unit of anything other than deg with astropy I am not sure you can easily test this without importing gwcs into the tests.

If you could add a changelog that would be good though.

@nabobalis
Copy link
Contributor Author

nabobalis commented Jan 4, 2023

I added a simple changelog, let me know if it's sufficient.

@WilliamJamieson
Copy link
Contributor

Thanks @nabobalis !

Given you can't create a WCS with coord_type longitude and a coord_unit of anything other than deg with astropy I am not sure you can easily test this without importing gwcs into the tests.

If you could add a changelog that would be good though.

@nabobalis would it be possible for you to contribute a test for this to GWCS?

@nabobalis
Copy link
Contributor Author

Thanks @nabobalis !
Given you can't create a WCS with coord_type longitude and a coord_unit of anything other than deg with astropy I am not sure you can easily test this without importing gwcs into the tests.
If you could add a changelog that would be good though.

@nabobalis would it be possible for you to contribute a test for this to GWCS?

Don't see why not. Point me at a repo and I will try.

Comment on lines 1 to 2
``_transform_plot_args`` was converting to degrees instead of the unit of the coordinate frame.
While not a problem for WCS, it is a problem for gWCS.
Copy link
Member

Choose a reason for hiding this comment

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

I would focus on the user facing affects of this:

``WCSAxes.plot_coord`` and ``plot_scatter`` now work correctly for APE 14 compliant WCSes where the units are not always converted to degrees.

@astrofrog
Copy link
Member

Given you can't create a WCS with coord_type longitude and a coord_unit of anything other than deg with astropy I am not sure you can easily test this without importing gwcs into the tests.

Couldn't we make a small fake APE 14 WCS to replicate this bug?

@Cadair
Copy link
Member

Cadair commented Jan 5, 2023

Couldn't we make a small fake APE 14 WCS to replicate this bug?

I am just thinking about what it would need to do, I am not sure how easy it would be to test the behaviour without an image test, so I think you would have to wrap a astropy.wcs.WCS object and do the unit conversion in pixel_to_world_values and world_to_pixel_values?

@WilliamJamieson
Copy link
Contributor

Don't see why not. Point me at a repo and I will try.

See https://github.com/spacetelescope/gwcs

@pllim pllim added the Bug label Jan 23, 2023
@pllim
Copy link
Member

pllim commented Jan 23, 2023

We don't even declare gwcs to be installed in setup.cfg, so adding a GWCS object in test would be... controversial.

Is this good to go as is?

@nabobalis
Copy link
Contributor Author

nabobalis commented Jan 23, 2023

Is this good to go as is?

I was told it was, but I imagine one of the WCSAXES maintainers needs to approve?

@pllim
Copy link
Member

pllim commented Jan 23, 2023

I guess depends on how badly @astrofrog wants you to make a fake WCS for a test here. Adding a test to GWCS downstream should be tracked over at GWCS repo separately.

Regardless, please squash the commits. Thanks!

@nabobalis
Copy link
Contributor Author

Regardless, please squash the commits. Thanks!

Done.

@nabobalis nabobalis requested review from Cadair and removed request for astrofrog and larrybradley February 22, 2023 23:16
@saimn saimn modified the milestones: v5.0.6, v5.0.7 Mar 29, 2023
@astrofrog
Copy link
Member

astrofrog commented Mar 29, 2023

I have pushed a commit with a regression test that uses a custom APE 14 WCS as I'd rather make sure we test for that here and not just in GWCS. We'll need to update the hashes once the CI has run. The reference figure looks like this:

figure

and it didn't work properly before this PR.

@pllim pllim removed 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x labels Mar 30, 2023
@pllim pllim modified the milestones: v5.0.7, v5.3 Mar 30, 2023
@pllim
Copy link
Member

pllim commented Mar 30, 2023

I don't think we should auto backport this because we bumped the minversion of matplotlib on main but not the backport branches. That would mess with the hash stuff. If you really want to backport, please manually do it and use the approrpriate matplotlib versions being tested over there to generate the hashes.

@pllim pllim merged commit 8010bcb into astropy:main Mar 30, 2023
29 of 30 checks passed
@pllim
Copy link
Member

pllim commented Mar 30, 2023

Thanks, all!

@astrofrog
Copy link
Member

astrofrog commented Mar 30, 2023

I'm happy to backport manually but in future could you leave the backport labels if a PR is deemed to need backporting even if it will require a manual backport? Otherwise may lose track of it and also it's useful to have the bot instructions. This one won't be very difficult to backport.

@pllim pllim added 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x labels Mar 30, 2023
@pllim pllim modified the milestones: v5.3, v5.0.7 Mar 30, 2023
@pllim
Copy link
Member

pllim commented Mar 30, 2023

OK, my bad, let's see how far the bot can go then.

@meeseeksdev backport to v5.0.x

@meeseeksdev backport to v5.2.x

@lumberbot-app

This comment was marked as resolved.

@lumberbot-app

This comment was marked as resolved.

@astrofrog
Copy link
Member

Thanks will backport later once at desk!

@nabobalis
Copy link
Contributor Author

Thank you to @astrofrog and @pllim for getting this over the line.

astrofrog pushed a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog added a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog pushed a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog added a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog pushed a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog pushed a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
astrofrog added a commit to astrofrog/astropy that referenced this pull request Mar 31, 2023
pllim added a commit that referenced this pull request Mar 31, 2023
…-v5.2.x

Backport PR #14251: [FIX] _transform_plot_args was converting to degrees instead of coord_unit
pllim added a commit that referenced this pull request Mar 31, 2023
…-v5.0.x

Backport PR #14251: [FIX] _transform_plot_args was converting to degrees instead of coord_unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug visualization.wcsaxes 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x 💤 merge-when-ci-passes Do not use: We have auto-merge option now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants