Changeset 1520 in Sophya
- Timestamp:
- Jun 12, 2001, 7:40:20 PM (24 years ago)
- Location:
- trunk/ArchTOIPipe
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/ProcWSophya/map2toi.cc
r1514 r1520 8 8 : mSph(sph) 9 9 { 10 SetEquinox(); 11 SetCoorIn(); 12 SetCoorMap(); 10 13 } 11 14 … … 17 20 void Map2TOI::init() { 18 21 cout << "Map2TOI::init" << endl; 19 declareInput(" AlphaIn"); // input index 020 declareInput(" DeltaIn"); // input index 121 declareOutput(" AlphaOut"); // output index 022 declareOutput(" DeltaOut"); // output index 123 declareOutput("BoloOut"); // output index 222 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 24 27 } 25 28 … … 39 42 } 40 43 if(!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!"); 43 46 } 44 bool connected_ AlphaOut = checkOutputTOIIndex(0);45 bool connected_ DeltaOut = checkOutputTOIIndex(1);47 bool connected_Coord1Out = checkOutputTOIIndex(0); 48 bool connected_Coord2Out = checkOutputTOIIndex(1); 46 49 if(!checkOutputTOIIndex(2)) { 47 50 cout<<"Map2TOI::run() - Output TOI (BoloOut) not connected! "<<endl; 48 51 throw ParmError("Map2TOI::run() Output TOI (BoloOut) not connected!"); 52 } 53 if( !(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 } 57 if( !(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!"); 49 60 } 50 61 … … 52 63 try { 53 64 65 uint_4 mSnRead=0, mSnFilled=0; 66 double mjd = MJDfrYear(mActualYear); 67 54 68 for(int k=snb;k<=sne;k++) { 55 69 56 70 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; 65 93 66 94 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++; 71 97 } 72 98 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); 75 101 putData(2,k,bolo,flg); 76 102 } 103 104 cout<<"TOI2Map::run: Samples Read "<<mSnRead<<" Filled "<<mSnFilled<<endl; 77 105 78 106 //--------------------------------------------------------- -
trunk/ArchTOIPipe/ProcWSophya/map2toi.h
r1463 r1520 5 5 #include "toiprocessor.h" 6 6 #include "spherehealpix.h" 7 #include "flagtoidef.h" 8 #include "xastropack.h" 7 9 8 //-- Un generateur de TOI a partir d'une sphere et de 2 TOIs alpha,delta9 // Lecture de 2 TOI alpha,deltaet d'une Sphere Healpix10 // Sortie de 3 TOI alpha,delta,boloMuV10 //-- 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 11 13 // 12 14 // Structure generale : 13 // (les alpha[0,360[,delta[-90,90] sont en degres decimaux)14 15 // Sphere ---- | 15 16 // | 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 21 28 22 29 class Map2TOI : public TOIProcessor { … … 25 32 virtual ~Map2TOI(); 26 33 27 virtual void init(void); 34 virtual void init(void); 28 35 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 30 45 protected: 31 46 SphereHEALPix<r_8>& mSph; 47 TypAstroCoord mTypCoorIn,mTypCoorMap; 48 double mActualYear; 32 49 }; 33 50 -
trunk/ArchTOIPipe/ProcWSophya/toi2map.cc
r1516 r1520 96 96 // sphere phi entre [0,2*Pi] en radians 97 97 // sphere theta entre [0,Pi] en radians 98 double phi ,theta;98 double phi=-1.,theta; 99 99 CoordConvertToStd(mTypCoorIn,coord1,coord2); 100 100 if(mTypCoorIn&TypCoordEq && mTypCoorOut&TypCoordGal) { // Eq -> Gal -
trunk/ArchTOIPipe/ProcWSophya/toi2map.h
r1516 r1520 24 24 // soit Galactiques (GLong,GLat) 25 25 // Sortie sur une sphere en coordonnees Equatoriales ou Galactiques 26 // Si les CoordIn et les CoordOut sont equatoriales -> meme equinoxe! 26 27 27 28 class TOI2Map : public TOIProcessor { -
trunk/ArchTOIPipe/TestPipes/tstmap2toi.cc
r1476 r1520 17 17 void usage(void) { 18 18 cout<<"tstmap2toi [-h] [-p lp] [-s samplemin,samplemax] [-w data_window_size]"<<endl 19 <<" [-a label_alpha] [-d label_delta] [-b label_bolomuv]"<<endl 20 <<" fitsin fitsphere fitsout"<<endl; 19 <<" [-a label_coord1In] [-d label_coord2In] [-b label_bolomuv]"<<endl 20 <<" [-i c,h] [-m c,h]"<<endl 21 <<" fitsin_point fitsphere fitsout"<<endl 22 <<" -p lp : print level (def=0)"<<endl 23 <<" -s samplemin,samplemax : sample range to be treated (def=all)"<<endl 24 <<" -w data_window_size : window size for pipe (def=8192)"<<endl 25 <<" -a label_coord1 : label fits for alpha/gLong (def=coord1)"<<endl 26 <<" -d label_coord2 : label fits for delta/gLat (def=coord2)"<<endl 27 <<" coord1 = alpha or gLong ; coord2 = delta or gLat"<<endl 28 <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl 29 <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl 30 <<" -m c,h : idem -i for Sphere"<<endl 31 <<" fitsin_point : fits file for pointing"<<endl 32 <<" fitsphere : fits file for input Healpix sphere"<<endl 33 <<" fitsout : fits file for output"<<endl; 21 34 return; 35 } 36 37 unsigned long typecoord(char typc=' ',char hd=' '); 38 unsigned long typecoord(char typc,char hd) 39 // typc : G=galactiques, E=equatoriales, autres=galactiques 40 // hd : H=heure, D=degre, autres=(heure si typc==E, degre si typc==G) 41 { 42 if(typc!='G' && typc!='E') typc='G'; 43 if(hd!='H' && hd!='D') {if(typc=='E') hd='H'; else hd='D';} 44 unsigned long rc=TypCoordUndef; 45 if(typc=='G') rc |= TypCoordGal; 46 else rc |= TypCoordEq; 47 if(hd=='D') rc |= TypCoordDD; 48 else rc |= TypCoordHD; 49 return rc; 22 50 } 23 51 … … 29 57 //-- Decodage arguments 30 58 int lp = 0, width = 8192; 31 char *label_ alpha = "alpha", *label_delta = "delta", *label_bolomuv = "boloMuV";59 char *label_coord1 = "coord1", *label_coord2 = "coord2", *label_bolomuv = "boloMuV"; 32 60 long sdeb,sfin; 33 int c; 34 while((c = getopt(narg,arg,"hp:s:w:a:d:b:")) != -1) { 61 unsigned long tcoorin=typecoord(), tcoormap=typecoord(); 62 int c; char t=' ',h=' '; 63 while((c = getopt(narg,arg,"hp:s:w:a:d:b:i:m:")) != -1) { 35 64 switch (c) { 36 65 case 's' : … … 38 67 cout<<"Requested Samples from "<<sdeb<<" , "<<sfin<<endl; 39 68 if(sfin>=sdeb) mgr->setRequestedSample(sdeb,sfin); 40 else {cout<<"Bad sample interval "<<endl; exit( -2);}69 else {cout<<"Bad sample interval "<<endl; exit(1);} 41 70 break; 42 71 case 'w' : … … 50 79 break; 51 80 case 'a' : 52 label_ alpha= optarg;81 label_coord1 = optarg; 53 82 break; 54 83 case 'd' : 55 label_ delta= optarg;84 label_coord2 = optarg; 56 85 break; 57 86 case 'b' : 58 87 label_bolomuv = optarg; 59 88 break; 89 case 'i' : 90 sscanf(optarg,"%c,%c",&t,&h); 91 tcoorin=typecoord(t,h); 92 break; 93 case 'm' : 94 sscanf(optarg,"%c,%c",&t,&h); 95 tcoormap=typecoord(t,h); 96 break; 60 97 case 'h' : 61 usage(); exit(-1);62 break;63 98 default: 64 usage(); exit( -1);99 usage(); exit(1); 65 100 } 66 101 } 67 if(optind+2>=narg) {usage(); exit( -2);}68 char * fitsin 102 if(optind+2>=narg) {usage(); exit(2);} 103 char * fitsin_point = arg[optind]; 69 104 string const fitsphere = arg[optind+1]; 70 105 char * fitsout = arg[optind+2]; 71 106 107 { 108 unsigned long tg,te,hd,dd; 72 109 cout<<">>>> tstmap2toi:"<<endl 73 <<"Fits Infile(snum,alpha,delta)= "<<fitsin<<endl 74 <<" ...label_alpha "<<label_alpha<<" , label_delta "<<label_delta<<endl 75 <<"Fits Sphere Healpix"<<fitsphere<<endl 76 <<"Fits Outfile(snum,[alpha,delta],boloMuV)"<<fitsout<<endl 110 <<"Pipe Window Size "<<width<<endl 111 <<"Fits OutFile "<<fitsout<<endl 77 112 <<" ...label_bolomuv "<<label_bolomuv<<endl; 113 tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq; 114 hd = tcoorin&TypCoordHD; dd = tcoorin&TypCoordDD; 115 cout<<"Fits Infile Pointing "<<fitsin_point<<endl 116 <<" ...label_coord1 "<<label_coord1<<endl 117 <<" ...label_coord2 "<<label_coord2<<endl 118 <<" ...... Gal="<<tg<<" Eq="<<te<<" hour="<<hd<<" deg="<<dd<<endl; 119 tg = tcoormap&TypCoordGal; te = tcoormap&TypCoordEq; 120 hd = tcoormap&TypCoordHD; dd = tcoormap&TypCoordDD; 121 cout<<"Fits Healpix Sphere "<<fitsphere<<endl 122 <<" ...... Gal="<<tg<<" Eq="<<te<<" hour="<<hd<<" deg="<<dd<<endl; 123 } 78 124 79 125 SophyaInit(); … … 85 131 86 132 // FITS reader et writer 87 FITSTOIReader rfits(fitsin );133 FITSTOIReader rfits(fitsin_point); 88 134 int ncol = rfits.getNOut(); 89 cout<<"Number of columns in fits Infile : "<<ncol<<endl;90 if(ncol<2) exit( -3);135 cout<<"Number of columns in fits Infile Pointing : "<<ncol<<endl; 136 if(ncol<2) exit(3); 91 137 92 138 FITSTOIWriter wfits(fitsout); … … 104 150 Map2TOI m2toi(sph); 105 151 cout<<"Map2TOI created"<<endl; 152 m2toi.SetEquinox(2000.); 153 m2toi.SetCoorIn((TypAstroCoord) tcoorin); 154 m2toi.SetCoorMap((TypAstroCoord) tcoormap); 106 155 107 156 // Definition des tuyaux 108 TOISeqBuffered * toi alphain = new TOISeqBuffered("toi_alpha_in",width);109 if(lp) toialphain->setDebugLevel(1);110 rfits.addOutput(label_ alpha,toialphain);111 m2toi.addInput(" AlphaIn",toialphain);112 113 TOISeqBuffered * toi alphaout = new TOISeqBuffered("toi_alpha_out",width);114 m2toi.addOutput(" AlphaOut",toialphaout);115 wfits.addInput(label_ alpha,toialphaout);116 117 TOISeqBuffered * toi deltain = new TOISeqBuffered("toi_delta_in",width);118 if(lp) toideltain->setDebugLevel(1);119 rfits.addOutput(label_ delta,toideltain);120 m2toi.addInput(" DeltaIn",toideltain);121 122 TOISeqBuffered * toi deltaout = new TOISeqBuffered("toi_delta_out",width);123 m2toi.addOutput(" DeltaOut",toideltaout);124 wfits.addInput(label_ delta,toideltaout);157 TOISeqBuffered * toicoord1in = new TOISeqBuffered("toi_coord1_in",width); 158 // toicoord1in->setDebugLevel(1); 159 rfits.addOutput(label_coord1,toicoord1in); 160 m2toi.addInput("Coord1In",toicoord1in); 161 162 TOISeqBuffered * toicoord1out = new TOISeqBuffered("toi_coord1_out",width); 163 m2toi.addOutput("Coord1Out",toicoord1out); 164 wfits.addInput(label_coord1,toicoord1out); 165 166 TOISeqBuffered * toicoord2in = new TOISeqBuffered("toi_coord2_in",width); 167 // toicoord2in->setDebugLevel(1); 168 rfits.addOutput(label_coord2,toicoord2in); 169 m2toi.addInput("Coord2In",toicoord2in); 170 171 TOISeqBuffered * toicoord2out = new TOISeqBuffered("toi_coord2_out",width); 172 m2toi.addOutput("Coord2Out",toicoord2out); 173 wfits.addInput(label_coord2,toicoord2out); 125 174 126 175 TOISeqBuffered * toibolout = new TOISeqBuffered("toi_bolo_out",width); 127 if(lp)toibolout->setDebugLevel(1);176 // toibolout->setDebugLevel(1); 128 177 m2toi.addOutput("BoloOut",toibolout); 129 178 wfits.addInput(label_bolomuv,toibolout); … … 142 191 if(lp>1) 143 192 for(int jjjj=0;jjjj<5;jjjj++) { 144 cout<<*toi alphain;193 cout<<*toicoord1in; 145 194 cout<<*toibolout; 146 195 sleep(2); -
trunk/ArchTOIPipe/TestPipes/tsttoi2map.cc
r1516 r1520 29 29 <<" -b label_bolomuv : label fits for bolo value (def=boloMuV)"<<endl 30 30 <<" -n nlat : nlat for Healpix sphere (def=128)"<<endl 31 <<" -i c,h : coord 1caracteristics (c=G/E h=H/D) (def=G,D)"<<endl32 <<" -o c,h : idem -i for coord 2"<<endl31 <<" -i c,h : coordIn caracteristics (c=G/E h=H/D) (def=G,D)"<<endl 32 <<" -o c,h : idem -i for coordOut"<<endl 33 33 <<" fitsin_point : fits file for pointing"<<endl 34 34 <<" fitsin_bolo : fits file for bolo values"<<endl … … 124 124 tg = tcoorin&TypCoordGal; te = tcoorin&TypCoordEq; 125 125 hd = tcoorin&TypCoordHD; dd = tcoorin&TypCoordDD; 126 cout<<" ...label_coord1 "<<label_coord1<<endl 126 cout<<"Fits Infile Pointing "<<fitsin_point<<endl 127 <<" ...label_coord1 "<<label_coord1<<endl 127 128 <<" ...label_coord2 "<<label_coord2<<endl 128 129 <<" ...... Gal="<<tg<<" Eq="<<te<<" hour="<<hd<<" deg="<<dd<<endl;
Note:
See TracChangeset
for help on using the changeset viewer.