Changeset 1498 in Sophya


Ignore:
Timestamp:
May 17, 2001, 5:43:42 PM (24 years ago)
Author:
ansari
Message:

Commit de la modif toi2map.cc .h par Cecile - Reza 17/5/2001

Location:
trunk/ArchTOIPipe
Files:
3 edited

Legend:

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

    r1466 r1498  
    88////////////////////////////////////////////////////////////////////////
    99TOI2Map::TOI2Map(SphereHEALPix<r_8>* sph,SphereHEALPix<r_8>* wsph)
    10   : mSph(sph), mWSph(wsph), mWSphInternal(false), mTypCoor(false), mActualYear(2001.)
     10  : mSph(sph), mWSph(wsph), mWSphInternal(false), mTypCoor(false), fTypCoor(false), mActualYear(2001.)
    1111{
    1212 if(mSph->NbPixels()<1) {
     
    4242void TOI2Map::init() {
    4343  cout << "TOI2Map::init" << endl;
    44   declareInput("AlphaIn");     // input index 0
    45   declareInput("DeltaIn");     // input index 1
     44  declareInput("Coord1In");     // input index 0
     45  declareInput("Coord2In");     // input index 1
    4646  declareInput("BoloIn");      // input index 2
    4747}
     
    5858}
    5959if(!checkInputTOIIndex(0) || !checkInputTOIIndex(1) || !checkInputTOIIndex(2)) {
    60   cout<<"TOI2Map::run() - Input TOI (AlphaIn or DeltaIn or BoloIn) not connected! "<<endl;
    61   throw ParmError("TOI2Map::run() Output TOI (AlphaIn or DeltaIn or BoloIn) not connected!");
     60  cout<<"TOI2Map::run() - Input TOI (Coord1In or Coord2In or BoloIn) not connected! "<<endl;
     61  throw ParmError("TOI2Map::run() Output TOI (Coord1In or Coord2In or BoloIn) not connected!");
    6262}
    6363
     
    7575  double bolo;
    7676
    77   double alpha = getData(0,s); // alpha entre [0,24[ en heures
    78   double delta = getData(1,s); // delta entre [-90,90] en degres
     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
    7979  getData(2,s,bolo,fgbolo);
    8080
    81   if(delta<-90. || delta>90.)  fgbolo=1;
    82   if(alpha<0.   || alpha>=24.) fgbolo=1;
     81  if(coord2<-90. || coord2>90.) fgbolo=1;
     82  if((coord1<0.) || (!mTypCoor && coord1>=24.) || (mTypCoor && coord1>=360.) ) {fgbolo=1;
     83  cout << "!!!!!!!!" <<coord1 << endl;
     84  }
     85 
     86 
     87 
    8388  if(bolo<-32767.) fgbolo=1;   // Bidouille Archeops
    84 
     89 
    8590  if(!fgbolo) {
     91    // sphere phi entre [0,2*Pi] en radians
    8692    // sphere phi entre [0,2*Pi] en radians
    8793    // sphere theta entre [0,Pi] en radians
    8894    double phi,theta;
    89     if(mTypCoor) {
     95    if(fTypCoor && !mTypCoor) { //on a alpha,delta et on veut l,b
    9096      double mjd = MJDfrYear(mActualYear);
    91       EqtoGal(mjd,alpha,delta,&alpha,&delta);
    92       phi   = alpha * M_PI/180.;
    93     } else phi = alpha * M_PI/12.;
    94     theta = (90.-delta)*M_PI/180.;
     97      EqtoGal(mjd,coord1,coord2,&coord1,&coord2);
     98    }
     99
     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
    95110    int_4 ipix = mSph->PixIndexSph(theta,phi);
    96     (*mSph)(ipix) += bolo;
     111    (*mSph)(ipix) += bolo;   
    97112    ((*mWSph)(ipix))++;
    98113    mNSnFill++;
  • trunk/ArchTOIPipe/ProcWSophya/toi2map.h

    r1463 r1498  
    1515//                         |
    1616//                    -----------
    17 //   toi AlphaIn ---> |         |
    18 //   toi DeltaIn ---> | TOI2Map |
     17//   toi Coord1In ---> |         |
     18//   toi Coord2In ---> | TOI2Map |
    1919//   toi BoloIn  ---> |         |
    2020//                    -----------
     
    2727  virtual void  init(void); 
    2828  virtual void  run(void);
    29   inline  void  SetCoorGal(bool fg=false,double actualyear=2000.)
    30                           {mTypCoor = fg; mActualYear = actualyear;}
     29  inline  void  SetCoorGal(bool mfg=false,bool ffg=false,double actualyear=2000.)
     30                          {mTypCoor = mfg; fTypCoor = ffg; mActualYear = actualyear;}
    3131 
    3232protected:
     
    3535  bool mWSphInternal;
    3636  bool mTypCoor;
     37  bool fTypCoor;
    3738  double mActualYear;
    3839};
  • trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc

    r1476 r1498  
    11#include <unistd.h>
    22#include <stdexcept>
    3 
     3#include <stdlib.h>
     4#include <stdio.h>
    45#include "toi.h"
    56#include "toiprocessor.h"
     
    1718void usage(void) {
    1819 cout<<"tsttoi2map [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl
    19      <<"           [-a label_alpha] [-d label_delta] [-b label_bolomuv]"<<endl
    20      <<"           [-n nlat] [-G] fitsin fitsphout fitsphwout"<<endl;
     20     <<"           [-a label_coord1] [-d label_coord2] [-b label_bolomuv]"<<endl
     21     <<"           [-n nlat] coord_ini coord_fin fitsin_bolo fitsin_point fitsphout fitsphwout"<<endl
     22     <<" coord_ini[_fin] = G for Galactic coordinates"<<endl
     23     <<"                 = Q for equatorial coordinates"<<endl
     24     <<" coord1 = alpha or longitude ; coord2 = delta or latitude"<<endl;
    2125 return;
    2226}
     
    3034int lp = 0, width = 8192;
    3135int nlat = 128;   // npixel = 12 * nlat^2
    32 char *label_alpha = "alpha", *label_delta = "delta", *label_bolomuv = "boloMuV";
    33 bool coorgal=false;
     36char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV";
    3437long sdeb,sfin;
    3538int c;
     
    5255    break;
    5356  case 'a' :
    54     label_alpha = optarg;
     57    label_coord1 = optarg;
    5558    break;
    5659  case 'd' :
    57     label_delta = optarg;
     60    label_coord2 = optarg;
    5861    break;
    5962  case 'b' :
     
    6467    if(nlat<0) nlat=128;
    6568    break;
    66   case 'G' :
    67     coorgal = true;
    68     break;
    6969  case 'h' :
    7070    usage(); exit(-1);
     
    7474  }
    7575}
    76 if(optind+1>=narg) {usage(); exit(-2);}
    77 char * fitsin          = arg[optind];
    78 string const fitsphout = arg[optind+1];
     76if(optind+3>=narg) {usage(); exit(-2);}
     77bool mcoorgal=true;
     78bool fcoorgal=true;
     79 
     80if ( strcmp(arg[optind],"Q") == 0) mcoorgal=false;
     81if ( strcmp(arg[optind+1],"Q") == 0) fcoorgal=false;
     82 
     83char * fitsin_bolo = arg[optind+2];
     84char * fitsin_point = arg[optind+3];
     85string const fitsphout = arg[optind+4];
    7986string fitsphwout = "";
    80 if(optind+2<narg) fitsphwout = arg[optind+2];
     87if(optind+5<narg) fitsphwout = arg[optind+5];
    8188
    8289cout<<">>>> tsttoi2map:"<<endl
    83     <<"Fits Infile(snum,alpha,delta,bolomuv)= "<<fitsin<<endl
    84     <<"  ...label_alpha "<<label_alpha<<"  ,  label_delta "<<label_delta<<endl
     90    <<"Fits Infile(snum,bolomuv)= "<<fitsin_bolo<<endl
     91    <<"Fits Infile(snum,coord1,coord2)= "<<fitsin_point<<endl
     92    <<"  ...label_coord1 "<<label_coord1<<"  ,  label_coord2 "<<label_coord2<<endl
     93    <<"  with coordinates Gal "<<mcoorgal<<endl
    8594    <<"  ...label_bolomuv "<<label_bolomuv<<endl
    8695    <<"Fits Sphere Healpix"<<fitsphout<<endl
    8796    <<"  ...nlat "<<nlat<<endl
     97    <<"  with coordinates Gal "<<fcoorgal<<endl
    8898    <<"Fits Sphere Healpix Error "<<fitsphwout<<endl;
    8999
     
    96106
    97107 // FITS reader
    98  FITSTOIReader rfits(fitsin);
    99  int ncol = rfits.getNOut();
    100  cout<<"Number of columns in fits Infile : "<<ncol<<endl;
    101  if(ncol<3) exit(-3);
     108 FITSTOIReader rfitsb(fitsin_bolo);
     109 int ncolb = rfitsb.getNOut();
     110 cout<<"Number of columns in fits Infile_bolo : "<<ncolb<<endl;
     111 if(ncolb<1) exit(-3);
     112
     113 FITSTOIReader rfitsp(fitsin_point);
     114 int ncolp = rfitsp.getNOut();
     115 cout<<"Number of columns in fits Infile_point : "<<ncolp<<endl;
     116 if(ncolp<2) exit(-3);
    102117
    103118 // Creation de la sphere Healpix
     
    117132 TOI2Map toi2m(sph,wsph);
    118133 cout<<"TOI2Map created"<<endl;
    119  toi2m.SetCoorGal(coorgal,2000.);  // equinoxe de ref. 2000. (pour archtoi)
     134 toi2m.SetCoorGal(mcoorgal,fcoorgal,2000.);  // equinoxe de ref. 2000. (pour archtoi)
    120135
    121136 // Definition des tuyaux
    122  TOISeqBuffered * toialphain = new TOISeqBuffered("toi_alpha_in",width);
    123  if(lp) toialphain->setDebugLevel(1);
    124  rfits.addOutput(label_alpha,toialphain);
    125  toi2m.addInput("AlphaIn",toialphain);
    126 
    127  TOISeqBuffered * toideltain = new TOISeqBuffered("toi_delta_in",width);
    128  if(lp) toideltain->setDebugLevel(1);
    129  rfits.addOutput(label_delta,toideltain);
    130  toi2m.addInput("DeltaIn",toideltain);
    131 
     137 TOISeqBuffered * toicoord1in = new TOISeqBuffered("toi_coord1_in",width);
     138 if(lp) toicoord1in->setDebugLevel(1);
     139 rfitsp.addOutput(label_coord1,toicoord1in);
     140 toi2m.addInput("Coord1In",toicoord1in);
     141
     142 TOISeqBuffered * toicoord2in = new TOISeqBuffered("toi_coord2_in",width);
     143 if(lp) toicoord2in->setDebugLevel(1);
     144 rfitsp.addOutput(label_coord2,toicoord2in);
     145 toi2m.addInput("Coord2In",toicoord2in);
     146 
    132147 TOISeqBuffered * toibolin = new TOISeqBuffered("toi_bolo_in",width);
    133148 if(lp) toibolin->setDebugLevel(1);
    134  rfits.addOutput(label_bolomuv,toibolin);
     149 rfitsb.addOutput(label_bolomuv,toibolin);
    135150 toi2m.addInput("BoloIn",toibolin);
    136151
    137152 // Run
    138153 cout<<"----- FITSReaderTOI::PrintStatus() : -----"<<endl;
    139  rfits.PrintStatus(cout);
     154 rfitsp.PrintStatus(cout);
     155 rfitsb.PrintStatus(cout);
    140156
    141157 PrtTim("starting threads");
    142  rfits.start();
     158 rfitsp.start();
     159 rfitsb.start();
    143160 toi2m.start();
    144161
    145162 if(lp>1)
    146163   for(int jjjj=0;jjjj<5;jjjj++) {
    147      cout<<*toialphain;
     164     cout<<*toicoord1in;
    148165     cout<<*toibolin;
    149166     sleep(2);
Note: See TracChangeset for help on using the changeset viewer.