5 #include "coordConv/physConst.h"
12 bool tcsFromPVT(
double &pos,
double &vel, coordConv::PVT
const &pvt,
double tai,
bool isAz) {
13 bool isfinite = pvt.isfinite();
15 pos = pvt.getPos(tai) * coordConv::RadPerDeg;
16 vel = pvt.vel * coordConv::RadPerDeg * coordConv::SecPerDay;
22 pos = coordConv::Pi - pos;
28 void pvtFromTCS(coordConv::PVT &pvt,
double posArr[2],
double tai,
double deltaTAI,
bool isAz) {
31 for (
int i = 0; i < 2; ++i) {
33 locPosArr[i] = coordConv::Pi - posArr[i];
35 locPosArr[i] = posArr[i];
38 pvt.pos = locPosArr[0] / coordConv::RadPerDeg;
39 pvt.vel = slaDrange(locPosArr[1] - locPosArr[0]) / (coordConv::RadPerDeg * deltaTAI);
44 std::ostream &
operator<<(std::ostream &os, ASTROM
const &astrom) {
45 os <<
"astrom.cosys " << astrom.cosys <<
" # Type of sky reference system; AZEL_TOPO=" << AZEL_TOPO << std::endl;
46 os <<
"astrom.eqx " << astrom.eqx <<
" # Equinox (for mean RA,Dec systems)" << std::endl;
47 os <<
"astrom.wavel " << astrom.wavel <<
" # Wavelength (micrometers)" << std::endl;
48 os <<
"astrom.refa " << astrom.refa <<
" # Refraction coefficient A" << std::endl;
49 os <<
"astrom.refb " << astrom.refb <<
" # Refraction coefficient B" << std::endl;
50 os <<
"astrom.sth " << astrom.sth <<
" # Sine of intermediate z-rotation" << std::endl;
51 os <<
"astrom.cth " << astrom.cth <<
" # Cosine of intermediate z-rotation" << std::endl;
52 os <<
"astrom.spm1 # Sky-patch matrix #1" << std::endl;
53 os << formatCMat<double, 3, 3>(astrom.spm1) << std::endl;
54 os <<
"astrom.spm1_i # Inverse sky-patch matrix #1" << std::endl;
55 os << formatCMat<double, 3, 3>(astrom.spm1_i) << std::endl;
56 os <<
"astrom.spm2 # Sky-patch matrix #2" << std::endl;
57 os << formatCMat<double, 3, 3>(astrom.spm2) << std::endl;
58 os <<
"astrom.spm2_i # Inverse sky-patch matrix #2" << std::endl;
59 os << formatCMat<double, 3, 3>(astrom.spm2_i) << std::endl;
63 std::ostream &
operator<<(std::ostream &os, FLDOR
const &fldor) {
64 os <<
"fldor.sia cia " << fldor.sia <<
" " << fldor.cia <<
" # Sine and cosine of IAA" << std::endl;
65 os <<
"fldor.pai " << fldor.pai <<
" # Instrument Position-Angle" << std::endl;
66 os <<
"fldor.jf " << fldor.jf <<
" # Optimization: SLITO = " << SLITO <<
" = 1D (slit), FIELDO = " << FIELDO <<
" or else 2D (field)" << std::endl;
70 std::ostream &
operator<<(std::ostream &os, PORIG
const &porig) {
71 os <<
"porig.p0 " <<
formatCArr(porig.p0, 2) <<
" # (x,y) position (user units)" << std::endl;
72 os <<
"porig.ob # Offset from base (user units)" << std::endl;
73 os << formatCMat<double, 3, 2>(porig.ob) << std::endl;
74 os <<
"porig.p " <<
formatCArr(porig.p, 2) <<
" # Current pointing-origin including offsets (user units)" << std::endl;
78 std::ostream &
operator<<(std::ostream &os, SITE
const &site) {
79 os <<
"site.tlongm, tlatm " << site.tlongm <<
", " << site.tlatm <<
" # Telescope longitude and latitude (radians)" << std::endl;
80 os <<
"site.tlong, tlat " << site.tlong <<
", " << site.tlat <<
" # Telescope longitude and latitude (polar motion adjusted, radians)" << std::endl;
81 os <<
"site.slat, clat " << site.slat <<
", " << site.clat <<
" # Functions of latitude" << std::endl;
82 os <<
"site.hm " << site.hm <<
" # Site elevation, metres above sea-level" << std::endl;
83 os <<
"site.diurab " << site.diurab <<
" # Diurnal aberration amplitude (radians)" << std::endl;
84 os <<
"site.daz " << site.daz <<
" # Azimuth correction (terrestrial-celestial, radians)" << std::endl;
85 os <<
"site.temp " << site.temp <<
" # Ambient temperature (K)" << std::endl;
86 os <<
"site.press " << site.press <<
" # Pressure (mB=hPa)" << std::endl;
87 os <<
"site.humid " << site.humid <<
" # Relative humidity (0-1)" << std::endl;
88 os <<
"site.tlr " << site.tlr <<
" # Tropospheric lapse rate (K per metre)" << std::endl;
89 os <<
"site.wavelr " << site.wavelr <<
" # Reference wavelength (micron) or minus frequency (GHz)" << std::endl;
90 os <<
"site.refar, refbr " << site.refar <<
", " << site.refbr <<
" # Refraction coefficients for wavelr (radians)" << std::endl;
91 os <<
"site.rfun " << site.rfun <<
" # Optional refraction function" << std::endl;
92 os <<
"site.t0 " << site.t0 <<
" # Raw clock time at reference time" << std::endl;
93 os <<
"site.st0 " << site.st0 <<
" # LAST at reference time (radians)" << std::endl;
94 os <<
"site.tt0 " << site.tt0 <<
" # TT at reference time (MJD)" << std::endl;
95 os <<
"site.ttj " << site.ttj <<
" # TT at reference time (Julian Epoch)" << std::endl;
99 std::ostream &
operator<<(std::ostream &os, TARG
const &targ) {
100 os <<
"targ.p0 " <<
formatCArr(targ.p0, 2) <<
" # Position at reference time (spherical coordinates, radians)" << std::endl;
101 os <<
"targ.dt " <<
formatCArr(targ.dt, 2) <<
" # Differential rates (radians/day)" << std::endl;
102 os <<
"targ.t0 " << targ.t0 <<
" # Reference time (TAI MJD days)" << std::endl;
103 os <<
"targ.ob # Offsets from base (radians, additive)" << std::endl;
104 os << formatCMat<double, 3, 2>(targ.ob) << std::endl;
105 os <<
"targ.op0 " <<
formatCArr(targ.op0, 2) <<
" # Position at reference time including offsets from base" << std::endl;
106 os <<
"targ.op " <<
formatCArr(targ.p, 2) <<
" # Current position including offsets and differential tracking" << std::endl;
110 std::ostream &
operator<<(std::ostream &os, TIMEO
const &timeo) {
111 os <<
"timeo.ttmtai " << timeo.ttmtai <<
" # TT-TAI (day)" << std::endl;
112 os <<
"timeo.delat " << timeo.delat <<
" # TAI-UTC (day)" << std::endl;
113 os <<
"timeo.delut " << timeo.delut <<
" # UT1-UTC (day)" << std::endl;
114 os <<
"timeo.xpmr, ypmr " << timeo.xpmr <<
" " << timeo.ypmr <<
" # Polar motion angle in x, y (radians)" << std::endl;
118 std::ostream &
operator<<(std::ostream &os, TSCOPE
const &tscope) {
119 os <<
"tscope.fl " << tscope.fl <<
" # Telescope focal length (user units)" << std::endl;
120 os <<
"tscope.mount " << tscope.mount <<
" # Mount type; ALTAZ=" << ALTAZ << std::endl;
121 os <<
"tscope.rotl " << tscope.rotl <<
" # Location of instrument rotator:"
123 <<
" NASMYTH_L=" << NASMYTH_L
124 <<
" NASMYTH_R=" << NASMYTH_R
126 os <<
"tscope.rnogo " << tscope.rnogo <<
" # Mount pole avoidance distance (radians)" << std::endl;
127 os <<
"tscope.ae2nm # Rotation matrix, [Az,El] to nominal mount" << std::endl;
128 os << formatCMat<double, 3, 3>(tscope.ae2nm) << std::endl;
129 os <<
"tscope.ae2mt # Rotation matrix, [Az,El] to actual mount" << std::endl;
130 os << formatCMat<double, 3, 3>(tscope.ae2mt) << std::endl;
131 os <<
"tscope.ia " << tscope.ia <<
" # Roll zero point (radians)" << std::endl;
132 os <<
"tscope.ib " << tscope.ib <<
" # Pitch zero point (radians)" << std::endl;
133 os <<
"tscope.np " << tscope.np <<
" # Mount axes nonperpendicularity (radians)" << std::endl;
134 os <<
"tscope.xt " << tscope.xt <<
" # Telescope vector, x" << std::endl;
135 os <<
"tscope.yt " << tscope.yt <<
" # Telescope vector, y" << std::endl;
136 os <<
"tscope.zt " << tscope.zt <<
" # Telescope vector, z" << std::endl;
140 template <
typename T>
142 std::ostringstream os;
143 os << std::setprecision(12);
144 for (
int i = 0; i < n; ++i) {
153 template <
typename T,
int ROWS,
int COLS>
155 std::ostringstream os;
156 for (
int r = 0; r < ROWS; ++r) {
bool tcsFromPVT(double &pos, double &vel, coordConv::PVT const &pvt, double tai, bool isAz=false)
void pvtFromTCS(coordConv::PVT &pvt, double posArr[2], double tai, double deltaTAI, bool isAz=false)
std::string formatCArr(T const arr[], int n)
std::ostream & operator<<(std::ostream &os, ChebyshevPolynomial const &cheby)
std::string formatCMat(T const mat[ROWS][COLS])