Changeset 1520 in Sophya for trunk/ArchTOIPipe/ProcWSophya


Ignore:
Timestamp:
Jun 12, 2001, 7:40:20 PM (24 years ago)
Author:
cmv
Message:

Re-shape de map2toi cmv 12/6/01

Location:
trunk/ArchTOIPipe/ProcWSophya
Files:
4 edited

Legend:

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

    r1514 r1520  
    88: mSph(sph)
    99{
     10 SetEquinox();
     11 SetCoorIn();
     12 SetCoorMap();
    1013}
    1114
     
    1720void Map2TOI::init() {
    1821  cout << "Map2TOI::init" << endl;
    19   declareInput("AlphaIn");     // input  index 0
    20   declareInput("DeltaIn");     // input  index 1
    21   declareOutput("AlphaOut");   // output index 0
    22   declareOutput("DeltaOut");   // output index 1
    23   declareOutput("BoloOut");    // output index 2
     22  declareInput("Coord1In");     // input  index 0
     23  declareInput("Coord2In");     // input  index 1
     24  declareOutput("Coord1Out");   // output index 0
     25  declareOutput("Coord2Out");   // output index 1
     26  declareOutput("BoloOut");     // output index 2
    2427}
    2528
     
    3942}
    4043if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1)) {
    41   cout<<"Map2TOI::run() - Input TOI (AlphaIn or DeltaIn) not connected! "<<endl;
    42   throw ParmError("Map2TOI::run() Output TOI (AlphaIn or DeltaIn) not connected!");
     44  cout<<"Map2TOI::run() - Input TOI (Coord1In or Coord2In) not connected! "<<endl;
     45  throw ParmError("Map2TOI::run() Output TOI (Coord1In or Coord2In) not connected!");
    4346}
    44 bool connected_AlphaOut = checkOutputTOIIndex(0);
    45 bool connected_DeltaOut = checkOutputTOIIndex(1);
     47bool connected_Coord1Out = checkOutputTOIIndex(0);
     48bool connected_Coord2Out = checkOutputTOIIndex(1);
    4649if(!checkOutputTOIIndex(2)) {
    4750  cout<<"Map2TOI::run() - Output TOI (BoloOut) not connected! "<<endl;
    4851  throw ParmError("Map2TOI::run() Output TOI (BoloOut) not connected!");
     52}
     53if( !(mTypCoorIn&TypCoordEq || mTypCoorIn&TypCoordGal) ) {
     54  cout<<"Map2TOI::run() - CoordIn Coordinates not Eq or Gal! "<<endl;
     55  throw ParmError("Map2TOI::run() - CoordIn Coordinates not Eq or Gal!");
     56}
     57if( !(mTypCoorMap&TypCoordEq || mTypCoorMap&TypCoordGal) ) {
     58  cout<<"Map2TOI::run() - Sphere Coordinates not Eq or Gal! "<<endl;
     59  throw ParmError("Map2TOI::run() - Sphere Coordinates not Eq or Gal!");
    4960}
    5061
     
    5263try {
    5364
     65uint_4 mSnRead=0, mSnFilled=0;
     66double mjd = MJDfrYear(mActualYear);
     67
    5468for(int k=snb;k<=sne;k++) {
    5569
    5670  int_8 flg = 0;
    57   //  double alpha = getData(0,k); // alpha entre [0,24[ en heures
    58   //  if(alpha<0. || alpha>=24.) flg=1;
    59   // On passe l'angle en longitude en degres - de [0,360[ deg
    60   double alpha = getData(0,k); // alpha entre [0,360[ en heures
    61   if(alpha<0. || alpha>=360.) flg=1;
    62   double delta = getData(1,k); // delta entre [-90,90] en degres
    63   if(delta<-90. || delta>90.) flg=1;
    64   double bolo = -99999.;
     71  double coord1 = getData(0,k);
     72  double coord2 = getData(1,k);
     73  double c1 = coord1, c2=coord2, bolo = -99999.;
     74  mSnRead++;
     75
     76  // Convert CoordIn to Standard
     77  double phi=-1.,theta;
     78  CoordConvertToStd(mTypCoorIn,c1,c2);
     79  if(mTypCoorIn&TypCoordEq && mTypCoorMap&TypCoordGal) { // CIn=Eq  CMap=Gal
     80    EqtoGal(mjd,c1,c2,&c1,&c2);
     81    phi   = c1 * M_PI/180.;
     82  } else if(mTypCoorIn&TypCoordGal && mTypCoorMap&TypCoordEq) { // CIn=Gal CMap=Eq
     83    GaltoEq(mjd,c1,c2,&c1,&c2);
     84    phi   = c1 * M_PI/12.;
     85  } else if(mTypCoorMap&TypCoordGal) { // CIn=Gal CMap=Gal
     86    phi   = c1 * M_PI/180.;
     87  } else if(mTypCoorMap&TypCoordEq) { // CIn=Eq CMap=Eq
     88    phi   = c1 * M_PI/12.;
     89  }
     90  theta = (90.-c2) * M_PI/180.;
     91  if(phi<0.   || phi>=2*M_PI) flg=FlgToiOut;
     92  if(theta<0. || theta>=M_PI) flg=FlgToiOut;
    6593
    6694  if(!flg) {
    67     //    double phi   = alpha *M_PI/12.; // sphere phi entre [0,2*Pi] en radian
    68     double phi   = alpha *M_PI/180.; // sphere phi entre [0,2*Pi] en radian
    69     double teta  = (90.-delta) *M_PI/180.; // sphere teta entre [0,Pi] en radian
    70     bolo = mSph(teta,phi);
     95    bolo = mSph(theta,phi);
     96    mSnFilled++;
    7197  }
    7298
    73   if(connected_AlphaOut) putData(0,k,alpha,0);
    74   if(connected_DeltaOut) putData(1,k,delta,0);
     99  if(connected_Coord1Out) putData(0,k,coord1,flg);
     100  if(connected_Coord2Out) putData(1,k,coord2,flg);
    75101  putData(2,k,bolo,flg);
    76102}
     103
     104cout<<"TOI2Map::run: Samples Read "<<mSnRead<<" Filled "<<mSnFilled<<endl;
    77105
    78106//---------------------------------------------------------
  • trunk/ArchTOIPipe/ProcWSophya/map2toi.h

    r1463 r1520  
    55#include "toiprocessor.h"
    66#include "spherehealpix.h"
     7#include "flagtoidef.h"
     8#include "xastropack.h"
    79
    8 //-- Un generateur de TOI a partir d'une sphere et de 2 TOIs alpha,delta
    9 // Lecture de 2 TOI alpha,delta et d'une Sphere Healpix
    10 // Sortie de 3 TOI alpha,delta,boloMuV
     10//-- Un generateur de TOI a partir d'une sphere et de 2 TOIs coordin1,coordin2
     11// Lecture de 2 TOI coord1,coord2 et d'une Sphere Healpix
     12// Sortie de 3 TOI coord1,coord2,boloMuV
    1113//
    1214// Structure generale :
    13 // (les alpha[0,360[,delta[-90,90] sont en degres decimaux)
    1415//             Sphere ---- |
    1516//                         |
    16 //                    -----------
    17 //   toi AlphaIn ---> |         | ---> toi AlphaOut
    18 //                    | Map2TOI | ---> toi DeltaOut
    19 //   toi DeltaIn ---> |         | ---> toi BoloOut
    20 //                    -----------
     17//                     -----------
     18//   toi CoordIn1 ---> |         | ---> toi CoordOut1
     19//                     | Map2TOI | ---> toi CoordOut2
     20//   toi CoordIn2 ---> |         | ---> toi BoloOut
     21//                     -----------
     22// Gestion du type de coordonnees :
     23// Coord1In,Coord2In : soit Equatoriales (Alpha,Delta)
     24//                     soit Galactiques  (GLong,GLat)
     25// La sphere peut avoir des coordonnees differentes des CoordIn
     26// Si les CoordIn et les CoordSphere sont equatoriales -> meme equinoxe!
     27// La sortie CoordOut aura les MEMES coordonnees que les CoordIn
    2128
    2229class Map2TOI : public TOIProcessor {
     
    2532  virtual       ~Map2TOI();
    2633
    27   virtual void  init(void); 
     34  virtual void  init(void);
    2835  virtual void  run(void);
    29  
     36
     37  // Pour savoir si on a de HourDeg,DegDeg,RadRad
     38  inline void SetEquinox(double actualyear=2000.)
     39              {mActualYear = actualyear;}
     40  inline void SetCoorIn(TypAstroCoord mfg=TypCoordGalStd)
     41              {mTypCoorIn = mfg;}
     42  inline void SetCoorMap(TypAstroCoord mfg=TypCoordGalStd)
     43              {mTypCoorMap = mfg;}
     44
    3045protected:
    3146  SphereHEALPix<r_8>& mSph;
     47  TypAstroCoord mTypCoorIn,mTypCoorMap;
     48  double mActualYear;
    3249};
    3350
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.cc

    r1516 r1520  
    9696  // sphere phi   entre [0,2*Pi] en radians
    9797  // sphere theta entre [0,Pi]   en radians
    98   double phi,theta;
     98  double phi=-1.,theta;
    9999  CoordConvertToStd(mTypCoorIn,coord1,coord2);
    100100  if(mTypCoorIn&TypCoordEq && mTypCoorOut&TypCoordGal) { // Eq -> Gal
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.h

    r1516 r1520  
    2424//                     soit Galactiques  (GLong,GLat)
    2525// Sortie sur une sphere en coordonnees Equatoriales ou Galactiques
     26// Si les CoordIn et les CoordOut sont equatoriales -> meme equinoxe!
    2627
    2728class TOI2Map : public TOIProcessor {
Note: See TracChangeset for help on using the changeset viewer.