(Created page with "In this example we demonstrate how the task lfit in the '''FITSH''' package can be used to fit and evaluate isotropic and/or anisotropic pointing model coefficients as des...") |
m (→Determination of pointing model coefficients) |
||
Line 73: | Line 73: | ||
A=($(cat pointing.fit)) | A=($(cat pointing.fit)) | ||
cat pointing.txt | \ | cat pointing.txt | \ | ||
− | lfit -v a0=${A[0]},b0=${A[1]},c0=${A[2]},d0=${A[3]},e0=${A[4]},f0=${A[5]} | + | lfit -v a0=${A[0]},b0=${A[1]},c0=${A[2]},d0=${A[3]},e0=${A[4]},f0=${A[5]} \ |
+ | -v a1=${A[6]},b1=${A[7]},c1=${A[8]},d1=${A[9]},e1=${A[10]},f1=${A[11]} \ | ||
+ | -v a2=${A[12]},b2=${A[13]},c2=${A[14]},d2=${A[15]},e2=${A[16]} \ | ||
+ | -v b3=${A[17]},c3=${A[18]},d3=${A[19]},e3=${A[20]},f3=${A[21]} \ | ||
-c $cdef \ | -c $cdef \ | ||
-f "tau,dec,sqrt(($fx-$yx)^2+($fy-$yy)^2+($fz-$yz)^2),$fx-$yx,$fy-$yy,$fz-$yz" \ | -f "tau,dec,sqrt(($fx-$yx)^2+($fy-$yy)^2+($fz-$yz)^2),$fx-$yx,$fy-$yy,$fz-$yz" \ |
In this example we demonstrate how the task lfit in the FITSH package can be used to fit and evaluate isotropic and/or anisotropic pointing model coefficients as described in this paper.
The script below expects a data file (named pointing.txt
) which contains four columns: the first two are the encoder readouts for the two axes (here, hour angle and declination) while the third and fourth columns contains the respective first equatorial celestial coordinates derived from astrometry and after the correction for the refraction. Note that this example does not include codes that converts J2000 coordinates to first equatorial coordinates (i.e. does not perform corrections for precession, nutation, aberration and does not compute the local true sidereal time). These computations must be done prior the determination of the model coefficients, i.e. during the preparation of the pointing.txt
(or any other equivalent) file.
#!/bin/bash ct="(cos(tau*pi()/180.0))" st="(sin(tau*pi()/180.0))" cd="(cos(dec*pi()/180.0))" sd="(sin(dec*pi()/180.0))" ct0="(cos(tt*pi()/180.0))" st0="(sin(tt*pi()/180.0))" cd0="(cos(dd*pi()/180.0))" sd0="(sin(dd*pi()/180.0))" fx=" +b0*$sd -c0*$cd*$st+d0*$sd*$st+e0*$sd*$ct-f0*$st" fy="-a0*$sd +c0*$cd*$ct-d0*$sd*$ct+e0*$sd*$st+f0*$ct" fz="+a0*$cd*$st-b0*$cd*$ct -e0*$cd" # $cd*$st, $cd*$ct, $sd y1="($cd*$st)" y2="($sd)" y3="($cd*$ct)" fx="$fx+b1*$y1*$sd-c1*$y1*$cd*$st+d1*$y1*$sd*$st+e1*$y1*$sd*$ct-f1*$y1*$st" fy="$fy-a1*$y1*$sd+c1*$y1*$cd*$ct-d1*$y1*$sd*$ct+e1*$y1*$sd*$st+f1*$y1*$ct" fz="$fz+a1*$y1*$cd*$st-b1*$y1*$cd*$ct-e1*$y1*$cd" fx="$fx+b2*$y2*$sd-c2*$y2*$cd*$st+d2*$y2*$sd*$st+e2*$y2*$sd*$ct-0*$y2*$st" fy="$fy-a2*$y2*$sd+c2*$y2*$cd*$ct-d2*$y2*$sd*$ct+e2*$y2*$sd*$st+0*$y2*$ct" fz="$fz+a2*$y2*$cd*$st-b2*$y2*$cd*$ct-e2*$y2*$cd" fx="$fx+b3*$y3*$sd-c3*$y3*$cd*$st+d3*$y3*$sd*$st+e3*$y3*$sd*$ct-f3*$y3*$st" fy="$fy- 0*$y3*$sd+c3*$y3*$cd*$ct-d3*$y3*$sd*$ct+e3*$y3*$sd*$st+f3*$y3*$ct" fz="$fz+ 0*$y3*$cd*$st-b3*$y3*$cd*$ct-e3*$y3*$cd" yx="($cd0*$ct0-$cd*$ct)" yy="($cd0*$st0-$cd*$st)" yz="($sd0-$sd)" cdef=tau:1,dec:2,tt:3,dd:4 # change 0 to 1 in ( ... || 0 ) below in order to include the points # after pole crossing (i.e. having an encoder declination larger than 90). # first, check the residual of the pointing without any pointing model: if false; then cat pointing.txt | \ awk '{ if ( $2 <= 90 || 0 ) print; }' | \ lfit -c $cdef -f "$yx^2+$yy^2+$yz^2" | \ awk '{ sum+=$1;n++; } END { printf("%10.6f\n",sqrt(sum/n)); }' fi cat pointing.txt | \ awk '{ if ( $2 <= 90 || 1 ) print; }' | \ lfit -v a0,b0,c0,d0,e0,f0,a1,b1,c1,d1,e1,f1,a2,b2,c2,d2,e2,b3,c3,d3,e3,f3 \ -F a0=%9.6f,b0=%9.6f,c0=%9.6f,d0=%9.6f,e0=%9.6f,f0=%9.6f \ -F a1=%9.6f,b1=%9.6f,c1=%9.6f,d1=%9.6f,e1=%9.6f,f1=%9.6f \ -F a2=%9.6f,b2=%9.6f,c2=%9.6f,d2=%9.6f,e2=%9.6f \ -F b3=%9.6f,c3=%9.6f,d3=%9.6f,e3=%9.6f,f3=%9.6f \ -ix - -cx $cdef -fx "$fx" -yx "$yx" -ex 0.000013 \ -iy - -cy $cdef -fy "$fy" -yy "$yy" -ey 0.000013 \ -iz - -cz $cdef -fz "$fz" -yz "$yz" -ez 0.000013 \ --err --residual | tee pointing.fit if true; then A=($(cat pointing.fit)) cat pointing.txt | \ lfit -v a0=${A[0]},b0=${A[1]},c0=${A[2]},d0=${A[3]},e0=${A[4]},f0=${A[5]} \ -v a1=${A[6]},b1=${A[7]},c1=${A[8]},d1=${A[9]},e1=${A[10]},f1=${A[11]} \ -v a2=${A[12]},b2=${A[13]},c2=${A[14]},d2=${A[15]},e2=${A[16]} \ -v b3=${A[17]},c3=${A[18]},d3=${A[19]},e3=${A[20]},f3=${A[21]} \ -c $cdef \ -f "tau,dec,sqrt(($fx-$yx)^2+($fy-$yy)^2+($fz-$yz)^2),$fx-$yx,$fy-$yy,$fz-$yz" \ -F %10.5f,%10.5f,%10.6f,%10.6f,%10.6f,%10.6f \ -o pointing.res fi
This script can also be downloaded directly: run-2-fit-y1.sh. The data file is also available for download: pointing.txt.
The evaluation of the pointing model can also be done by incorporating the lfit task of the package. However, in most of the cases, the respective implementation regarding to the evaluation is integrated in a telescope control system software stack since it is relatively deeply nested in the computational backends.
Filename | Description |
---|---|
run-2-fit-y1.sh | A bash script for fitting L=1 order anisotropic pointing model coefficients. |
run-2-fit-y2.sh | A bash script for fitting L=2 order anisotropic pointing model coefficients. |
pointing.txt | A data series of (τn,δn) and (Tn,Dn) values. |
pointing.fit | The model coefficients derived by applying the script run-2-fit-y1.sh to the data series pointing.txt . The first line contains the model parameters, the second contains the respective uncertainties while the third line contains the residual (in radians). See also the documentation of lfit for more details about this format.
|
pointing.c | A C library for evaluating isotropic and anisotropic pointing models. This library is standalone, needs only the respective header file (see below). |
pointing.h | The corresponding C header file for the above library. |
tcs-parts.c | An example for the usage of the above pointing.[ch] library/header file in a form of code snippets taken from the Konkoly 1-m RCC telescope TCS software stack.
|