Repository navigation
celestial.time
The celestial.time package contains basic utilities for time conversion. Additional tools are available in the convert class.
To convert date to Julian day (JD):
% JD UTC now
JD = celestial.time.julday
% JD at midinight UTC
% JD = celestial.time.julday([D M Y])
JD = celestial.time.julday([1 12 2023; 31 12 2023])
% or you can add the UTC time H, M, S
JD = celestial.time.julday(31 1 2023 22 30 0]);
% alternatively use strings:
celestial.time.julday('2023-12-01T10:10:10.1')
% or cell array of strings:
celestial.time.julday({'2023-12-01T10:10:10.1','2023-01-01T22:10:59.1'})
and from JD to date:
% the output is D M Y Fraction_Of_Day
celestial.time.jd2date(2451545+[0:1:3]')
% or in D M Y H M S
celestial.time.jd2date(2451545+[0:1:3]','H')
You can calculate the Barycentric JD and barycentric velocity for a geocentric or topocentric observer using the celestial.time.barycentricJD functions. This function uses the INPOP Solar System ephemeris implemented in the celestial.INPOP class.
% Barycentric JD for Geocentric observer:
[BJD, BVel] = celestial.time.barycentricJD(2451545,1,1) % vel. units is cm/s
% change velocity units to au/day
[BJD, BVel] = celestial.time.barycentricJD(2451545,1,1,'VelOutUnits','au/day')
% Barycentric JD for topocentric observer:
RAD = 180./pi;
[BJD, BVel] = celestial.time.barycentricJD(2451545,1,1,'GeoPos',[35./RAD 30./RAD, 415])Other related functions:
- celestial.time.date2jd - like julday, bu in which the input is [Y M D ...]
- celestial.time.julday1 - faster function for date range 1900 to 2100
- celestial.time.jd2mjd - JD to MJD (=JD-2400000.5)
- celestial.time.mjd2jd - MJD to JD
- celestial.time.easter_date - Calculate the date of Easter for any Gregorian year
- celestial.time.jd2year - JD to Julian or Besselian years
- celestial.time.year2jd - Return the Julian day at Jan 1 st of a given list of years.
- celestial.time.date_str2vec - Convert a string or a cell array of strings containing date and time
- celestia.time.days_in_month - Return the number of days in month.
- celestial.time.str2date - Convert a date string (using datevec) to date vector
- month_name - Minth number to name.
Given the UT1 time (see below) you can calculate the Local Sidereal Time (LST):
LST=celestial.time.lst(2451545+[0:1:5]',0); % LST at Greenwhich 0 UT1
RAD = 180./pi;
EastLong = 35./RAD
celestial.time.lst(2451565, EastLong)
% by default the lst function calculates the mean LST
% to calculate the apparent LST, using the IAU1976 nutation, use:
celestial.time.lst(2451565, EastLong, 'a')
To convert between different time scales (e.g., TT, TDB, UTC, UT1, TAI, etc.) and to find the Earth rotational parameters you can use the following functionality.
The first step is to download from the International Earth Rotation Service (IERS) the most updated Earth rotation files
% generate an Installer object
I = Installer;
% Download most recent time files from the IERS website
% and store them in ~matlab/data/SolarSystem/Time
I.install('Time');Next, you can use the following functions to read, download, and calculate some time parameters:
% Return UT1-TAI [s] and Earth Orientation Parameters:
[UT1mTAI,EOP]=celestial.time.ut1_tai(2451545);
% Return UT1-UTC and earth Orientation Parameters in Table format:
[UT1mUTC,EOP_Table]=celestial.time.ut1_utc(2451545);
% for values between 1962 to 1992, use:
[UT1mUTC]=celestial.time.ut1_utc(2451545,'SourceFile','1962') % [s]
% TDB - TDT:
Diff=celestial.time.tdb_tdt(celestial.time.julday([1 1 2000])) % [s]
% TT-UTC, TT-UT1, UT1-TAI, UT1-UTC [s]:
% including predictions into the near future:
[TTmUTC, TTmUT1, UT1mTAI, UT1mUTC]=celestial.time.tt_utc([0;2451545;celestial.time.julday+10]);
% Calculate Delta T (=TT-UT1; or ET-UT prior to 1984):
celestial.time.delta_t(celestial.time.julday([1 1 2000; 1 1 2023])) % [s]
- AstroPack/MAATv2 content
- Install
- Coding conventions
- Getting Started
- List of all functions, classes, and methods
- startup file
- configuration files
- PasswordsManager
- New functions and changes log
- LAST production releases
- Pipeline tasks
- Requested Functionality
- unitTest
- File names
- Catalogs
- Headers
- Matched sources catalog
- Image bit mask
- Merged catalog bit mask
- Photometric Calibration
- File names
- [Introduction to image processing]
-
Databases
- The imUtil package
- The imProc package
- [The lcUtil package]
- [Spectra processing]
- AstroSpec class
- [imProc.spec]
- [pipelines]
- Generate a calibrated source catalog from an image
- Forced photometry
- [Astrometry-related topics]
- Registration and coaddition
- [Image subtraction and transient detection]
- Asteroids ephemeris and matching to sources
- Quering an AstroDb database
- Display and inspect images without DB
- [The celestial package - coordinates and epehemerides]
- [celestial.coo]
- celestial.time
- celestial.map
- celestial.Kepler
- celestial.SolarSys
- celestial.INPOP
- [celestial.ephem]
- celestial.OrbitalEl
- celestial.conjunctions
- [celestial.Targets]
- [celestial.scheduling]
- celestial.earth
- [celestial.htm]
- [celestial.pm]
- [celestial.meterors]
- [celestial.rigidBody]
- celestial.search
- [celestial.stars]
- celestial.proj
- celestial.grid
- [The astro package]
- [Cosmology]
- [Spectra]
- [Gravitational Lensing]
- [binary]
- extinction
- [occultation]
- stars
- [supernova]
- constant - physical constants
- convert - physical units conversions
- [timeSeries - Time series analysis tools]
- [arma]
- [bin]
- [detrend]
- [fit]
- [fold]
- [interp]
- [period]
- [rand]
- [stat]
- [time]
- [xcorr]
- [timeDelay]
- [Virtual observatory and catalogs]
- [Plotting tools]
- [General tools]
- tools package
- www package
- [io package]
- [Database]
- [Low-level classes]
- [Base and Component]
- [Msg loggers and syslog]
- [Developers]