-
Notifications
You must be signed in to change notification settings - Fork 13
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
add simple projected coordinates #43
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 91.52% // Head: 94.61% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 91.52% 94.61% +3.08%
==========================================
Files 3 4 +1
Lines 118 130 +12
==========================================
+ Hits 108 123 +15
+ Misses 10 7 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @aplavin! I get a little wary of code like this that starts doing lots of Type
gymnastics- it's really easy to miss a corner case when constructors and converts get written this way. I would prefer to see an exhaustive test suite that uses a for loop to check all types work with projected coords (for both projected types).
I'm curious about your thoughts of defining Base.parent
and using that in addition to or instead of SkyCoords.origin
? Also, should SkyCoords.separation
and SkyCoords.position_angle
be defined for the projected offsets (i.e., we can measure the direct distance of the offset from the origin, but do we want that?)?
I'm neutral on that. Typically, Maybe,
Now, offsets are just a |
Sounds good
I mean like so: using LinearAlgebra
separation(proj::ProjectedCoords) = norm(proj.offset) |
b8dcfcf
to
8a6ab33
Compare
Bump... |
lon(c::AbstractProjectedCoords) = lon(origin(c)) + c.offset[1] / cos(lat(origin(c))) | ||
lat(c::AbstractProjectedCoords) = lat(origin(c)) + c.offset[2] | ||
|
||
Base.convert(::Type{T}, c::T) where {T<:AbstractProjectedCoords} = c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method needed? Isn't it already covered by https://github.com/JuliaLang/julia/blob/162ee48e1c34b2a2cd797395353f19a7aca21aa2/base/Base.jl#L64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Base method is less specific and won't be called when converting skycoords. Same motivation as
Line 76 in 6c8849b
Base.convert(::Type{T}, c::T) where {T<:AbstractSkyCoords} = c |
almost a copy of the implementation in SkyImages.jl
would be useful to upstream to SkyCoords, if this is in scope of the package