Changeset 3830 in Sophya for trunk/Cosmo/RadioBeam/calcpk2.cc


Ignore:
Timestamp:
Aug 4, 2010, 1:59:10 PM (15 years ago)
Author:
ansari
Message:

Amelioration soustraction des avant-plans par l'introduction d'un fit polynome deg 2 sur ln(Temp)=f(ln(freq)), Reza 04/08/2010

File:
1 edited

Legend:

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

    r3796 r3830  
    4343int main(int narg, const char* arg[])
    4444{
    45   if (narg<6) {
    46     cout << " Usage: calcpk2 InMapLSS convFacLSS InMapSync convFacSync  OutPkFile \n"
    47          << "        [PixNoiseLevel] [Diameter/Four2DRespTableFile] [TargetBeamArcmin] [NSigSrcThr]" << endl;
    48     return 1;
     45  if ( (narg<6)||((narg>1)&&(strcmp(arg[1],"-h")==0)) ) {
     46    cout << " Usage: calcpk2 InMapLSS convFacLSS InMapFgnd convFacFgnd OutPkFile \n"
     47         << "        [PixNoiseLevel] [D_Dish/Four2DRespTableFile CorBeamDoL] \n"
     48         << "        [NSigSrcThr] [P2/P1] [RecMapFile] " << endl;
     49    if ((narg>1)&&(strcmp(arg[1],"-h")==0)) {
     50      cout << "- InMapLSS: Input 3D LSS cube (PPF file name) \n "
     51           << "- convFacLSS: LSS cube conversion factor to mK (milliKelvin) \n"
     52           << "- InMapFgnd: Input 3D foreground cube (PPF file name) \n"
     53           << "- convFacFgnd: Foreground cube conversion factor to mK (milliKelvin) \n"
     54           << "- PixNoiseLevel: White noise level per pixel (mK) (default=0.) \n"
     55           << "- D_Dish/Four2DRespTableFile: Dish diameter or 2D (u,v) plane response (PPF file name) \n"
     56           << "- CorBeamDoL: Beam correction target Diameter/Lambda \n"
     57           << "    These two parameters are used to correct for beam effect for a \n"
     58           << "    target beam (independent of frequency) defined by D/Lambda \n"
     59           << "    DoL = 100 --> beam ~ 35 arcmin (D=30m @ z~0.5) \n"
     60           << "    default : no beam correction applied \n "
     61           << " - NSigSrcThr: Point source cleaning, Nb_Sigmas on stacked 2D temperature \n"
     62           << "    default : no point source cleaning, use NSigSrcThr ~ 3..5 \n"
     63           << " - P2/P1: 2nd/first degree polynomial fit on ln(Temp) = f(ln(freq)) \n "
     64           << "    foreground subtraction. default is P2 \n"
     65           << "- RecMapFile: output PPF file for reconstructed foreground template \n"
     66           << "    (Temperature,SpectralIndex) and extracted LSS cube \n"
     67         << endl;
     68      return 1;
     69    }
     70    else cout << "   calcpk2 -h for detailed usage " << endl;
     71    return 2;
    4972  }
    5073  Timer tm("calcpk2");
     
    79102      }
    80103    }
    81     double tbeamDoL=135;
     104    double tbeamDoL=0.;
    82105    if (narg>8) {
    83106      tbeamDoL=atof(arg[8]);
     
    90113      if (nsigsrc<1.e-6)  fgclnsrc=false;
    91114    }
    92 
     115    bool fgpoly2=true;  // true -> soustraction polynome degre 2
     116    if ((narg>0)&&(strcmp(arg[10],"P1")==0)) fgpoly2=false;     
     117    bool fgsavemaps=false;
     118    string outmap_ppfname="extlss.ppf";
     119    if (narg>11) {
     120      outmap_ppfname=arg[11];
     121      fgsavemaps=true;
     122    }
     123   
    93124    TArray<r_4> maplss, mapsync;
    94125    const char * tits[2]={"LSS", "Sync/RadioSrc"};
     
    165196    cout << "calcpk2[4] : calling cleaner.extractLSSCube(...) " << endl;
    166197    TArray<r_4> synctemp, specidx;
    167     TArray<r_4> exlss = cleaner.extractLSSCube(synctemp, specidx);
     198    TArray<r_4> exlss;
     199    if (fgpoly2) exlss = cleaner.extractLSSCubeP2(synctemp, specidx);
     200    else  exlss = cleaner.extractLSSCubeP1(synctemp, specidx);
    168201
    169202    MeanSigma(exlss, mean, sigma);
     
    188221
    189222    tm.Split(" Done ComputePk ");   
    190    
     223    {
    191224    cout << "calcpk2[7.a] : writing profile P(k)  to  " << outname << endl;
    192225    POutPersist po(outname);
    193226    po << hp;
    194     outname = "fgm_" + outname;
    195     cout << "calcpk2[7.b] : writing foreground maps to  " << outname << endl;
    196     POutPersist pom(outname);
    197     pom << PPFNameTag("Tsync") << synctemp;
    198     pom << PPFNameTag("async") << specidx;
     227    }
     228    if (fgsavemaps) {
     229      cout << "calcpk2[7.b] : writing foreground maps and extracted LSS to  " << outmap_ppfname << endl;
     230      POutPersist pom(outmap_ppfname);
     231      pom << PPFNameTag("Tsync") << synctemp;
     232      pom << PPFNameTag("async") << specidx;
     233      pom << PPFNameTag("extlss") << exlss;
     234    }
    199235
    200236  }  // End of try bloc
Note: See TracChangeset for help on using the changeset viewer.