Is there a process or script in PI that will convert an image's Julian Date (JD) to a Barycentric Julian Date (BJD) and put it into the image header?
/*
* Compute an approximation to the Barycentric Julian Date (BJD) for the
* specified time point and position vector.
*
* time The required time point. Can be either a Date object, a string
* in ISO 8601 format, or a Julian Date (JD).
*
* pos A Vector object whose components are the geocentric equatorial
* coordinates of the observed object.
*
* distance Distance to the object in au. If not specified or a value <= 0
* is specified, the object is assumed to be at infinite distance.
*
* timescale The timescale. Can be one of "TT", "TDB", "Teph", "UTC", "TAI"
* and "UT". If not specified, UTC is assumed.
*
* Returns the approximate BJD in the specified timescale, neglecting
* relativistic corrections and assuming a geocentric observer.
*/
function BJD( time, pos, distance, timescale )
{
// Time point as a JD
if ( typeof( time ) === "string" )
time = new Date( time );
if ( time instanceof Date )
{
let year = t.getUTCFullYear();
let month = t.getUTCMonth() + 1;
let day = t.getUTCDate() + 1;
let dayf = (t.getUTCHours() + (t.getUTCMinutes() + (t.getUTCSeconds() + t.getUTCMilliseconds()/1000)/60)/60)/24;
time = Math.complexTimeToJD( year, month, day, dayf );
}
// Object at infinite distance by default
if ( distance === undefined )
distance = 0;
// UTC timescale by default
if ( timescale === undefined )
timescale = "UTC";
// Compute positions for the specified time and timescale
var P = new Position( time, timescale );
// Barycentric position vector of the geocenter
var r = P.barycentricPositionOfEarth;
// Unit vector in the direction of the observed object
var u = pos.unit();
// BJD correction
var d;
if ( distance > 0 )
{
// Known distance to object
u.mul( distance );
r.add( u );
d = r.l2norm() - distance;
}
else
{
// Infinite distance
d = r.dot( u );
}
const au_km = 149597870.7; // astronomical unit (km)
const c_km_s = 299792.458; // speed of light (km/s)
const c_au_day = (c_km_s/au_km)*86400; // speed of light (au/day)
return time + d/c_au_day;
}
d = r.l2norm() - distance;