source: Sophya/trunk/ArchTOIPipe/ProcWSophya/map2toi.cc@ 1514

Last change on this file since 1514 was 1514, checked in by ansari, 24 years ago

Passage alpha en longitude (0..360) ds map2toi.cc cmv+reza 11/6/2001

File size: 2.7 KB
Line 
1#include "toimanager.h"
2#include "pexceptions.h"
3#include "ctimer.h"
4#include "map2toi.h"
5
6////////////////////////////////////////////////////////////////////////
7Map2TOI::Map2TOI(SphereHEALPix<r_8>& sph)
8: mSph(sph)
9{
10}
11
12Map2TOI::~Map2TOI()
13{
14}
15
16////////////////////////////////////////////////////////////////////////
17void Map2TOI::init() {
18 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
24}
25
26////////////////////////////////////////////////////////////////////////
27void Map2TOI::run() {
28
29if(mSph.NbPixels()<1) {
30 cout<<"Map2TOI::Map2TOI() Bad number of pixels in sphere "<<mSph.NbPixels()<<endl;
31 throw ParmError("Map2TOI::Map2TOI() - Bad number of pixels in sphere");
32}
33
34long snb = getMinIn();
35long sne = getMaxIn();
36if(snb>sne) {
37 cout<<"Map2TOI::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
38 throw ParmError("Map2TOI::run() - Bad sample interval");
39}
40if(!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!");
43}
44bool connected_AlphaOut = checkOutputTOIIndex(0);
45bool connected_DeltaOut = checkOutputTOIIndex(1);
46if(!checkOutputTOIIndex(2)) {
47 cout<<"Map2TOI::run() - Output TOI (BoloOut) not connected! "<<endl;
48 throw ParmError("Map2TOI::run() Output TOI (BoloOut) not connected!");
49}
50
51//---------------------------------------------------------
52try {
53
54for(int k=snb;k<=sne;k++) {
55
56 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.;
65
66 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);
71 }
72
73 if(connected_AlphaOut) putData(0,k,alpha,0);
74 if(connected_DeltaOut) putData(1,k,delta,0);
75 putData(2,k,bolo,flg);
76}
77
78//---------------------------------------------------------
79} catch (PException & exc) {
80 cout<<"Map2TOI: Catched Exception "<<(string)typeid(exc).name()
81 <<"\n .... Msg= "<<exc.Msg()<<endl;
82}
83
84return;
85}
Note: See TracBrowser for help on using the repository browser.