Changeset 3932 in Sophya for trunk/Cosmo/RadioBeam


Ignore:
Timestamp:
Dec 23, 2010, 7:33:37 PM (15 years ago)
Author:
ansari
Message:

amelioration repicon.cc (decodage arguments) , Reza 23/12/2010

Location:
trunk/Cosmo/RadioBeam
Files:
3 edited

Legend:

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

    r3931 r3932  
    183183  SetThetaPhiRange();
    184184  SetRespHisNBins();
     185  SetPrtLevel();
    185186  mcnt_=0;
    186187}
     
    207208
    208209  double dtet = thetamax_/(double)ntet_;
    209   double dphi = phimax_/(double)ntet_;
     210  double dphi = phimax_/(double)nphi_;
     211  cout << " MultiDish::GetResponse() - ThetaMax=" << thetamax_ << " NTheta=" << ntet_
     212       << " PhiMax=" <<  phimax_ << " NPhi=" << nphi_ << endl;
    210213
    211214  double sumw = 0.;
    212   for(int kt=0; kt<ntet_; kt++)
     215  for(int kt=0; kt<ntet_; kt++) {
     216    double theta=(double)kt*dtet;
    213217    for(int jp=0; jp<nphi_; jp++) {
    214       sumw += CumulResp(rd, (double)kt*dtet, (double)jp*dphi);
    215       sumw += CumulResp(rd, (double)kt*dtet, -(double)jp*dphi);
    216       sumw += CumulResp(rd, (double)kt*dtet, (double)jp*dphi+M_PI);
    217       sumw += CumulResp(rd, (double)kt*dtet, -(double)jp*dphi-M_PI);
     218      double phi=(double)jp*dphi;
     219      sumw += CumulResp(rd, theta, phi);
     220      if (theta<1.e-9) continue;
     221      sumw += CumulResp(rd, theta, -phi);
     222      sumw += CumulResp(rd, theta, phi+M_PI);
     223      sumw += CumulResp(rd, theta, -(phi+M_PI));
    218224    }
     225    if (prtlev_>0) cout << "  MultiDish::GetResponse() done ktheta=" << kt << " / MaxNTheta= " << ntet_ << endl;
     226  }
    219227  double kx1 = DeuxPI*(dishes_[0].DiameterX())/lambda_;
    220228  double ky1 = DeuxPI*(dishes_[0].DiameterY())/lambda_;
  • trunk/Cosmo/RadioBeam/mdish.h

    r3930 r3932  
    120120  MultiDish(double lambda, double dmax, vector<Dish>& dishes, bool fgnoauto=false);
    121121
     122  // Pour phi, les angles phi, -phi, phi+pi, -(phi+pi) sont prises en compte
    122123  inline void SetThetaPhiRange(double thetamax=0., int ntet=1, double phimax=0., int nphi=1)
    123124  { thetamax_=thetamax; ntet_=ntet; phimax_=phimax; nphi_=nphi; }
     125
     126  inline int SetPrtLevel(int lev=0, int prtmod=10)
     127  { int olev=prtlev_; prtlev_=lev; prtmodulo_=prtmod; return olev; }
    124128
    125129  inline void SetRespHisNBins(int nx=128, int ny=128)
     
    145149  QHis2D h2w_;
    146150  int mcnt_;
     151  int prtlev_,prtmodulo_;
    147152};
    148153
  • trunk/Cosmo/RadioBeam/repicon.cc

    r3931 r3932  
    33    R. Ansari , C. Magneville - Juin-Dec 2010
    44
    5   Usage:  repicon configId OutPPFName [z_Redshift=0.7] [RenormalizeMax]
     5  Usage:  repicon [-parname value] configId OutPPFName
    66---------------------------------------------------------------  */
    77
     
    3939// ---------------------------------------------------------------------
    4040
     41void Usage()
     42{
     43  cout << " Usage: repicon [-parname Value] configId OutPPFName \n"
     44       << " configIds: f4x4,f8x8,f20x20, confA,confB,confC,confD, hex12,cross11, f3cyl,f8cyl,f3cylp,f8cylp \n"
     45       << "   f4x4 , f8x8 , f20x20 Filled array of nxn dishes  \n"
     46       << "   confA , confB, confC, confD : semi-filled array of dishes \n"
     47       << "   hex12,cross11 : ASKAP like double hexagonal (12xD=12m), cross config (11xD=12m) \n"
     48       << "   f3cyl, f8cyl , f3cylp, f8cylp : filled array of non perfect/perfect of n cylinders \n"
     49       << "  [ -parname value] : -renmax -z -prt -D -lmax \n"
     50       << "    -renmax MaxValue (default : Do NOT renormalize 2D response value \n"   
     51       << "    -z redshift (default=0.7) --> determines Lambda \n"
     52       << "    -D DishDiameter (default=5 m) \n"
     53       << "    -lmax array extension (default=100 m ) for response calculation kmax \n"
     54       << "    -rot ThetaMaxDeg,NTheta,PhiMaxDeg,NPhi (default NO-rotate/pointing -> 23,10,30,15 ) \n"
     55       << "    -prt PrtLev,PrtModulo (default=0,10) \n"
     56       << endl;
     57  return;
     58}
     59
    4160//      ------------------ MAIN PROGRAM ------------------------------
    4261int main(int narg, const char* arg[])
    4362{
    4463  if (((narg>1)&&(strcmp(arg[1],"-h")==0))||(narg<3))  {
    45     cout << " Usage: repicon configId OutPPFName [z_redshift=0.7] [RenormalizeMax] \n"
    46          << " configs: f4x4 , f8x8 , f20x20 Filled array of nxn dishes (D=5m) \n"
    47          << "          confA , confB, confC, confD : semi-filled array of dishes \n"
    48          << "          hex12,cross11 : ASKAP like double hexagonal (12xD=12m), cross config (11xD=12m) \n"
    49          << "          f3cyl, f8cyl , f3cylp, f8cylp : filled array of non perfect/perfect of n cylinders " << endl;
     64    Usage();
    5065    return 1;
    5166  }
    52   cout << " ==== repicon.cc program , (u,v) plane response ==== " << endl;
    5367  // make sure SOPHYA modules are initialized
    5468  SophyaInit(); 
     
    5771  //--- decoding command line arguments
    5872  string config = "f8x8" ;
    59   if (narg>1) config = arg[1];
    6073  string outfile = "repicon.ppf"; 
    61   if (narg>2) outfile = arg[2];
    62   if (outfile==".")  outfile = "repicon.ppf";
    63   double LAMBDA=0.357 ;  // 21 cm at z=0.7
    64   if (narg>3) LAMBDA = atof(arg[3]);
    6574  bool fgrenorm=false;
    6675  double rmax=1.;
    67   if (narg>4) {
    68     rmax=atof(arg[4]);
    69     fgrenorm=true;
    70   }
     76  double z_Redshift=0.7 ;  // 21 cm at z=0.7 -> 0.357 m 
     77  int prtlev=0;
     78  int prtmod=10;
     79 
     80  double Ddish=5.;
     81  bool fgDfixed=false;
     82  double LMAX = 100.;  // taille de la zone, pour calcul kmax
     83  bool fgLMAXfixed=false;
     84  double thetamxdeg=23.;  // 23 degres : angle d'inclinaison de l'orbite terrestre
     85  double phimxdeg=30.;
     86  int nteta=10;
     87  int nphi=15;
     88  bool fgpoint=false;
     89
     90  int ka=1;
     91  while (ka<(narg-1)) {
     92    if (strcmp(arg[ka],"-renmax")==0) {
     93      rmax=atof(arg[ka+1]);  fgrenorm=true;   ka+=2;
     94    }
     95    else if (strcmp(arg[ka],"-z")==0) {
     96      z_Redshift=atof(arg[ka+1]);  ka+=2;
     97    }
     98    else if (strcmp(arg[ka],"-D")==0) {
     99      Ddish=atof(arg[ka+1]);  fgDfixed=true;  ka+=2;
     100    }
     101    else if (strcmp(arg[ka],"-lmax")==0) {
     102      LMAX=atof(arg[ka+1]);  fgLMAXfixed=true;  ka+=2;
     103    }
     104    else if (strcmp(arg[ka],"-rot")==0) {
     105      sscanf(arg[ka+1],"%lg,%d,%lg,%d",&thetamxdeg,&nteta,&phimxdeg,&nphi);  fgpoint=true;  ka+=2;
     106    }
     107    else if (strcmp(arg[ka],"-prt")==0) {
     108      sscanf(arg[ka+1],"%d,%d",&prtlev,&prtmod);   ka+=2;
     109    }
     110    else break;
     111  }
     112
     113  if ((ka+1)>=narg) {
     114    cout << " repicon / Argument error " << endl;
     115    Usage();
     116    return 2;
     117  }
     118
     119  config = arg[ka];
     120  outfile = arg[ka+1];
    71121  //-- end command line arguments
    72122 
    73123  int rc = 1; 
    74124  try {  // exception handling try bloc at top level
    75 
    76     double Ddish = 5.;
    77     double Ddish2 = 7.5;
     125    cout << " ==== repicon.cc program , (u,v) plane response ==== " << endl;
     126   
    78127    double Eta=0.95;
    79128    double cylW=12.;   // Largeur des cylindres
     
    82131    double etaRL=0.9;   // Efficacite de couverture le long du cylindre
    83132
    84     double D = 100.;    // Taille de la zone
    85 
    86133    int cnt=0;
    87134
     
    89136    cout << " repicon[1] : creating dish vector/ MultiDish for configuration: " << config << endl;
    90137
    91     bool fgpoint=false;
    92138    if (config=="f4x4") {
    93139      vdishes=CreateFilledSqConfig(4,Ddish, Eta);
     
    116162    }
    117163    else if (config=="confA") {
    118       fgpoint=true;
    119164      vdishes=CreateConfigA(Ddish, Eta);
    120165    }
    121166    else if (config=="confB") {
    122       fgpoint=true;
    123167      vdishes=CreateConfigB(Ddish, Eta);
    124168    }
    125169    else if (config=="confC") {
    126       fgpoint=true;
    127170      vdishes=CreateConfigC(Ddish, Eta);
    128171    }
    129172    else if (config=="confD") {
    130       fgpoint=true;
    131173      vdishes=CreateConfigD(Ddish, Eta);
    132174    }
    133175    else if (config=="cross11") {
    134       fgpoint=true;
    135       Ddish = 12.;
     176      if (!fgDfixed) Ddish = 12.;
    136177      double base=20.;
    137178      Eta=0.95;
    138       D=250.;
     179      if (!fgLMAXfixed) LMAX = 250.;
    139180      vdishes=CreateCrossConfig(Ddish,base,Eta);
    140181    }
    141182    else if (config=="hex12") {
    142       fgpoint=true;
    143       Ddish = 12.;
     183      if (!fgDfixed) Ddish = 12.;
    144184      Eta=0.95;
    145       D=350.;
     185      if (!fgLMAXfixed) LMAX = 350.;
    146186      vdishes=CreateDoubleHexagonConfig(Ddish);
    147187    }
    148 
    149188    else {
    150189      cout << " NON valid configuration option -> exit" << endl;
    151190      return 99;
    152191    }
    153 
    154     double Dol = D/LAMBDA;
    155     double LMAX = D;
     192   
     193    H21Conversions conv;
     194    double LAMBDA=0.357 ;  // 21 cm at z=0.7
     195    conv.setRedshift(z_Redshift);
     196    LAMBDA = conv.getLambda();
     197   
     198    double Dol = LMAX/LAMBDA;
    156199    bool fgnoauto = true;
    157200    int NRX=200;
    158201    int NRY=200;
    159 
     202   
     203    cout << " repicon[1] : Lambda=" << LAMBDA << " LMAX= " << LMAX << " NDishes=" << vdishes.size()
     204         << " D-Dish=" << Ddish << " m." << endl;
     205 
    160206    MultiDish mdish(LAMBDA, LMAX, vdishes, fgnoauto);
     207    mdish.SetPrtLevel(prtlev,prtmod);
    161208    mdish.SetRespHisNBins(NRX,NRY);
    162     if (fgpoint)  // 23 degres : angle d'inclinaison de l'orbite terrestre
    163       mdish.SetThetaPhiRange(Angle(23.,Angle::Degree).ToRadian(),10, M_PI/6., 15);
     209
     210    if (fgpoint)  {
     211      cout << " repicon[1.b] : activating pointing , ThetaMaxDeg=" << thetamxdeg << " NTheta=" << nteta
     212           << "  PhiMaxDeg= " << phimxdeg << " NPhi" << nphi << endl;
     213      mdish.SetThetaPhiRange(Angle(thetamxdeg,Angle::Degree).ToRadian(),nteta,Angle(phimxdeg,Angle::Degree).ToRadian(), nphi);
     214    }
    164215    cout << " repicon[2] : calling mdish.GetResponse() ..."<< endl;
    165216
Note: See TracChangeset for help on using the changeset viewer.