/*---------------------------- PAON4 analysis : Determining antenna pointing and dish size fitting parameters ... (source track corresponds to a satellite track (or planet or sun ...) Does also fit of phases for the 6 cross-correlations Uses gacfit.h and gcxfit.h acbeam.h cxbeam.h R. Ansari , February 2019 Evolution of trkacfit.cc , intended to replace it Assuming that the file trk_1.d contains : @zenang 10 @trk dt_A21 1358,1410 1278.5 trk_A21_43057 @trk dt_A21 1512,1555 1278.5 trk_A21_43055 Example command to run : csh> ../AnaPaon4/Objs/trkacxfit -D 4.5 -out A21_fac.txt trk_1.d visi-track-set datacard format ---------------------------------- # input path (directory for files) listed here (optional) @inpath path ## Zenith angle or declination shift # Zenith angle_in_degree (positive toward north) initial value for fit @zenang ZenithAngle ### Input data and track files - multiple @trk cards # filenames with .ppf extension , Tstart,Tend in minutes @trk AutoCrossVisiDataTableFile Tstart,Tend Freq TrackFile ----------------------------------------------------------------------------*/ #include #include #include #include #include #include #include "array.h" #include "randr48.h" #include "skymap.h" #include "samba.h" #include "fftwserver.h" #include "strutilxx.h" #include "ctimer.h" #include "tarrinit.h" #include "skymapinit.h" #include "fitsioserver.h" #include "slininterp.h" #include "p4autils.h" #include "acbeam.h" #include "gacfit.h" #include "gcxfit.h" #include "gcxfitbaseline.h" #include "trkfit.h" using namespace std; using namespace SOPHYA; //--------------------------------------------------------------------------- //--- Grouping here beam & computation parameters ------------- //--- Global parameters // static double latitude=45.; // latitude in degree // static double longitude=0.; // longitude in degree static double D_dish = 4.5; // effective dish size = effD*D static bool fggaussbeam=true; // --- if true, perform Beam normalisation // static bool fgdobeamnormalise=false; static string outfilename; // output filename for auto-correlation fit parameters static string checkfilename; // output filename for PAON4 and computed auto-cor using fitted parameters static bool fguseAac4Cx=true; //if true, use fitted Amplitudes on autocor for initial Cross-cor fit parameter value // static bool fgoutfits = false; // true -> write output in fits format static int prtlevel=0; // print level static string default_input_path; static vector trksetfiles; // datacard files defining the track/data sets static bool do_baselinefit = false; // if true , perform baseline fit //--- End of list of global parameters //-------- Declaration of functions in this file - code after the main, below int decode_args(int narg, char* arg[]); //-------------------------------------------------------------- //--------- Main program ------------- //-------------------------------------------------------------- int main (int narg, char* arg[]) { cout << " ------ trkacxfit.cc : Fitting auto-correlations using track (satellites...) files ------- " << endl; int rc = 0; try { SophyaInit(); int rcda=decode_args(narg, arg); if (rcda) return rcda; TrkFit_SetPrintLevel(prtlevel); vector v_acxd; vector v_trk; for(size_t i=0; i1)&&(strcmp(arg[1],"-h")==0)) fglonghelp=true; if ((narg<2)||fglonghelp) { cout << " trkacxfit : fit array geometry and \n" << " Usage: trkacxfit [-options] track_Set_1 [track_Set_2] [track_Set_3 ...] \n" << " options: -inp def_input_path -out OutFileName -ckf CheckFileName \n" << " -doblf -ngb -D dish_diameter -prt PrintLevel \n"< lastargs; while (narg>1) { string fbo = arg[1]; if (fbo=="-D") { // dish size (effective dish diameter) if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; } D_dish=atof(arg[2]); arg+=2; narg-=2; lastargs.clear(); } else if (fbo=="-ngb") { // Use Non gaussian beam fggaussbeam=false; arg++; narg--; lastargs.clear(); } else if (fbo=="-doblf") { // Use Non gaussian beam do_baselinefit=false; arg++; narg--; lastargs.clear(); } else if (fbo=="-inp") { // output file name if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; } default_input_path=arg[2]; arg+=2; narg-=2; lastargs.clear(); } else if (fbo=="-out") { // output file name if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; } outfilename=arg[2]; arg+=2; narg-=2; lastargs.clear(); } else if (fbo=="-ckf") { // output file name for checking (data & fitted if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; } checkfilename=arg[2]; arg+=2; narg-=2; lastargs.clear(); } else if (fbo=="-prt") { // print level if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; } prtlevel=atoi(arg[2]); arg+=2; narg-=2; lastargs.clear(); } else { arg++; narg--; lastargs.push_back(fbo); } } if (lastargs.size() < 1) { cout << " trkacxfit/ERROR : No input track/data specified (trkacxfit -h for usage) \n"; return 9; } cout << " ------------------- trkacxfit/run parameters:"<