Changeset 1632 in Sophya for trunk/SophyaProg
- Timestamp:
- Aug 10, 2001, 4:35:27 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PrgMap/cremskfrsph.cc
r1626 r1632 26 26 -n : negate the condition 27 27 (switch to: sphere_value<min || max<sphere_value) 28 -b bmin,bmax : on coupe en latitude entre [bmin,bmax] degres (def=no+cut) 28 29 -v valmsk,inimsk: 29 30 valmsk: value to be put into mask if ok (def=1.) … … 42 43 <<" -n : negate the condition"<<endl 43 44 <<" (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 44 46 <<" -v valmsk,inimsk:"<<endl 45 47 <<" valmsk: value to be put into mask if ok (def=1.)"<<endl … … 50 52 int main(int narg, char* arg[]) 51 53 { 52 double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0. ;54 double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0., bmin=1.,bmax=-1.; 53 55 bool tstmin=false,tstmax=false,negate=false; 54 56 string dum; 55 57 int c; 56 while((c = getopt(narg,arg,"hnm:M:v: ")) != -1) {58 while((c = getopt(narg,arg,"hnm:M:v:b:")) != -1) { 57 59 switch (c) { 58 60 case 'n' : … … 69 71 case 'v' : 70 72 sscanf(optarg,"%lf,%lf",&vmask,&vmaskini); 73 break; 74 case 'b' : 75 sscanf(optarg,"%lf,%lf",&bmin,&bmax); 71 76 break; 72 77 case 'h' : … … 88 93 <<" ...mask set value "<<vmask<<endl 89 94 <<" mask init value "<<vmaskini<<endl 95 <<"Cut latitude between "<<bmin<<" and "<<bmax<<" deg"<<endl 90 96 <<"Condition on data to set the mask: " 91 97 <<dum<<"( "<<vmin<<" <= V <= "<<vmax<<" )"<<endl; … … 104 110 SphereHEALPix<r_8> sphm(sph,false); 105 111 106 // Filling Mask Sphere 112 // Filling Mask Sphere with cut on values 107 113 cout<<"Filling Mask"<<endl; 114 double thetamin = (90.-bmax) * M_PI/180.; 115 double thetamax = (90.-bmin) * M_PI/180.; 108 116 uint_4 nmask = 0; 109 117 for(int_4 i=0;i<sph.NbPixels();i++) { … … 113 121 if((tstmin && sph(i)<vmin) || (tstmax && sph(i)>vmax)) skp = !negate; 114 122 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 } 115 129 116 130 sphm(i) = vmask; … … 124 138 { 125 139 dum = "rm -f "; dum += sphmsk; system(dum.c_str()); 126 FitsOutFile swfits(sphmsk );140 FitsOutFile swfits(sphmsk,FitsFile::clear); 127 141 cout<<"Writing Mask Sphere Fits file"<<endl; 128 142 swfits<<sphm; 129 143 } 130 144 131 exit(0);145 return 0; 132 146 }
Note:
See TracChangeset
for help on using the changeset viewer.