Ignore:
Timestamp:
Aug 7, 2001, 6:20:32 PM (24 years ago)
Author:
cmv
Message:

Uniformisation des programmes + doc cmv 7/8/01

File:
1 edited

Legend:

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

    r1535 r1626  
    1313#include "fitsspherehealpix.h"
    1414
     15/*!
     16  \ingroup PrgMap
     17  \file cremskfrsph.cc
     18  \brief \b cremskfrsph: Create a masked sphere from a sphere of datas
     19  \verbatim
     20csh> cremskfrsph -h
     21cremskfrsph [-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
    1534void usage();
    1635void usage()
     
    1938    <<" -m min : min value"<<endl
    2039    <<" -M max : max value"<<endl
    21     <<"    condition for filling masque is : min<=sphere value<=max"<<endl
    22     <<"                                      (bounds are included)"<<endl
     40    <<"    condition for filling masque is: min<=sphere_value<=max"<<endl
     41    <<"          (fill mask with valmsk)     (bounds are included)"<<endl
    2342    <<" -n : negate the condition"<<endl
     43    <<"      (switch to: sphere_value<min || max<sphere_value)"<<endl
    2444    <<" -v valmsk,inimsk:"<<endl
    2545    <<"    valmsk: value to be put into mask if ok (def=1.)"<<endl
     
    3252double vmin=-1.e30,vmax=1.e30,vmask=1.,vmaskini=0.;
    3353bool tstmin=false,tstmax=false,negate=false;
     54string dum;
    3455int c;
    3556while((c = getopt(narg,arg,"hnm:M:v:")) != -1) {
     
    5980char * sphmsk = arg[optind+1];
    6081
     82if(negate) dum = ".NOT."; else dum = "";
    6183cout<<"Sphere values : "<<sphval<<endl
    6284    <<"Sphere mask   : "<<sphmsk<<endl
    63     <<"  ...min("<<tstmin<<") "<<vmin<<"  max("<<tstmax<<") "<<vmax<<endl
     85    <<"  ...min("<<tstmin<<") "<<vmin<<endl
     86    <<"     max("<<tstmax<<") "<<vmax<<endl
    6487    <<"  ...negate "<<negate<<endl
    6588    <<"  ...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;
    7092
    7193// Lecture de la sphere Healpix des valeurs
    72 SphereHEALPix<r_8> sph;       
     94SphereHEALPix<r_8> sph;
    7395FitsInFile sfits(sphval);
    7496sfits >> sph;
     
    87109for(int_4 i=0;i<sph.NbPixels();i++) {
    88110  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
    99116  sphm(i) = vmask;
    100117  nmask++;
     
    106123// Ecriture de la sphere Healpix sur fits
    107124{
    108 string dum = "rm -f "; dum += sphmsk; system(dum.c_str());
     125dum = "rm -f "; dum += sphmsk; system(dum.c_str());
    109126FitsOutFile swfits(sphmsk);
    110127cout<<"Writing Mask Sphere Fits file"<<endl;
Note: See TracChangeset for help on using the changeset viewer.