Changeset 1516 in Sophya for trunk/ArchTOIPipe/ProcWSophya


Ignore:
Timestamp:
Jun 12, 2001, 6:00:35 PM (24 years ago)
Author:
cmv
Message:

Re-shape de toi2map cmv 12/6/01

Location:
trunk/ArchTOIPipe/ProcWSophya
Files:
2 edited

Legend:

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

    r1498 r1516  
    44#include "ctimer.h"
    55#include "toi2map.h"
    6 #include "xastropack.h"
    76
    87////////////////////////////////////////////////////////////////////////
    98TOI2Map::TOI2Map(SphereHEALPix<r_8>* sph,SphereHEALPix<r_8>* wsph)
    10   : mSph(sph), mWSph(wsph), mWSphInternal(false), mTypCoor(false), fTypCoor(false), mActualYear(2001.)
     9  : mSph(sph), mWSph(wsph), mWSphInternal(false)
    1110{
     11 SetEquinox();
     12 SetCoorIn();
     13 SetCoorOut();
     14
    1215 if(mSph->NbPixels()<1) {
    1316  cout<<"TOI2Map::TOI2Map() Bad number of pixels in sphere mSph "
     
    4447  declareInput("Coord1In");     // input index 0
    4548  declareInput("Coord2In");     // input index 1
    46   declareInput("BoloIn");      // input index 2
     49  declareInput("BoloIn");       // input index 2
    4750}
    4851
     
    6164  throw ParmError("TOI2Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
    6265}
     66if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) {
     67  cout<<"TOI2Map::run() - Input Coordinates not Eq or Gal! "<<endl;
     68  throw ParmError("TOI2Map::run() - Input Coordinates not Eq or Gal!");
     69}
     70if( !(mTypCoorOut&TypCoordEq || mTypCoorOut&TypCoordGal) ) {
     71  cout<<"TOI2Map::run() - Output Coordinates not Eq or Gal! "<<endl;
     72  throw ParmError("TOI2Map::run() - Output Coordinates not Eq or Gal!");
     73}
    6374
    6475//---------------------------------------------------------
     
    6980uint_4 mNSnFill=0, mNpixFill=0, NFill[NFILL];
    7081for(ii=0;ii<NFILL;ii++) NFill[ii]=0;
     82double mjd = MJDfrYear(mActualYear);
    7183
    7284// Remplissage des spheres
    7385for(int s=snb;s<=sne;s++) {
    74   int_8 fgbolo = 0; 
     86  int_8 fgbolo = 0;
    7587  double bolo;
     88  //              Equatoriales   /   Galactiques
     89  // coord1,2 =   alpha,delta    /   gLon,gLat
     90  double coord1 = getData(0,s);
     91  double coord2 = getData(1,s);
    7692
    77   double coord1 = getData(0,s); // gLat ou delta entre [-90,90] en degres
    78   double coord2 = getData(1,s); // gLon entre [0,360[ en degres ou alpha entre [0,24[ en heures
    7993  getData(2,s,bolo,fgbolo);
     94  if(bolo<-32767.) continue; // Bidouille (A CORRIGER QUAND FGBOLO DISPO)
    8095
    81   if(coord2<-90. || coord2>90.) fgbolo=1;
    82   if((coord1<0.) || (!mTypCoor && coord1>=24.) || (mTypCoor && coord1>=360.) ) {fgbolo=1;
    83   cout << "!!!!!!!!" <<coord1 << endl;
     96  // sphere phi   entre [0,2*Pi] en radians
     97  // sphere theta entre [0,Pi]   en radians
     98  double phi,theta;
     99  CoordConvertToStd(mTypCoorIn,coord1,coord2);
     100  if(mTypCoorIn&TypCoordEq && mTypCoorOut&TypCoordGal) { // Eq -> Gal
     101    EqtoGal(mjd,coord1,coord2,&coord1,&coord2);
     102    phi   = coord1 * M_PI/180.;
     103  } else if(mTypCoorIn&TypCoordGal && mTypCoorOut&TypCoordEq) { // Gal -> Eq
     104    GaltoEq(mjd,coord1,coord2,&coord1,&coord2);
     105    phi   = coord1 * M_PI/12.;
     106  } else if(mTypCoorOut&TypCoordGal) { // Gal -> Gal
     107    phi   = coord1 * M_PI/180.;
     108  } else if(mTypCoorOut&TypCoordEq) { // Eq -> Eq
     109    phi   = coord1 * M_PI/12.;
    84110  }
    85  
    86  
    87  
    88   if(bolo<-32767.) fgbolo=1;   // Bidouille Archeops
    89  
    90   if(!fgbolo) {
    91     // sphere phi entre [0,2*Pi] en radians
    92     // sphere phi entre [0,2*Pi] en radians
    93     // sphere theta entre [0,Pi] en radians
    94     double phi,theta;
    95     if(fTypCoor && !mTypCoor) { //on a alpha,delta et on veut l,b
    96       double mjd = MJDfrYear(mActualYear);
    97       EqtoGal(mjd,coord1,coord2,&coord1,&coord2);
    98     }
     111  theta = (90.-coord2) * M_PI/180.;
     112  if(phi<0.   || phi>=2*M_PI) continue;
     113  if(theta<0. || theta>=M_PI) continue;
    99114
    100     if(!fTypCoor && mTypCoor) { //on a l,b et on veut alpha,delta
    101       double mjd = MJDfrYear(mActualYear);
    102       GaltoEq(mjd,coord1,coord2,&coord1,&coord2);
    103     }
    104    
    105     if(fTypCoor) phi = coord1 * M_PI/180.;
    106     else  phi = coord1 * M_PI/12.;
    107 
    108     theta = (90.-coord2)*M_PI/180.;
    109 
    110     int_4 ipix = mSph->PixIndexSph(theta,phi);
    111     (*mSph)(ipix) += bolo;   
    112     ((*mWSph)(ipix))++;
    113     mNSnFill++;
    114   }
     115  int_4 ipix = mSph->PixIndexSph(theta,phi);
     116  (*mSph)(ipix) += bolo;   
     117  ((*mWSph)(ipix))++;
     118  mNSnFill++;
    115119}
    116120
     
    129133     <<"  mNpixFill="<<mNpixFill
    130134     <<"  mNSnFill="<<mNSnFill<<endl
    131      <<" --> FracSky="<<mNpixFill*100./(double)mSph->NbPixels()<<"%"<<endl
    132      <<"NFill["<<NFILL<<"] = "<<endl;
    133  for(ii=0;ii<NFILL;ii++) cout<<NFill[ii]<<" ";
     135     <<"  --> FracSky="<<mNpixFill*100./(double)mSph->NbPixels()<<"%"
     136     <<"  NFill["<<NFILL<<"] ="<<endl;
     137 for(ii=0;ii<NFILL;ii++) {cout<<NFill[ii]<<" "; if(ii%10==9) cout<<endl;}
    134138 cout<<endl;
    135139
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.h

    r1498 r1516  
    55#include "toiprocessor.h"
    66#include "spherehealpix.h"
     7#include "flagtoidef.h"
     8#include "xastropack.h"
    79
    810//-- Un projecteur de TOI sur une sphere Healpix
    9 // Lecture de 3 TOI alpha,delta,boloMuV
    10 // Sortie rien
     11// Lecture de 3 TOI coord1,coord2,boloMuV
     12// Sortie pas de TOI, une (2) sphere(s) Healpix
    1113//
    1214// Structure generale :
    13 // (les alpha[0,360[,delta[-90,90] sont en degres decimaux)
    14 //                         |---->Sphere
    15 //                         |
    16 //                    -----------
     15//                          |---->Sphere
     16//                          |
     17//                     -----------
    1718//   toi Coord1In ---> |         |
    1819//   toi Coord2In ---> | TOI2Map |
    19 //   toi BoloIn  ---> |         |
    20 //                    -----------
     20//   toi BoloIn   ---> |         |
     21//                     -----------
     22// Gestion du type de coordonnees :
     23// Coord1In,Coord2In : soit Equatoriales (Alpha,Delta)
     24//                     soit Galactiques  (GLong,GLat)
     25// Sortie sur une sphere en coordonnees Equatoriales ou Galactiques
    2126
    2227class TOI2Map : public TOIProcessor {
     
    2530  virtual       ~TOI2Map();
    2631
    27   virtual void  init(void); 
     32  virtual void  init(void);
    2833  virtual void  run(void);
    29   inline  void  SetCoorGal(bool mfg=false,bool ffg=false,double actualyear=2000.)
    30                           {mTypCoor = mfg; fTypCoor = ffg; mActualYear = actualyear;}
    31  
     34
     35  // Coordonnees donnees en entree et en sortie
     36  inline void SetEquinox(double actualyear=2000.)
     37              {mActualYear = actualyear;}
     38  inline void SetCoorIn(TypAstroCoord mfg=TypCoordGalStd)
     39              {mTypCoorIn = mfg;}
     40  inline void SetCoorOut(TypAstroCoord mfg=TypCoordGalStd)
     41              {mTypCoorOut = mfg;}
     42
    3243protected:
    3344  SphereHEALPix<r_8>* mSph;
    3445  SphereHEALPix<r_8>* mWSph;
    3546  bool mWSphInternal;
    36   bool mTypCoor;
    37   bool fTypCoor;
     47  TypAstroCoord mTypCoorIn, mTypCoorOut;
    3848  double mActualYear;
    3949};
Note: See TracChangeset for help on using the changeset viewer.