Changeset 3796 in Sophya for trunk


Ignore:
Timestamp:
Jun 29, 2010, 7:26:01 PM (15 years ago)
Author:
ansari
Message:

Suite modif utilisation de reponse calcule (tabulee) de l'interferometre pour soustraction avant-plans, Reza 29/06/2010

Location:
trunk/Cosmo/RadioBeam
Files:
7 edited

Legend:

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

    r3792 r3796  
    33    R. Ansari , C. Magneville - Juin 2010
    44
    5   Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamDoL]
     5  Usage: applobe Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName
     6                 [TargetBeamDoL] [ResmapleFactor=0.5,0.333...]
    67---------------------------------------------------------------  */
    78
     
    5051
    5152  if (narg < 3) {
    52     cout << "Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamDoL]\n" << endl;
     53    cout << "Usage: applobe Diameter/Four2DRespTableFile In3DPPFName Out3DPPFName "
     54         << "             [TargetBeamDoL] [ResmapleFactor=0.5,0.333...] \n" << endl;
    5355    return 1;
    5456  }
    5557
    5658  // decodage arguments
    57   string outname = arg[2];
    58   string inname = arg[1];
    59   bool fgresample=false;
    60   double fresamp=1.;
    61   if (narg>3) {
    62     fresamp=atof(arg[3]);
    63     if ((fabs(fresamp)>1.e-2)&&(fabs(fresamp-1.)>1.e-2))  fgresample=true;
     59  bool fgresptbl=true;
     60  double DIAMETRE=100.;
     61  string resptblname;
     62  if (isdigit(*arg[1])) {
     63    fgresptbl=false;
     64    DIAMETRE=atof(arg[1]);
    6465  }
     66  else resptblname=arg[1];
     67
     68  string inname = arg[2];
     69  string outname = arg[3];
    6570  bool fgcorrbeam=false;
    6671  double tbeamDoL=135;
     
    6873    tbeamDoL=atof(arg[4]);
    6974    if (tbeamDoL>1)  fgcorrbeam=true;
     75  }
     76  bool fgresample=false;
     77  double fresamp=1.;
     78  if (narg>5) {
     79    fresamp=atof(arg[5]);
     80    if ((fabs(fresamp)>1.e-2)&&(fabs(fresamp-1.)>1.e-2))  fgresample=true;
    7081  }
    7182
     
    101112    conv.setFrequency(Freq0MHz);
    102113    double lambda = conv.getLambda();
    103     Four2DResponse fresp(2, InterfArrayDiametre/lambda, InterfArrayDiametre/lambda, lambda);   
    104     BeamEffect beam(fresp);
     114   
     115    Four2DResponse fresp(2, DIAMETRE/lambda, DIAMETRE/lambda, lambda);
     116    Four2DResponse* fresp_p=&fresp;
     117    Four2DRespTable resptbl;
     118    if (fgresptbl) {
     119      cout << "applobe[2.b]: initializing Four2DRespTable from file" << resptblname << endl;
     120      resptbl.readFromPPF(resptblname);
     121      fresp_p=&resptbl;
     122    }
     123    else cout << " applobe[2.b]: Four2DResponse ( Diameter=" << DIAMETRE << " Lambda= " << lambda
     124              << " DoL=" << DIAMETRE/lambda << " ) " << endl;
     125    BeamEffect beam(*fresp_p);
    105126
    106127    if (fgcorrbeam) {
    107128      double DoL = tbeamDoL;
    108129      double tbeamarcmin = RadianToDegree(1.22/DoL)*60.;
    109       Four2DResponse tbeam(2, DoL, DoL );
     130      int typcb = 2;
     131      if (fgresptbl) typcb=22;
     132      Four2DResponse tbeam(typcb, DoL, DoL );
    110133      cout << "applobe[3]: calling Correct2RefLobe() with target beam D/Lambda=" << DoL 
    111            << " -> arcmin " << tbeamarcmin << endl;
     134           << " -> arcmin " << tbeamarcmin << " TypDishResp=" << typcb << endl;
    112135      beam.Correct2RefLobe(tbeam, incube, dx, dy, Freq0MHz, dfreq);
    113136    }
  • trunk/Cosmo/RadioBeam/calcpk2.cc

    r3792 r3796  
    77    R. Ansari , C. Magneville - Juin 2010
    88
    9 Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync InMapRadioSource convFacRsc OutPk
    10                [PixNoiseLevel] [TargetBeamArcmin] [NSigSrcThr]
     9Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync InMapRadioSource convFacRsc OutPkFile
     10               [PixNoiseLevel] [Diameter/Four2DRespTableFile] [TargetBeamArcmin] [NSigSrcThr]
    1111---------------------------------------------------------------  */
    1212
     
    4444{
    4545  if (narg<6) {
    46     cout << " Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync  OutPk \n"
    47          << "        [PixNoiseLevel] [TargetBeamArcmin] [NSigSrcThr]" << endl;
     46    cout << " Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync  OutPkFile \n"
     47         << "        [PixNoiseLevel] [Diameter/Four2DRespTableFile] [TargetBeamArcmin] [NSigSrcThr]" << endl;
    4848    return 1;
    4949  }
     
    6565   
    6666    bool fgcorrbeam=true;
     67
     68    bool fgresptbl=false;
     69    double DIAMETRE=100.;
     70    string resptblname;
     71    if (narg>7) {
     72      if (isdigit(*arg[7])) {
     73        fgresptbl=false;
     74        DIAMETRE=atof(arg[7]);
     75      }
     76      else {
     77        resptblname=arg[7];
     78        fgresptbl=true;
     79      }
     80    }
    6781    double tbeamDoL=135;
    68     if (narg>7) {
    69       tbeamDoL=atof(arg[7]);
     82    if (narg>8) {
     83      tbeamDoL=atof(arg[8]);
    7084      if (tbeamDoL<1.)  fgcorrbeam=false;
    7185    }
    7286    bool fgclnsrc=true;
    7387    double nsigsrc=5.;
    74     if (narg>8) {
    75       nsigsrc=atof(arg[8]);
     88    if (narg>9) {
     89      nsigsrc=atof(arg[9]);
    7690      if (nsigsrc<1.e-6)  fgclnsrc=false;
    7791    }
     
    119133    conv.setFrequency(Freq0MHz);
    120134    double lambda = conv.getLambda();
    121     Four2DResponse arep(2, InterfArrayDiametre/lambda, InterfArrayDiametre/lambda, lambda);
     135    Four2DResponse arep(2, DIAMETRE/lambda, DIAMETRE/lambda, lambda);
     136    Four2DResponse* arep_p=&arep;
     137    Four2DRespTable resptbl;
     138    if (fgresptbl) {
     139      cout << "calcpk2[3.a]: initializing Four2DRespTable from file" << resptblname << endl;
     140      resptbl.readFromPPF(resptblname);
     141      arep_p=&resptbl;
     142    }
     143    else cout << " calcpk2[3.a]: Four2DResponse ( Diameter=" << DIAMETRE << " Lambda= " << lambda
     144              << " DoL=" << DIAMETRE/lambda << " ) " << endl;
     145
    122146    double DoL = tbeamDoL;
    123147    double tbeamarcmin = RadianToDegree(1.22/DoL)*60.;
    124     Four2DResponse tbeam(2, DoL, DoL );
    125     ForegroundCleaner  cleaner(arep, tbeam, skycube);
     148    int typcb = 2;
     149    //    if (fgresptbl) typcb=22;
     150    Four2DResponse tbeam(typcb, DoL, DoL );
     151
     152    ForegroundCleaner  cleaner(*arep_p, tbeam, skycube);
    126153    if (fgcorrbeam) {
    127       cout << "calcpk2[3.a] : calling cleaner.BeamCorrections() for target beam D/Lambda=" << DoL
    128            << "  -> arcmin " << tbeamarcmin << endl;
     154      cout << "calcpk2[3.b] : calling cleaner.BeamCorrections() for target beam D/Lambda=" << DoL
     155           << "  -> arcmin " << tbeamarcmin << " TypDishResp=" << typcb << endl;
    129156      cleaner.BeamCorrections();
    130157    }
    131     cout << " calcpk2[3.b] : calling cleaner.CleanNegatives() ... " << endl;
     158    cout << " calcpk2[3.c] : calling cleaner.CleanNegatives() ... " << endl;
    132159    cleaner.CleanNegatives();
    133160    if (fgclnsrc) {
    134       cout << "calcpk2[3.c] : calling cleaner.CleanPointSources() with threshold NSigma=" << nsigsrc  << endl;
     161      cout << "calcpk2[3.d] : calling cleaner.CleanPointSources() with threshold NSigma=" << nsigsrc  << endl;
    135162      cleaner.CleanPointSources(nsigsrc);
    136163    }
  • trunk/Cosmo/RadioBeam/cubedef.h

    r3789 r3796  
    3939static double sigPLidxSrc = 0.15;  // Sigma de la variation (gaussienne) de l'index 
    4040
    41 // Parametres pour la reponse en Fourier de l'instrument :
    42 static double InterfArrayDiametre = 50.;  // Taille du reseau en metres
    43 
    4441/*
    4542static sa_size_t NTheta=256;
  • trunk/Cosmo/RadioBeam/mdish.cc

    r3792 r3796  
    3333      return ( (wk<1.)?(1.-wk):0.);
    3434      break;
     35    case 22:   // Reponse parabole diametre D  Triangle <= kmax= 2 pi D / lambda + trou au centre
     36      wk = sqrt(kx*kx+ky*ky)/dx_/2./M_PI;
     37      if (wk<0.025) return 39.*wk;
     38      else if (wk<1.) return (1.-wk);
     39      else return 0.;
     40      break;
    3541    case 3:   // Reponse rectangle Dx x Dy  Triangle (|kx|,|k_y|) <= (2 pi Dx / lambda, 2 pi Dx / lambda)
    36       wkx = kx/2./M_PI/dx_;
    37       wky = ky/2./M_PI/dy_;
     42      wkx = fabs(kx)/2./M_PI/dx_;
     43      wky = fabs(ky)/2./M_PI/dy_;
    3844      return ( ((wkx<1.)&&(wky<1.))?((1.-wkx)*(1-wky)):0.);
    3945      break;
     
    7884  hrep_.FindBin(kx, ky, i, j);
    7985  return hrep_(i, j);
     86}
     87
     88double Four2DRespTable::renormalize(double max)
     89{
     90  double cmx = hrep_.VMax();
     91  hrep_ *= (max/cmx);
     92  return cmx;
    8093}
    8194
  • trunk/Cosmo/RadioBeam/mdish.h

    r3792 r3796  
    2020#endif
    2121
    22 // -- Four2DResponse : Reponse instrumentale ds le plan k_x,k_y (angles theta,phi)
     22// -- Four2DResponse : Reponse instrumentale ds le plan k_x,k_y (frequences angulaires theta,phi)
    2323// typ=1 : Reponse gaussienne parabole diametre D exp[ - 0.5  (lambda  k_g / D )^2 ]
    2424// typ=2 : Reponse parabole diametre D  Triangle <= kmax= 2 pi D / lambda   
    2525// typ=3 : Reponse rectangle Dx x Dy  Triangle (|kx|,|k_y|) <= (2 pi Dx / lambda, 2 pi Dx / lambda)
     26// typ=22 : Reponse parabole diametre D  Triangle <= kmax= 2 pi D / lambda  avec un trou au centre 
     27
    2628class Four2DResponse  {
    2729public:
     
    6567  // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda
    6668  Four2DRespTable(Histo2D const & hrep, double d, double lambda=1.);
     69  // Apres renormalisaton Value(kx,ky) <= max
     70  double renormalize(double max=1.);
    6771  // Return the 2D response for wave vector (kx,ky)
    6872  virtual double Value(double kx, double ky);
  • trunk/Cosmo/RadioBeam/repicon.cc

    r3792 r3796  
    3636{
    3737  if (((narg>1)&&(strcmp(arg[1],"-h")==0))||(narg<3))  {
    38     cout << " Usage: repicon configId OutPPFName [Lambda] "
     38    cout << " Usage: repicon configId OutPPFName [Lambda=0.357] [RenormalizeMax]"
    3939         << " configs: f4x4 , f8x8 , f20x20 Filled array of nxn dishes \n"
    4040         << "          confA , confB, confC : semi-filled array of dishes \n"
     
    5454  if (outfile==".")  outfile = "repicon.ppf";
    5555  double LAMBDA=0.357 ;  // 21 cm at z=0.7
    56   if (narg>3) LAMBDA = atof(arg[2]);
    57 
     56  if (narg>3) LAMBDA = atof(arg[3]);
     57  bool fgrenorm=false;
     58  double rmax=1.;
     59  if (narg>4) {
     60    rmax=atof(arg[4]);
     61    fgrenorm=true;
     62  }
    5863  //-- end command line arguments
    5964 
     
    6166  try {  // exception handling try bloc at top level
    6267
    63     cout << " 2.c/ Creating MultiDish Filled Array " << endl;
    6468    double Ddish = 5.;
    6569    double Ddish2 = 7.5;
     
    122126    double LMAX = D;
    123127    bool fgnoauto = true;
    124     int NRX=100;
    125     int NRY=100;
     128    int NRX=200;
     129    int NRY=200;
    126130
    127131    MultiDish mdish(LAMBDA, LMAX, vdishes, fgnoauto);
     
    134138    PrtTim("Apres mdish.GetResponse()");
    135139
     140    Four2DRespTable mdresp(hrep, Dol, LAMBDA);
     141    if (fgrenorm) {
     142      cout << " repicon[2.b] call to mdresp.renormalize(" << rmax << ")";
     143      double omax=mdresp.renormalize(rmax);
     144      cout << " Old Max=" << omax << endl;
     145    }
    136146    cout << " repicon[3] : saving Four2DRespTable for config " << config << " to PPF file " << outfile << endl;
    137     Four2DRespTable mdresp(hrep, Dol, LAMBDA);
    138147    mdresp.writeToPPF(outfile);
    139148
  • trunk/Cosmo/RadioBeam/subtractradsrc.cmd

    r3793 r3796  
    5050csh> spiapp -term -exec sumcubes.pic
    5151
    52 ## Step 3/ Apply lobe effect on foreground cube and LSS cube
    53 csh> ./Objs/applobe fgndcube.ppf fgndcube_lobe.ppf
    54 csh> ./Objs/applobe lsscube.ppf lsscube_lobe.ppf
     52## Step 3/ Apply lobe (50 meter diameter array) effect on foreground cube and LSS cube
     53csh> ./Objs/applobe 50. fgndcube.ppf fgndcube_lobe.ppf
     54csh> ./Objs/applobe 50. lsscube.ppf lsscube_lobe.ppf
    5555## Step 3.b/ Correct for the lobe effect by bringing all to the beam of Diam/Lambda = 130 
    56 csh> ./Objs/applobe lsscube_lobe.ppf lsscube_corlobe.ppf 1 130
    57 csh> ./Objs/applobe fgndcube_lobe.ppf fgndcube_corlobe.ppf 1 130
     56csh> ./Objs/applobe 50. lsscube_lobe.ppf lsscube_corlobe.ppf 130
     57csh> ./Objs/applobe 50. fgndcube_lobe.ppf fgndcube_corlobe.ppf 130
    5858
    5959### Step 4/ Compute power spectra
     
    7777
    7878# 4.c/ Extract LSS P(k) from Foreground+LSS+noise , after cleaning/subtraction without beam
    79 csh> ./Objs/calcpk2 lsscube.ppf 0.2 fgndcube.ppf 1000 subpk.ppf 0.35 0. 0.
     79csh> ./Objs/calcpk2 lsscube.ppf 0.2 fgndcube.ppf 1000 subpk.ppf 0.35 50. 0. 0.
    8080# 4.d / Extract LSS P(k) from Foreground+LSS+noise and beam effect - correcting to a beam of Diam/Lambda = 130
    81 csh> ./Objs/calcpk2 lsscube_lobe.ppf 0.2 fgndcube_lobe.ppf 1000 subpklobe.ppf 0.35 130. 3.
     81csh> ./Objs/calcpk2 lsscube_lobe.ppf 0.2 fgndcube_lobe.ppf 1000 subpklobe.ppf 0.35 50. 130. 3.
    8282
    8383### Step 5 / Check the results using spiapp
Note: See TracChangeset for help on using the changeset viewer.