Changeset 1626 in Sophya for trunk/SophyaProg/PrgMap/cremskfrsph.cc
- Timestamp:
- Aug 7, 2001, 6:20:32 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaProg/PrgMap/cremskfrsph.cc
r1535 r1626 13 13 #include "fitsspherehealpix.h" 14 14 15 /*! 16 \ingroup PrgMap 17 \file cremskfrsph.cc 18 \brief \b cremskfrsph: Create a masked sphere from a sphere of datas 19 \verbatim 20 csh> cremskfrsph -h 21 cremskfrsph [-n -m min -M max -v valmsk,inimsk] sphval.fits sphmask.fits 22 -m min : min value 23 -M max : max value 24 condition for filling masque is: min<=sphere_value<=max 25 (fill mask with valmsk) (bounds are included) 26 -n : negate the condition 27 (switch to: sphere_value<min || max<sphere_value) 28 -v valmsk,inimsk: 29 valmsk: value to be put into mask if ok (def=1.) 30 inimsk: initialisation value for the mask (def=0.) 31 \endverbatim 32 */ 33 15 34 void usage(); 16 35 void usage() … … 19 38 <<" -m min : min value"<<endl 20 39 <<" -M max : max value"<<endl 21 <<" condition for filling masque is : min<=spherevalue<=max"<<endl22 <<" 40 <<" condition for filling masque is: min<=sphere_value<=max"<<endl 41 <<" (fill mask with valmsk) (bounds are included)"<<endl 23 42 <<" -n : negate the condition"<<endl 43 <<" (switch to: sphere_value<min || max<sphere_value)"<<endl 24 44 <<" -v valmsk,inimsk:"<<endl 25 45 <<" valmsk: value to be put into mask if ok (def=1.)"<<endl … … 32 52 double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0.; 33 53 bool tstmin=false,tstmax=false,negate=false; 54 string dum; 34 55 int c; 35 56 while((c = getopt(narg,arg,"hnm:M:v:")) != -1) { … … 59 80 char * sphmsk = arg[optind+1]; 60 81 82 if(negate) dum = ".NOT."; else dum = ""; 61 83 cout<<"Sphere values : "<<sphval<<endl 62 84 <<"Sphere mask : "<<sphmsk<<endl 63 <<" ...min("<<tstmin<<") "<<vmin<<" max("<<tstmax<<") "<<vmax<<endl 85 <<" ...min("<<tstmin<<") "<<vmin<<endl 86 <<" max("<<tstmax<<") "<<vmax<<endl 64 87 <<" ...negate "<<negate<<endl 65 88 <<" ...mask set value "<<vmask<<endl 66 <<" mask init value "<<vmaskini<<endl; 67 cout<<"Condition : "; 68 if(negate) cout<<"!"; 69 cout<<"( "<<vmin<<" <= V <= "<<vmax<<" ) bounds are included"<<endl; 89 <<" mask init value "<<vmaskini<<endl 90 <<"Condition on data to set the mask: " 91 <<dum<<"( "<<vmin<<" <= V <= "<<vmax<<" )"<<endl; 70 92 71 93 // Lecture de la sphere Healpix des valeurs 72 SphereHEALPix<r_8> sph; 94 SphereHEALPix<r_8> sph; 73 95 FitsInFile sfits(sphval); 74 96 sfits >> sph; … … 87 109 for(int_4 i=0;i<sph.NbPixels();i++) { 88 110 sphm(i) = vmaskini; 89 r_8 v = sph(i); 90 bool intoint = true; 91 if(tstmin && v<vmin) intoint=false; 92 if(tstmax && v>vmax) intoint=false; 93 // [vmin , vmax] 94 // intoint : false [ true ] false (si tstmin && tstmax) 95 // intoint : false [ true (si tstmin && !tstmax) 96 // intoint : true ] false (si !tstmin && tstmax) 97 if(negate && intoint) continue; 98 else if(!negate && !intoint) continue; 111 112 bool skp = (tstmin || tstmax) ? negate : false; 113 if((tstmin && sph(i)<vmin) || (tstmax && sph(i)>vmax)) skp = !negate; 114 if(skp) continue; // Do nothing 115 99 116 sphm(i) = vmask; 100 117 nmask++; … … 106 123 // Ecriture de la sphere Healpix sur fits 107 124 { 108 stringdum = "rm -f "; dum += sphmsk; system(dum.c_str());125 dum = "rm -f "; dum += sphmsk; system(dum.c_str()); 109 126 FitsOutFile swfits(sphmsk); 110 127 cout<<"Writing Mask Sphere Fits file"<<endl;
Note:
See TracChangeset
for help on using the changeset viewer.