@observerly/astrometry
Version:
observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.
36 lines (35 loc) • 886 B
JavaScript
const I = (e, c) => {
const t = e.match(`^${c}_(\\d+)_(\\d+)$`);
return t ? [Number.parseInt(t[1], 10), Number.parseInt(t[2], 10)] : null;
}, S = (e, c) => {
let t = c.x - e.crpix.x, o = c.y - e.crpix.y, a = 0, m = 0;
if (e.SIP) {
for (const n in e.SIP.APower) {
const l = e.SIP.APower[n], i = I(n, "A");
if (i) {
const [P, f] = i;
a += l * t ** P * o ** f;
}
}
for (const n in e.SIP.BPower) {
const l = e.SIP.BPower[n], i = I(n, "B");
if (i) {
const [P, f] = i;
m += l * t ** P * o ** f;
}
}
}
t += a, o += m;
let r = e.cd11 * t + e.cd12 * o + e.E;
r = r % 360, r < 0 && (r += 360);
let d = e.cd21 * t + e.cd22 * o + e.F;
return d = d % 90, {
ra: r,
dec: d
};
};
export {
S as convertPixelToWorldCoordinateSystem,
I as parseSIPTerm
};
//# sourceMappingURL=wcs.js.map