celestial.INPOP - EranOfek/AstroPack GitHub Wiki
Description
celestial.INPOP is a container class for storing the high-accuracy Solar-System INPOP ephemeris, and using them to calculate the planet's position.
The class provides functionality for fast access, and generating, Solar-System ephemeris for multiple epochs simultaneously.
Install
First, you have to download the INPOP tables.
I=Installer;
I.install('INPOP');
% or
celestial.INPOP.download
% and
celestial.INPOP.download('TimePeriod','1000','Version','inpop21a');
% Generate MAT files for faster first access
IP.convertAscii2mat
By default, the tables will be stored in ~/matlab/data/SolarSystem/INPOP/. You can control the data location using the 'Location' argument of the celestial.INPOP.download function.
Usage
The first step when using the INPOP ephemeris is to upload the INPOP table to memory. By default the 100 years table around J2000 is uploaded:
IN=celestial.INPOP;
% load all tables (position, velocity and TT-TDB) for all planets:
IN.populateAll
% To load only position tables:
IN.populateTables('all');
% to load only velocity tables
I.populateTables('all','FileData','vel');
% To load specific planet in specific time range:
IN.populateTables('Mars','TimeSpan',[2451545 2451545+365]); % load data in some specific range for Mars
% You can use the PopForce option to reload by force (otherwise, if table is populated will do nothing)
IN.populateAll('PopForce',true);
IN.populateAll('TimeSpan',[2459000, 2461000],'PopForce',true);
To save on memory you can load only the lower order polynomials. The following example will load the tables only up to the 5th order polynomials (which is good enough for orbital integration on a few year's time scale)
IN = celestial.INPOP;
IN.populateTables('all','TimeSpan',[OrbEl.Epoch(1)-100, JD+100], 'MaxOrder',5);
IN.populateTables('Sun','FileData','vel', 'MaxOrder',5);
IN.populateTables('Ear','FileData','vel', 'MaxOrder',5);
To generate psoition and velocity vector of a planet in rectangular coordinates, you can use the getPos and getVel functions:
JD=[2414106.00,2451545]';
% Get Eath Barycentric position, Equatorial J2000, in au
Pos = IN.getPos('Ear',JD);
% Get Pluto Barycentric position, Ecliptic J2000, in km
Pos = IP.getPos('Plu',JD, 'IsEclipticOut',true, 'OutUnits','km');
% Get Venus velocity, Equatorial J2000, in au/day
Vel = IP.getVel('Ven',JD);
To get the INPOP constants:
Const=IN.Constant % get all INPOP constants
Additional functionality
- celestial.INPOP.eqJ2000_2ecliptic - A static method to rotate [X;Y;Z] Equatorial J2000 coordinates to ecliptic [X;Y;Z]
- isPopulated - Check if the table for an object is populated with Chebyshev polynomials.
- getTT - Evaluate TT-TDB or TCG-TCB.