Skip to content

Pixel scale and plate scale equivalencies - #4987

Merged
mhvk merged 5 commits into
astropy:masterfrom
eteq:plate-scale-equiv
May 28, 2016
Merged

mhvk merged 5 commits into
astropy:masterfrom
eteq:plate-scale-equiv

Conversation

@eteq

@eteq eteq commented May 27, 2016

Copy link
Copy Markdown
Member

This PR adds two equivalencies, intended for converting from angular scales to either focal plane lengths or pixels on detectors. To see them in action check out the changes to equivalencies.rst

@eteq eteq added the units label May 27, 2016
@eteq eteq added this to the v1.3.0 milestone May 27, 2016
@mhvk

mhvk commented May 27, 2016

Copy link
Copy Markdown
Contributor

Looks good, but these are very simple indeed. Was there a particular need that just (pix * platescale).to(u.arcsec) didn't quite work? (I don't mind having it, but ask in part since I've found that the only one I ever use is dimensionless_angles()).

@eteq

eteq commented May 28, 2016 •

Copy link
Copy Markdown
Member Author

@mhvk - The use case that prompted me in the first case was an ipython notebook where I was constantly doing things like ((10*u.arcsec)*platescale).to(u.pixel) and of course getting an error because it actually was supposed to be /platescale. Then I would correct myself but later do ((10*u.pixel)/platescale).to(u.arcmin) and then get the other kind of error. That's when it struck me that it really is an "equivalency" in the sense that there's no reason for me to remember whether its angle/pixel or pixel/angle. So it seemed perfect for this because it does what equivalencies are supposed to do: make it easier to do unit transformations with minimal mental overhead.

The other reason this is useful is that it allows using set_enabled_equivalencies - that's particularly useful here because a notebook will often be all about analyzing data from a particular telescope/instrument, so you can just add that at the top and always have the pixel<->angle equivalency available for immediate use. I avoid set_enabled_equivalencies in any situation where it's not clear what's desired, but here I see no other reason why you would want to convert pixel to/from angle.

@mhvk

mhvk commented May 28, 2016

Copy link
Copy Markdown
Contributor

OK, that makes a lot of sense. I'd definitely make the same mistakes in interactive use...
Since this also all looks OK, I'll merge.

@mhvk mhvk self-assigned this May 28, 2016
@mhvk
mhvk merged commit 78650e7 into astropy:master May 28, 2016
@eteq
eteq deleted the plate-scale-equiv branch May 31, 2016 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants