-
Notifications
You must be signed in to change notification settings - Fork 24
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 eq2hor function #39
Conversation
* TODO.md: Remove eq2hor from list. * docs/src/ref.md: Add eq2hor entry to the manual. * src/utils.jl: Add eq2hor entry to "utils". * src/eq2hor.jl: Contains code of eq2hor function. * test/util-tests.jl: Include tests for eq2hor.
test/utils-tests.jl
Outdated
# correlated with the output from eq2hor routine of IDL AstroLib, with | ||
# differences only in the least significant digits. | ||
@testset "eq2hor" begin | ||
alt_o, az_o, ha_o = eq2hor(259.20005705918317, 49.674706171288655, AstroLib.J2000, |
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.
With original AstroLib I get:
GDL> eq2hor, 259.20005705918317d0, 49.674706171288655d0, 2451545d0, alt, az, ha, /B1950
% EQ2HOR: Using latitude and longitude for Pine Bluff Observatory
GDL> print, alt, az, ha, format='(f25.17)'
43.68924703474034743
56.68497352338920336
291.08411539434376891
Are these differences due to true_obliquity
as in this case https://github.com/JuliaAstro/AstroLib.jl/pull/31/files/821f2bd8f3c18b6a880c1919468f44afb41ac0bf#diff-95227b96f8be96e64204404da5d0a4de?
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.
In addition, a good test is to check that eq2hor
and hor2eq
are actually one the inverse of the other, but this doesn't seem to be the case:
julia> hor2eq(eq2hor(45, 60, 2e6)[1:2]..., 2e6)
(101.57713976172258, 64.04620027754098, 14.761079887794974)
Instead with original AstroLib:
GDL> eq2hor, 45d0, 60d0, 2d6, alt, az
% EQ2HOR: Using latitude and longitude for Pine Bluff Observatory
GDL> hor2eq, alt, az, 2d6, ra, dec
GDL> print, ra, dec, format='(f25.17)'
45.00017354284745608
59.99999514335013373
Precision isn't very high, but you can see that ra
and eq
approximately match the coordinates passed to eq2hor
.
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
==========================================
+ Coverage 99.69% 99.73% +0.03%
==========================================
Files 72 74 +2
Lines 1329 1498 +169
==========================================
+ Hits 1325 1494 +169
Misses 4 4
Continue to review full report at Codecov.
|
The precision problem is now fixed, but I think there's still something funny going on with the |
Comparing our result with those of IDL AstroLib is tricky, because in many place they use single precision numeric literals. Thus, if you want to do an accurate comparison you should first change IDL AstroLib code and append an explicit Not even Anyway, it's important that now the conversion is accurate within one arcsecond! I'd also add the opposite test: |
The opposite of hor2eq, it has a similar type-stability flag due to the keyword arguments.