Changeset 1530 in Sophya for trunk/ArchTOIPipe


Ignore:
Timestamp:
Jun 14, 2001, 7:53:29 PM (24 years ago)
Author:
cmv
Message:

ameliorations et + de possibilites cmv 14/6/01

Location:
trunk/ArchTOIPipe
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/map2toi.cc

    r1520 r1530  
    1515Map2TOI::~Map2TOI()
    1616{
     17}
     18
     19////////////////////////////////////////////////////////////////////////
     20void Map2TOI::Print(ostream & os)
     21{
     22  os<<"Map2TOI::Print -- Sphere NLat = "<<mSph.SizeIndex()<<endl
     23
     24    <<"   - Equinoxe="<<mActualYear<<endl
     25
     26    <<"   - TypCoorIn: Gal("<<((mTypCoorIn&TypCoordGal)?1:0)
     27    <<") Eq("<<((mTypCoorIn&TypCoordEq)?1:0)
     28    <<") Deg("<<((mTypCoorIn&TypCoordDD)?1:0)
     29    <<") Hour("<<((mTypCoorIn&TypCoordHD)?1:0)
     30    <<") Rad("<<((mTypCoorIn&TypCoordRR)?1:0)<<")"<<endl
     31
     32    <<"   - TypCoorMap: Gal("<<((mTypCoorMap&TypCoordGal)?1:0)
     33    <<") Eq("<<((mTypCoorMap&TypCoordEq)?1:0)
     34    <<") Deg("<<((mTypCoorMap&TypCoordDD)?1:0)
     35    <<") Hour("<<((mTypCoorMap&TypCoordHD)?1:0)
     36    <<") Rad("<<((mTypCoorMap&TypCoordRR)?1:0)<<")"<<endl;
    1737}
    1838
  • trunk/ArchTOIPipe/ProcWSophya/map2toi.h

    r1520 r1530  
    4242  inline void SetCoorMap(TypAstroCoord mfg=TypCoordGalStd)
    4343              {mTypCoorMap = mfg;}
     44  // Print
     45  void Print(ostream & os);
    4446
    4547protected:
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.cc

    r1520 r1530  
    1212 SetCoorIn();
    1313 SetCoorOut();
     14 SetTestFlag();
     15 SetTestMin();
     16 SetTestMax();
    1417
    1518 if(mSph->NbPixels()<1) {
     
    4043{
    4144 if(mWSph && !mWSphInternal) delete mWSph;
     45}
     46
     47////////////////////////////////////////////////////////////////////////
     48void TOI2Map::Print(ostream & os)
     49{
     50  os<<"TOI2Map::Print -- Sphere NLat = "<<mSph->SizeIndex()<<endl
     51
     52    <<"   - Equinoxe="<<mActualYear<<endl
     53
     54    <<"   - TypCoorIn: Gal("<<((mTypCoorIn&TypCoordGal)?1:0)
     55    <<") Eq("<<((mTypCoorIn&TypCoordEq)?1:0)
     56    <<") Deg("<<((mTypCoorIn&TypCoordDD)?1:0)
     57    <<") Hour("<<((mTypCoorIn&TypCoordHD)?1:0)
     58    <<") Rad("<<((mTypCoorIn&TypCoordRR)?1:0)<<")"<<endl
     59
     60    <<"   - TypCoorOut: Gal("<<((mTypCoorOut&TypCoordGal)?1:0)
     61    <<") Eq("<<((mTypCoorOut&TypCoordEq)?1:0)
     62    <<") Deg("<<((mTypCoorOut&TypCoordDD)?1:0)
     63    <<") Hour("<<((mTypCoorOut&TypCoordHD)?1:0)
     64    <<") Rad("<<((mTypCoorOut&TypCoordRR)?1:0)<<")"<<endl
     65
     66    <<"   - Tests: Flag("<<mTFlag<<") bad="<<mBadFlag
     67    <<" / Value Min("<<mTMin<<")="<<mValMin
     68    <<" , Max("<<mTMax<<")="<<mValMax<<endl;
    4269}
    4370
     
    92119
    93120  getData(2,s,bolo,fgbolo);
    94   if(bolo<-32767.) continue; // Bidouille (A CORRIGER QUAND FGBOLO DISPO)
     121  if(mTFlag && fgbolo&mBadFlag) continue;
     122  if(mTMin && bolo<mValMin) continue;
     123  if(mTMax && bolo>mValMax) continue;
    95124
    96125  // sphere phi   entre [0,2*Pi] en radians
     
    115144  int_4 ipix = mSph->PixIndexSph(theta,phi);
    116145  (*mSph)(ipix) += bolo;   
    117   ((*mWSph)(ipix))++;
     146  ((*mWSph)(ipix)) += 1;
    118147  mNSnFill++;
    119148}
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.h

    r1520 r1530  
    33#define TOI2MAP_H
    44
     5#include "toiprocessor.h"
    56#include "toiprocessor.h"
    67#include "spherehealpix.h"
     
    4142  inline void SetCoorOut(TypAstroCoord mfg=TypCoordGalStd)
    4243              {mTypCoorOut = mfg;}
     44  // Test on flag value ? if yes, BAD sample have flag matching mBadFlag
     45  inline void SetTestFlag(bool tflg=false, int_8 badflg=0)
     46              {mTFlag = tflg; mBadFlag = badflg;}
     47  // Test on min value ? if yes, GOOD sample have value >= mValMin
     48  // Test on max value ? if yes, GOOD sample have value <= mValMax
     49  // Good values are (mValMin <= sample value <= mValMax)
     50  //                      bounds are included
     51  inline void SetTestMin(bool tmin=false, r_8 vmin=-1.e30)
     52              {mTMin = tmin; mValMin = vmin;}
     53  inline void SetTestMax(bool tmax=false, r_8 vmax=+1.e30)
     54              {mTMax = tmax; mValMax = vmax;}
     55  // Print
     56  void Print(ostream & os);
    4357
    4458protected:
     
    4660  SphereHEALPix<r_8>* mWSph;
    4761  bool mWSphInternal;
     62
    4863  TypAstroCoord mTypCoorIn, mTypCoorOut;
    4964  double mActualYear;
     65
     66  bool mTFlag,mTMin,mTMax;
     67  int_8 mBadFlag;
     68  r_8 mValMin,mValMax;
    5069};
    5170
  • trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc

    r1520 r1530  
    137137
    138138 FITSTOIWriter wfits(fitsout);
    139  wfits.setOutFlags(true);
     139 //wfits.setOutFlags(true);
    140140 cout << "fits reader and writer created"<<endl;
    141141
     
    153153 m2toi.SetCoorIn((TypAstroCoord) tcoorin);
    154154 m2toi.SetCoorMap((TypAstroCoord) tcoormap);
     155 m2toi.Print(cout);
    155156
    156157 // Definition des tuyaux
  • trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc

    r1520 r1530  
    2020     <<"           [-a label_coord1] [-d label_coord2] [-b label_bolomuv]"<<endl
    2121     <<"           [-n nlat] [-i c,h] [-o c,h]"<<endl
     22     <<"           [-m vmin] [-M vmax] [-f flag]"<<endl
    2223     <<"           fitsin_point fitsin_bolo fitsphout [fitsphwout]"<<endl
    2324     <<" -p lp : print level (def=0)"<<endl
     
    2930     <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl
    3031     <<" -n nlat : nlat for Healpix sphere (def=128)"<<endl
    31      <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl
     32     <<" -i c,h : coordIn caracteristics (c=G/E h=H/D/R) (def=G,D)"<<endl
    3233     <<" -o c,h : idem -i for coordOut"<<endl
     34     <<" -m vmin : samples are good if sample value >= vmin"<<endl
     35     <<" -M vmax : samples are good if sample value <= vmax"<<endl
     36     <<" -f flag : samples are bad if match flag"<<endl
    3337     <<" fitsin_point : fits file for pointing"<<endl
    3438     <<" fitsin_bolo : fits file for bolo values"<<endl
     
    4044unsigned long typecoord(char typc,char hd)
    4145// typc : G=galactiques, E=equatoriales, autres=galactiques
    42 // hd : H=heure, D=degre, autres=(heure si typc==E, degre si typc==G)
     46// hd : H=heure, D=degre, R=radian, autres=(heure si typc==E, degre si typc==G)
    4347{
    4448  if(typc!='G' && typc!='E') typc='G';
    45   if(hd!='H' && hd!='D') {if(typc=='E') hd='H'; else hd='D';}
     49  if(hd!='H' && hd!='D' && hd!='R') {if(typc=='E') hd='H'; else hd='D';}
    4650 unsigned long rc=TypCoordUndef;
    4751  if(typc=='G') rc |= TypCoordGal;
    4852    else        rc |= TypCoordEq;
    49   if(hd=='D')   rc |= TypCoordDD;
    50     else        rc |= TypCoordHD;
     53  if(hd=='D')        rc |= TypCoordDD;
     54    else if(hd=='R') rc |= TypCoordRR;
     55      else           rc |= TypCoordHD;
    5156  return rc;
    5257}
     
    6065int lp = 0, width = 8192;
    6166int nlat = 128;   // npixel = 12 * nlat^2
    62 char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV";
     67bool tflg=false, tmin=false, tmax=false;
     68r_8 vmin=-1.e30, vmax=1.e30; int_8 badflg=0;
     69char *label_coord1 = "coord1", *label_coord2 = "coord2"
     70   , *label_bolomuv = "boloMuV";
    6371long sdeb,sfin;
    6472string fitsphwout = "";
    6573unsigned long tcoorin=typecoord(), tcoorout=typecoord();
    6674int c; char t=' ',h=' ';
    67 while((c = getopt(narg,arg,"hp:s:w:a:d:b:n:i:o:")) != -1) {
     75while((c = getopt(narg,arg,"hp:s:w:a:d:b:n:i:o:m:M:f:")) != -1) {
    6876  switch (c) {
    6977  case 's' :
     
    103111    tcoorout=typecoord(t,h);
    104112    break;
     113  case 'm' :
     114    sscanf(optarg,"%lf",&vmin);
     115    tmin = true;
     116    break;
     117  case 'M' :
     118    sscanf(optarg,"%lf",&vmax);
     119    tmax = true;
     120    break;
     121  case 'f' :
     122    sscanf(optarg,"%ld",&badflg);
     123    tflg = true;
     124    break;
    105125  case 'h' :
    106126  default:
     
    116136if(optind+3<narg) fitsphwout = arg[optind+3];
    117137
    118 {
    119 unsigned long tg,te,hd,dd;
    120138cout<<">>>> tsttoi2map:"<<endl
    121139    <<"Pipe Window Size "<<width<<endl
    122140    <<"Fits Infile Bolo "<<fitsin_bolo<<endl
    123141    <<"  ...label_bolomuv "<<label_bolomuv<<endl;
    124 tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq;
    125 hd = tcoorin&TypCoordHD;  dd = tcoorin&TypCoordDD;
    126142cout<<"Fits Infile Pointing "<<fitsin_point<<endl
    127143    <<"  ...label_coord1 "<<label_coord1<<endl
    128     <<"  ...label_coord2 "<<label_coord2<<endl
    129     <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
    130 tg = tcoorout&TypCoordGal; te = tcoorout&TypCoordEq;
    131 hd = tcoorout&TypCoordHD;  dd = tcoorout&TypCoordDD;
     144    <<"  ...label_coord2 "<<label_coord2<<endl;
    132145cout<<"Fits Healpix Sphere "<<fitsphout<<endl
    133     <<"  ...nlat "<<nlat<<endl
    134     <<"  ...... Gal="<<tg<<" Eq="<<te<<"   hour="<<hd<<" deg="<<dd<<endl;
     146    <<"  ...nlat "<<nlat<<endl;
    135147cout<<"Fits Healpix Weight Sphere "<<fitsphwout<<endl;
    136 }
    137148
    138149SophyaInit();
     
    157168 SphereHEALPix<r_8>* sph = new SphereHEALPix<r_8>(nlat);
    158169 cout<<"SphereHEALPix: Type de map : "<<sph->TypeOfMap()<<endl
    159      <<"               Nombre de pixels : "<<sph->NbPixels()<<endl;
     170     <<"               Nombre de pixels : "<<sph->NbPixels()<<endl
     171     <<"               Nlat : "<<sph->SizeIndex()<<endl;
    160172
    161173 // Creation de la sphere de poids Healpix
     
    163175 if(fitsphwout.size()>0) {
    164176   wsph = new SphereHEALPix<r_8>;
    165    cout<<"SphereHEALPix Weight: Type de map : "<<wsph->TypeOfMap()<<endl
    166        <<"              Nombre de pixels : "<<wsph->NbPixels()<<endl;
     177   cout<<"SphereHEALPix Weight Created"<<endl;
    167178 }
    168179
     
    173184 toi2m.SetCoorIn((TypAstroCoord) tcoorin);
    174185 toi2m.SetCoorOut((TypAstroCoord) tcoorout);
     186 toi2m.SetTestFlag(tflg,badflg);
     187 toi2m.SetTestMin(tmin,vmin);
     188 toi2m.SetTestMax(tmax,vmax);
     189 toi2m.Print(cout);
    175190
    176191 // Definition des tuyaux
Note: See TracChangeset for help on using the changeset viewer.