Changeset 3973 in Sophya for trunk/Cosmo/RadioBeam/applobe.cc


Ignore:
Timestamp:
Apr 18, 2011, 5:30:44 PM (14 years ago)
Author:
ansari
Message:

Corrections diverses: choix lobe gaussien/triangle et specif DishDiameter au lieu de DoL ds applobe/calcpk2, possibilite application lobe freq.independante ds applobe, Reza 18/04/2011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/RadioBeam/applobe.cc

    r3797 r3973  
    33    R. Ansari , C. Magneville - Juin 2010
    44
    5   Usage: applobe Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName
    6                  [TargetBeamDoL] [ResmapleFactor=0.5,0.333...]
     5  Usage: applobe [-g -t -fib]  Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName
     6                 [TargetBeamDiam] [ResmapleFactor=0.5,0.333...]
     7   o -t : triangle beam shape in k-space
     8   o -g : gaussian beam shape in k-space
     9   o -fib: application d'un lobe fixe (independant de la frequence)
     10   o Diameter/Four2DRespTableFile : diametre dish ou nom de fichier PPF reponse 2D
     11   o In3DPPFName Out3DPPFName : Noms des fichiers (TArray<r_4> 3D) entree-sortie
     12   o TargetBeamDiam : Correction à un beam fiduciel, independant de la frequence
     13     avec specification de la valeur du diametre pour la frequence la plus basse
     14   o ResmapleFactor : reechantillonnage du cube (2 -> surechantillonnage, 0.5 : 1 sur 2)
    715---------------------------------------------------------------  */
    816
     
    4856
    4957  InitTim();   // Initializing the CPU timer
     58
     59  if ((narg < 3)||(strcmp(arg[1],"-h")==0)) {
     60    cout << "Usage: applobe [-t -g -fib] Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName \n"
     61         << "               [TargetBeamDiam] [ResmapleFactor=0.5,0.333...] \n" << endl;
     62    if ((narg>1)&&(strcmp(arg[1],"-h")==0)) {
     63      cout << "   -t -g : Triangular / gaussian beam shape (def=gaussian) \n"
     64           << "   -fib :  Application of a fixed (freq.independent) lobe dish-triangle or gaussian \n"
     65           << "   Diameter/Four2DRespTableFile : dish diameter or 2D response PPF file name\n"
     66           << "   In3DPPFName Out3DPPFName: Input/Output PPF file names  (TArray<r_4> 3D) \n"
     67           << "   TargetBeamDiam: Corrected beam target diameter (D/Lambda at lowest frequency) \n"
     68           << "      DoL = 100 --> beam ~ 35 arcmin (D=30m @ z~0.5 Lambda~30cm)) \n"
     69           << "   ResmapleFactor : Resampling (2-> oversampling, 0.5 : 1/2 undersampling) \n" << endl;   
     70    } 
     71    return 1;
     72  }
     73
    5074  Timer tm("applobe");
    5175
     76  // decodage arguments
     77  bool fggaussian=true;  // true -> gaussian beam
     78  bool fixedbeam=false;  // true -> apply freq. independent beam
     79
     80  // decodage argument optionnel
     81  bool fgoptarg=true;
     82  while (fgoptarg) {
     83    string fbo = arg[1];
     84    if (fbo=="-t")  { fggaussian=false; arg++; narg--; }
     85    else if (fbo=="-g")  { fggaussian=true; arg++; narg--; }
     86    else if (fbo=="-fib")  { fixedbeam=true; arg++; narg--; }
     87    else fgoptarg=false;
     88  }
    5289  if (narg < 3) {
    53     cout << "Usage: applobe Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName "
    54          << "             [TargetBeamDoL] [ResmapleFactor=0.5,0.333...] \n" << endl;
    55     return 1;
    56   }
    57 
    58   // decodage arguments
     90    cout << " applobe/error arguments , applobe -h for help " << endl;
     91    return 2;
     92  }
     93
    5994  bool fgresptbl=true;
    6095  double DIAMETRE=100.;
     
    6499    DIAMETRE=atof(arg[1]);
    65100  }
    66   else resptblname=arg[1];
    67 
     101  else  resptblname=arg[1];
     102 
    68103  string inname = arg[2];
    69104  string outname = arg[3];
    70105  bool fgcorrbeam=false;
    71   double tbeamDoL=135;
     106  double tbeamDiam=50.;
    72107  if (narg>4) {
    73     tbeamDoL=atof(arg[4]);
    74     if (tbeamDoL>1)  fgcorrbeam=true;
     108    tbeamDiam=atof(arg[4]);
     109    if (tbeamDiam>1.)  fgcorrbeam=true;
    75110  }
    76111  bool fgresample=false;
     
    83118  int rc = 91;
    84119
    85   cout << " ====== applobe :   Input skycube  name= " << inname << " OutName=" << outname;
     120  cout << " ====== applobe :   Input skycube  name= " << inname << " OutName=" << outname << endl;
     121  cout << ((fggaussian)?" Gaussian ":" Triangular") << ((fixedbeam)?" Fixed (freq.independent)":"") << " beams" << endl;
    86122  bool fginmap=true;
    87123  try {
     
    113149    double lambda = conv.getLambda();
    114150   
    115     Four2DResponse fresp(2, DIAMETRE/lambda, DIAMETRE/lambda, lambda);
     151    int typbeam=(fggaussian)?1:2;
     152    Four2DResponse fresp(typbeam, DIAMETRE/lambda, DIAMETRE/lambda, lambda);
    116153    Four2DResponse* fresp_p=&fresp;
    117154    Four2DRespTable resptbl;
     
    119156      cout << "applobe[2.b]: initializing Four2DRespTable from file" << resptblname << endl;
    120157      resptbl.readFromPPF(resptblname);
     158      resptbl.renormalize(1.);
    121159      fresp_p=&resptbl;
    122160    }
     
    126164
    127165    if (fgcorrbeam) {
    128       double DoL = tbeamDoL;
     166      double DoL = tbeamDiam/lambda;
    129167      double tbeamarcmin = RadianToDegree(1.22/DoL)*60.;
    130       int typcb = 2;
     168      int typcb = (fggaussian)?1:2;
    131169      //      if (fgresptbl) typcb=22;
    132170      Four2DResponse tbeam(typcb, DoL, DoL );
    133       cout << "applobe[3]: calling Correct2RefLobe() with target beam D/Lambda=" << DoL
    134            << " -> arcmin " << tbeamarcmin << " TypDishResp=" << typcb << endl;
     171      cout << "applobe[3]: calling Correct2RefLobe() with target beam Diameter=" << tbeamDiam
     172           << " D/Lambda=" << DoL << " -> arcmin " << tbeamarcmin << " TypDishResp=" << typcb << endl;
    135173      beam.Correct2RefLobe(tbeam, incube, dx, dy, Freq0MHz, dfreq);
     174    }
     175    else if (fixedbeam) {
     176      cout << "applobe[3]: calling ApplyLobe() (freq.independent beam) ... " << endl;
     177      beam.ApplyLobe(incube, dx, dy, Freq0MHz);
    136178    }
    137179    else {
Note: See TracChangeset for help on using the changeset viewer.