GithubHelp home page GithubHelp logo

juliaspacemissiondesign / ephemerides.jl Goto Github PK

View Code? Open in Web Editor NEW
17.0 0.0 0.0 16.01 MB

A Modern Binary Ephemeris Reader for Julia, in Julia.

Home Page: https://juliaspacemissiondesign.github.io/Ephemerides.jl/

License: MIT License

Julia 100.00%
astrodynamics calceph ephemerides ephemeris julia spice kernels

ephemerides.jl's Introduction

Ephemerides.jl

A Modern Binary Ephemeris Reader for Julia, in Julia

Stable Documentation Dev Documentation Build Status codecov Code Style: Blue

Ephemerides.jl is a Julia library that provides fast, thread-safe and allocation-free access to binary JPL SPK and PCK ephemeris files. Completely written in Julia, it enables Automatic-Differentiation (AD) via ForwardDiff.jl across all of its function calls.

It outperforms both SPICE.jl and CALCEPH.jl calls for most types of SPK segments and supports state vector and orientation angles computation up to order 3 (jerk).

This package is meant to be used in combination with FrameTransformations.jl, which enables transformations between different point and axes. Indeed, differently from traditional ephemeris readers such as CALCEPH and SPICE, this package is only meant to read the data stored in the binary kernels. It does not perform transformations between reference frames nor concatenations of state vectors. For example, if ephemeris data for point 399 (Earth) is defined with respect to point 3 (Earth-Moon Barycenter) in the ICRF axes, with this package we will only be able to compute the state vector from 399 to 3 or viceversa.

NOTE: All the package routines have been extensively tested against both SPICE and CALCEPH.

Installation

This package can be installed using Julia's package manager:

julia> import Pkg

julia> Pkg.add("Ephemerides.jl");

Quickstart

Load SPK and PCK ephemeris kernels:

using Ephemerides 

# Load a single SPK kernel 
eph_spk = EphemerisProvider("de440.bsp")

# Load a single PCK kernel
eph_pck = EphemerisProvider("pa440.bsp")

# Load multiple SPK and PCK kernels
eph = EphemerisProvider(["de440.bsp", "pa440.bsp"])

Inspect the kernels properties:

# Retrieve the list of NAIF ID for all the available points 
points = ephem_available_points(eph)

# Retrieve the list of NAIF ID for all the available axes
axes = ephem_available_axes(eph)

Retrieve state and orientation data:

# TDB seconds at 2000-01-01T12:00:00 (J2000)
time = 0.0

# Compute the position of point 399 with respect to 3 at J2000
pos = ephem_vector3(eph, 3, 399, time)

# Compute the position and its derivatives for point 299 with respect to 2
pvaj = ephem_vector12(eph, 2, 299, time)

# Compute the orientation of axes 31006 (PA440) with respect to 1 (ICRF) at J2000
angles = ephem_rotation3(eph, 1, 31006, time)

Current Limitations

  • The supported JPL binary SPK/PCK segments types are: 1, 2, 3, 5, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21.
  • Binary INPOP kernels are not supported.
  • Acceleration and jerk computations are natively unavailable for SPK segments of type 1, 5, 15, 17 and 21, but can be computed with Automatic Differentiation (AD) of the position and velocity components.

Documentation

For further information on this package please refer to the stable documentation

Support

If you found this package useful, please consider starring the repository. We also encourage you to take a look at other astrodynamical packages of the JSMD organisation.

ephemerides.jl's People

Contributors

micheleceresoli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ephemerides.jl's Issues

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Add support for SPK type 14

Implement support for SPK type 14 segments, that handle unequally-spaced Chebyshev polynomials. For tests, use the binary kernel available in CALCEPH test directory.

Loss of precision in time argument

When computing the MOON_PA orientation, a loss of precision in the time arguments arises when converting from TDB seconds since J2000 to TDB days since J2000.

CALCEPH and SPICE instead have exact results. MWE:

using Ephemerides 
using CalcephEphemeris
using JSMDInterfaces.Ephemeris
using Tempo 
using SPICE
using ReferenceFrameRotations

kernel =  "test/assets/moon_pa_de440_200625.bpc"

ephj = EphemerisProvider(kernel);
ephc = CalcephProvider(kernel);

et = rand(0.0:1e8)
et = 1.0

yj, yc = zeros(3), zeros(3)
ephem_orient!(yj, ephj, DJ2000, et/86400.0, 31008, 1, 0)
ephem_orient!(yc, ephc, DJ2000, et/86400.0, 31008, 1, 0)

yj2 = ephem_rotation3(ephj, 1, 31008, et)

A = DCM(pxform("J2000", "MOON_PA", et))
angs = dcm_to_angle(A, :ZXZ)

yj = mod.(yj, π)
yj2 = mod.(yj2, π)
yc = mod.(ys, π)
ys = mod.([angs.a1, angs.a2, angs.a3], π)

yj-yc
yj2-yc 

yj-ys
yj2-ys

yc-ys

# yj2 is more precise than yj!
yj2 - ys 
yj2 - yj

Segment Cache Public Access and Handling

When segment caches are retrieved in the spk_vector functions, a copy of the original structure is made, such that when the segment cache is later inspected, it appears empty.

High-level interface functions to access segment data (i.e., the polynomial coefficients) should also be implemented.

Assert SPK 15 test tolerances

Relative test tolerances on SPK Type 15 have been lowered to 1e-11 because they yield bigger differences for propagation times > ~3000s. A check is required to establish whether this difference is only due to numerical issues or because of some bugs in the algorithms

Remove comment warning during package loading

A warning is thrown each time the package is loaded because one of the kernels in the artifacts does not have the EOT in the comment. Should temporarily disable the logging during precompilation to avoid showing that each time.

Optimise record coefficients look-up time

For segments with unequal time intervals that have epoch directories, check whether it is worth to store the last loaded segment time boundaries, so that if they match the user requested time, you do not have to read through all the epochs to find the desired segment index.

Update docstrings for SPK segment caches

The implementation of a public interface to retrieve the segment data (see #26) will require the user to know how that data is organized inside the Julia structures. Although the description of the segment caches will still be a low-level API, all the caches should be documented nonetheless.

Fix segment times with overlapping boundaries

The get_segment_boundaries function doesn't merge the times when the start time of a descriptor equals the end time of another descriptor. Indeed, calling:

desclist = [
    Ephemerides.DAFSegmentDescriptor(2, 1.0, 1.6, 31008, 1, -1, 1, 1)
    Ephemerides.DAFSegmentDescriptor(2, 1.6, 2.0, 31008, 1, -1, 1, 1)
]

ts, te = Ephemerides.get_segment_boundaries(desclist)

Returns:

ts = [1.0, 1.6]
te = [1.6, 2.0]

To-Do:

  • Fix aformentioned bug
  • Add tests on these routines

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.