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

Add eq2hor function #39

Merged
merged 5 commits into from
Jul 23, 2017
Merged

Add eq2hor function #39

merged 5 commits into from
Jul 23, 2017

Conversation

TestSubjector
Copy link
Contributor

The opposite of hor2eq, it has a similar type-stability flag due to the keyword arguments.

  • 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.

* 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.
# 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,
Copy link
Member

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?

Copy link
Member

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-io
Copy link

codecov-io commented Jul 22, 2017

Codecov Report

Merging #39 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/eq2hor.jl 100% <100%> (ø)
src/hor2eq.jl 100% <100%> (ø) ⬆️
src/co_nutate.jl 100% <100%> (ø) ⬆️
src/uvbybeta.jl 100% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25aea24...54a9d46. Read the comment docs.

@TestSubjector
Copy link
Contributor Author

The precision problem is now fixed, but I think there's still something funny going on with the hor2eq function. Its example's output does not match with that of IDL, but when I try to run the code line by line, it gives the correct output. 😕

@giordano
Copy link
Member

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 d0 exponent (or other appropriate d exponents) to make all numeric literals double precision.

Not even nutate in AstroLib.jl exactly matches the result and honestly I can't understand why :-/

Anyway, it's important that now the conversion is accurate within one arcsecond! I'd also add the opposite test: eq2hor(hoq2er(alt, az, jd)[1:2]..., jd)

@giordano giordano merged commit 82aa9ca into JuliaAstro:master Jul 23, 2017
@TestSubjector TestSubjector deleted the eq2hor branch July 23, 2017 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants