Changeset 1632 in Sophya for trunk


Ignore:
Timestamp:
Aug 10, 2001, 4:35:27 PM (24 years ago)
Author:
cmv
Message:

add cut lat_gal cmv+rz 10/8/01

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/PrgMap/cremskfrsph.cc

    r1626 r1632  
    2626 -n : negate the condition
    2727      (switch to: sphere_value<min || max<sphere_value)
     28 -b bmin,bmax : on coupe en latitude entre [bmin,bmax] degres (def=no+cut)
    2829 -v valmsk,inimsk:
    2930    valmsk: value to be put into mask if ok (def=1.)
     
    4243    <<" -n : negate the condition"<<endl
    4344    <<"      (switch to: sphere_value<min || max<sphere_value)"<<endl
     45    <<" -b bmin,bmax : on coupe en latitude entre [bmin,bmax] degres (def=no+cut)"<<endl
    4446    <<" -v valmsk,inimsk:"<<endl
    4547    <<"    valmsk: value to be put into mask if ok (def=1.)"<<endl
     
    5052int main(int narg, char* arg[])
    5153{
    52 double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0.;
     54double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0., bmin=1.,bmax=-1.;
    5355bool tstmin=false,tstmax=false,negate=false;
    5456string dum;
    5557int c;
    56 while((c = getopt(narg,arg,"hnm:M:v:")) != -1) {
     58while((c = getopt(narg,arg,"hnm:M:v:b:")) != -1) {
    5759  switch (c) {
    5860  case 'n' :
     
    6971  case 'v' :
    7072    sscanf(optarg,"%lf,%lf",&vmask,&vmaskini);
     73    break;
     74  case 'b' :
     75    sscanf(optarg,"%lf,%lf",&bmin,&bmax);
    7176    break;
    7277  case 'h' :
     
    8893    <<"  ...mask set value "<<vmask<<endl
    8994    <<"     mask init value "<<vmaskini<<endl
     95    <<"Cut latitude between "<<bmin<<" and "<<bmax<<" deg"<<endl
    9096    <<"Condition on data to set the mask: "
    9197    <<dum<<"( "<<vmin<<" <= V <= "<<vmax<<" )"<<endl;
     
    104110SphereHEALPix<r_8> sphm(sph,false);
    105111
    106 // Filling Mask Sphere
     112// Filling Mask Sphere with cut on values
    107113cout<<"Filling Mask"<<endl;
     114double thetamin = (90.-bmax) * M_PI/180.;
     115double thetamax = (90.-bmin) * M_PI/180.;
    108116uint_4 nmask = 0;
    109117for(int_4 i=0;i<sph.NbPixels();i++) {
     
    113121  if((tstmin && sph(i)<vmin) || (tstmax && sph(i)>vmax)) skp = !negate;
    114122  if(skp) continue;   // Do nothing
     123
     124  if(bmin<bmax) {
     125    double theta,phi;
     126    sphm.PixThetaPhi(i,theta,phi);
     127    if(theta>=thetamin && theta<=thetamax) continue;
     128  }
    115129
    116130  sphm(i) = vmask;
     
    124138{
    125139dum = "rm -f "; dum += sphmsk; system(dum.c_str());
    126 FitsOutFile swfits(sphmsk);
     140FitsOutFile swfits(sphmsk,FitsFile::clear);
    127141cout<<"Writing Mask Sphere Fits file"<<endl;
    128142swfits<<sphm;
    129143}
    130144
    131 exit(0);
     145return 0;
    132146}
Note: See TracChangeset for help on using the changeset viewer.