[585] | 1 | #include "machdefs.h"
|
---|
| 2 | #include <stdlib.h>
|
---|
[594] | 3 | #include <math.h>
|
---|
[585] | 4 | #include <typeinfo>
|
---|
[2322] | 5 | #include <iostream>
|
---|
[585] | 6 | #include <string>
|
---|
| 7 | #include <complex>
|
---|
| 8 |
|
---|
[1224] | 9 | #include "datatype.h"
|
---|
| 10 |
|
---|
[585] | 11 | #include "nomskymapadapter.h"
|
---|
[855] | 12 | #include "skymap.h"
|
---|
[594] | 13 | #include "pitvmaad.h"
|
---|
| 14 | #include "complexios.h"
|
---|
[585] | 15 |
|
---|
[1321] | 16 | #include "fitsspherehealpix.h"
|
---|
| 17 | #include "fitslocalmap.h"
|
---|
| 18 |
|
---|
| 19 |
|
---|
[594] | 20 | // Classe array adapter pour localMap
|
---|
| 21 | template <class T>
|
---|
| 22 | class LocalMapArrAdapter : public P2DArrayAdapter {
|
---|
| 23 | public:
|
---|
| 24 | LocalMapArrAdapter(LocalMap<T>* lm, bool d=false) :
|
---|
[1164] | 25 | P2DArrayAdapter(lm->SizeX(), lm->SizeY())
|
---|
[594] | 26 | { ad = d; map = lm; }
|
---|
[585] | 27 |
|
---|
[594] | 28 | virtual ~LocalMapArrAdapter() { if (ad) delete map; }
|
---|
| 29 | virtual double Value(int ix, int iy) { return((*map)(ix, iy)); }
|
---|
| 30 |
|
---|
| 31 | protected :
|
---|
| 32 | bool ad;
|
---|
| 33 | LocalMap<T>* map;
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 | /* --Methode-- */
|
---|
[2335] | 37 | #if defined(__SGICC__)
|
---|
| 38 | template <>
|
---|
| 39 | #endif
|
---|
[594] | 40 | double LocalMapArrAdapter< complex<float> >::Value(int ix, int iy)
|
---|
| 41 | {
|
---|
| 42 | double re,im;
|
---|
| 43 | re = (*map)(iy, ix).real();
|
---|
| 44 | im = (*map)(iy, ix).imag();
|
---|
| 45 | return(sqrt(re*re+im*im));
|
---|
| 46 | }
|
---|
| 47 | /* --Methode-- */
|
---|
[2335] | 48 | #if defined(__SGICC__)
|
---|
| 49 | template <>
|
---|
| 50 | #endif
|
---|
[594] | 51 | double LocalMapArrAdapter< complex<double> >::Value(int ix, int iy)
|
---|
| 52 | {
|
---|
| 53 | double re,im;
|
---|
| 54 | re = (*map)(iy, ix).real();
|
---|
| 55 | im = (*map)(iy, ix).imag();
|
---|
| 56 | return(sqrt(re*re+im*im));
|
---|
| 57 | }
|
---|
| 58 |
|
---|
[585] | 59 | //----------------------------------------------------------------
|
---|
| 60 | // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet PixelMap<T>
|
---|
| 61 | //----------------------------------------------------------------
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | /* --Methode-- */
|
---|
| 65 | template <class T>
|
---|
| 66 | NOMAdapter_PixelMap<T>::NOMAdapter_PixelMap(PixelMap<T> * o)
|
---|
[594] | 67 | : NObjMgrAdapter(o)
|
---|
[585] | 68 | {
|
---|
| 69 | mMap = o;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | /* --Methode-- */
|
---|
| 73 | template <class T>
|
---|
| 74 | NOMAdapter_PixelMap<T>::~NOMAdapter_PixelMap()
|
---|
| 75 | {
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | /* --Methode-- */
|
---|
| 79 | template <class T>
|
---|
| 80 | NObjMgrAdapter* NOMAdapter_PixelMap<T>::Clone(AnyDataObj* o)
|
---|
| 81 | {
|
---|
| 82 | PixelMap<T>* m = dynamic_cast<PixelMap<T> *>(o);
|
---|
| 83 | if (m) return ( new NOMAdapter_PixelMap<T>(m) );
|
---|
| 84 | return ( new NObjMgrAdapter(o) );
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | /* --Methode-- */
|
---|
| 88 | template <class T>
|
---|
[1165] | 89 | string NOMAdapter_PixelMap<T>::GetDataObjType()
|
---|
[585] | 90 | {
|
---|
[1165] | 91 | string type = "PixelMap< ";
|
---|
[585] | 92 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
[1165] | 93 | if (lm != NULL) type = "LocalMap< ";
|
---|
| 94 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
| 95 | if (st != NULL) type = "SphereThetaPhi< ";
|
---|
| 96 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 97 | if (sg != NULL) type = "SphereHEALPix< ";
|
---|
| 98 |
|
---|
[1224] | 99 | // type += DecodeTypeIdName(typeid(T).name());
|
---|
[1237] | 100 | type += DataTypeInfo<T>::getTypeName();
|
---|
[1165] | 101 | type += " > ";
|
---|
| 102 | return(type);
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | /* --Methode-- */
|
---|
| 106 | template <class T>
|
---|
[1315] | 107 | AnyDataObj* NOMAdapter_PixelMap<T>::CloneDataObj(bool share)
|
---|
[1165] | 108 | {
|
---|
| 109 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
[1315] | 110 | if (lm != NULL) return( new LocalMap<T>(*lm, share) );
|
---|
[585] | 111 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
[1315] | 112 | if (st != NULL) return( new SphereThetaPhi<T>(*st, share) );
|
---|
[855] | 113 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
[1315] | 114 | if (sg != NULL) return( new SphereHEALPix<T>(*sg, share) );
|
---|
[585] | 115 | return(NULL);
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | /* --Methode-- */
|
---|
| 119 | template <class T>
|
---|
[1321] | 120 | void NOMAdapter_PixelMap<T>::ReadFits(string const & flnm)
|
---|
| 121 | {
|
---|
| 122 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 123 | if (lm != NULL) {
|
---|
| 124 | FitsInFile fis(flnm);
|
---|
| 125 | fis >> (*lm);
|
---|
| 126 | return;
|
---|
| 127 | }
|
---|
| 128 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 129 | if (sg != NULL) {
|
---|
| 130 | FitsInFile fis(flnm);
|
---|
| 131 | fis >> (*sg);
|
---|
| 132 | return;
|
---|
| 133 | }
|
---|
| 134 | string s = typeid(*mMap).name();
|
---|
| 135 | cout << " NOMAdapter_PixelMap<T>::ReadFits() - Error "
|
---|
| 136 | << " Not supported for " << s << endl;
|
---|
| 137 | return;
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 |
|
---|
| 141 | /* --Methode-- */
|
---|
| 142 | template <class T>
|
---|
| 143 | void NOMAdapter_PixelMap<T>::SaveFits(string const & flnm)
|
---|
| 144 | {
|
---|
| 145 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 146 | if (lm != NULL) {
|
---|
| 147 | FitsOutFile fos(flnm);
|
---|
| 148 | fos << (*lm);
|
---|
| 149 | return;
|
---|
| 150 | }
|
---|
| 151 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
| 152 | if (sg != NULL) {
|
---|
| 153 | FitsOutFile fos(flnm);
|
---|
| 154 | fos << (*sg);
|
---|
| 155 | return;
|
---|
| 156 | }
|
---|
| 157 | string s = typeid(*mMap).name();
|
---|
| 158 | cout << " NOMAdapter_PixelMap<T>::SaveFits() - Error "
|
---|
| 159 | << " Not supported for " << s << endl;
|
---|
| 160 | return;
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | // ---- Specialisation pour complexes -----
|
---|
[2335] | 164 | #if defined(__SGICC__)
|
---|
| 165 | template <>
|
---|
| 166 | #endif
|
---|
[1321] | 167 | void NOMAdapter_PixelMap< complex<r_4> >::ReadFits(string const & flnm)
|
---|
| 168 | {
|
---|
| 169 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
|
---|
| 170 | << " Not supported (complex data type)" << endl;
|
---|
| 171 | }
|
---|
[2335] | 172 | #if defined(__SGICC__)
|
---|
| 173 | template <>
|
---|
| 174 | #endif
|
---|
[1321] | 175 | void NOMAdapter_PixelMap< complex<r_4> >::SaveFits(string const & flnm)
|
---|
| 176 | {
|
---|
| 177 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::SaveFits() - Error "
|
---|
| 178 | << " Not supported (complex data type)" << endl;
|
---|
| 179 | }
|
---|
[2335] | 180 | #if defined(__SGICC__)
|
---|
| 181 | template <>
|
---|
| 182 | #endif
|
---|
[1321] | 183 | void NOMAdapter_PixelMap< complex<r_8> >::ReadFits(string const & flnm)
|
---|
| 184 | {
|
---|
| 185 | cout << " void NOMAdapter_PixelMap< complex<r_4> >::ReadFits() - Error "
|
---|
| 186 | << " Not supported (complex data type)" << endl;
|
---|
| 187 | }
|
---|
[2335] | 188 | #if defined(__SGICC__)
|
---|
| 189 | template <>
|
---|
| 190 | #endif
|
---|
[1321] | 191 | void NOMAdapter_PixelMap< complex<r_8> >::SaveFits(string const & flnm)
|
---|
| 192 | {
|
---|
| 193 | cout << " void NOMAdapter_PixelMap< complex<r_8> >::SaveFits() - Error "
|
---|
| 194 | << " Not supported (complex data type)" << endl;
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 |
|
---|
| 198 | /* --Methode-- */
|
---|
| 199 | template <class T>
|
---|
[585] | 200 | void NOMAdapter_PixelMap<T>::SavePPF(POutPersist& pos, string const & nom)
|
---|
| 201 | {
|
---|
| 202 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 203 | if (lm != NULL) {
|
---|
| 204 | FIO_LocalMap<T> fio(lm);
|
---|
| 205 | fio.Write(pos, nom);
|
---|
| 206 | return;
|
---|
| 207 | }
|
---|
| 208 | SphereThetaPhi<T>* st = dynamic_cast< SphereThetaPhi<T> * >(mMap);
|
---|
| 209 | if (st != NULL) {
|
---|
| 210 | FIO_SphereThetaPhi<T> fio(st);
|
---|
| 211 | fio.Write(pos, nom);
|
---|
| 212 | return;
|
---|
| 213 | }
|
---|
[855] | 214 | SphereHEALPix<T>* sg = dynamic_cast< SphereHEALPix<T> * >(mMap);
|
---|
[585] | 215 | if (sg != NULL) {
|
---|
[855] | 216 | FIO_SphereHEALPix<T> fio(sg);
|
---|
[585] | 217 | fio.Write(pos, nom);
|
---|
| 218 | return;
|
---|
| 219 | }
|
---|
| 220 | string s = typeid(*mMap).name();
|
---|
| 221 | cout << "NOMAdapter_PixelMap<T>::SavePPF() - Error : Not supported for " << s << endl;
|
---|
| 222 | }
|
---|
| 223 |
|
---|
| 224 | /* --Methode-- */
|
---|
| 225 | template <class T>
|
---|
| 226 | void NOMAdapter_PixelMap<T>::Print(ostream& os)
|
---|
| 227 | {
|
---|
| 228 | string s = typeid(*mMap).name();
|
---|
[594] | 229 | T moy, sig;
|
---|
| 230 | MeanSig(moy, sig);
|
---|
[585] | 231 | cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl;
|
---|
[594] | 232 | cout << " Mean= " << moy << " Sig2= " << sig << endl;
|
---|
[585] | 233 | }
|
---|
| 234 |
|
---|
[1553] | 235 | // -- Fonction pour convertir un X,Y en Theta-Phi sur projection MolleWeide --
|
---|
| 236 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy);
|
---|
[585] | 237 |
|
---|
| 238 | /* --Methode-- */
|
---|
| 239 | template <class T>
|
---|
| 240 | P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string &)
|
---|
| 241 | {
|
---|
[594] | 242 | LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap);
|
---|
| 243 | if (lm != NULL) return(new LocalMapArrAdapter<T>(lm, false));
|
---|
| 244 | int nr = 250;
|
---|
| 245 | int nc = 500;
|
---|
| 246 | SphericalMap<T>* sm = dynamic_cast< SphericalMap<T> *>(mMap);
|
---|
| 247 | if (sm != NULL) { nr = sqrt(0.75*mMap->NbPixels()); nc = 2*nr; }
|
---|
| 248 | TMatrix<T> * mtx = new TMatrix<T>(nr, nc);
|
---|
| 249 | Project_Mol(*mtx);
|
---|
[1553] | 250 | POTMatrixAdapter<T> * potma = new POTMatrixAdapter<T>(mtx, true);
|
---|
| 251 | potma->SetInfoStringFunction(_SphMollweideProj_XY2ThetaPhi);
|
---|
| 252 | return ( potma );
|
---|
[585] | 253 | }
|
---|
| 254 |
|
---|
| 255 | /* --Methode-- */
|
---|
| 256 | template <class T>
|
---|
| 257 | NTupleInterface* NOMAdapter_PixelMap<T>::GetNTupleInterface(bool& adel)
|
---|
| 258 | {
|
---|
| 259 | adel = true;
|
---|
| 260 | return( new NTupInt_PixelMap<T>(mMap) );
|
---|
| 261 | }
|
---|
| 262 |
|
---|
[594] | 263 | /* --Methode-- */
|
---|
| 264 | template <class T>
|
---|
| 265 | void NOMAdapter_PixelMap<T>::MeanSig(T& gmoy, T& gsig)
|
---|
| 266 | {
|
---|
| 267 | gmoy=0.;
|
---|
| 268 | gsig = 0.;
|
---|
| 269 | T valok;
|
---|
| 270 | for(int k=0; k<mMap->NbPixels(); k++) {
|
---|
| 271 | valok = (*mMap)(k);
|
---|
| 272 | gmoy += valok; gsig += valok*valok;
|
---|
| 273 | }
|
---|
| 274 | gmoy /= (T)mMap->NbPixels();
|
---|
| 275 | gsig = gsig/(T)mMap->NbPixels() - gmoy*gmoy;
|
---|
[585] | 276 |
|
---|
[594] | 277 | }
|
---|
[585] | 278 |
|
---|
[594] | 279 | /* --Methode-- */
|
---|
| 280 | template <class T>
|
---|
| 281 | void NOMAdapter_PixelMap<T>::Project_Mol(TMatrix<T> & mtx, T defval)
|
---|
| 282 | {
|
---|
| 283 | r_8 xa, yd, teta,phi, facteur;
|
---|
| 284 | int_4 l,c,k;
|
---|
| 285 | int_4 nl = mtx.NRows();
|
---|
| 286 | int_4 nc = mtx.NCols();
|
---|
[815] | 287 | mtx = defval; // On met tout a defval
|
---|
[594] | 288 | // cout << " NRows= " << nl << " NCols= " << nc << endl;
|
---|
| 289 | for(l=0; l<nl; l++) {
|
---|
| 290 | yd = (r_8)(l+0.5)/(r_8)nl-0.5;
|
---|
| 291 | facteur=2.*M_PI/sin(acos((double)yd*2));
|
---|
| 292 | teta = (yd+0.5)*Pi;
|
---|
| 293 | // teta = (0.5-yd)*M_PI;
|
---|
| 294 | for(c=0; c<nc; c++) {
|
---|
[1553] | 295 | xa = (r_8)(c+0.5)/(r_8)nc-0.5;
|
---|
[594] | 296 | phi = xa*facteur+M_PI;
|
---|
| 297 | if ( (phi <= 2*M_PI) && (phi >= 0.) ) {
|
---|
| 298 | k = mMap->PixIndexSph(teta, phi);
|
---|
| 299 | mtx(l,c) = (*mMap)(k);
|
---|
| 300 | }
|
---|
| 301 | }
|
---|
| 302 | }
|
---|
| 303 | }
|
---|
| 304 |
|
---|
[1553] | 305 | static char m_buff[128];
|
---|
| 306 | char * _SphMollweideProj_XY2ThetaPhi(P2DArrayAdapter * aa, int ix, int iy)
|
---|
| 307 | {
|
---|
| 308 | r_8 xa, yd, teta,phi, facteur;
|
---|
| 309 | int_4 nl = aa->YSize();
|
---|
| 310 | int_4 nc = aa->XSize();
|
---|
| 311 | int l, c;
|
---|
| 312 | aa->IJ2xy(ix, iy, c, l);
|
---|
| 313 | yd = (r_8)(l+0.5)/(r_8)nl-0.5;
|
---|
| 314 | facteur=2.*M_PI/sin(acos((double)yd*2));
|
---|
| 315 | teta = (yd+0.5)*Pi;
|
---|
| 316 | xa = (r_8)(c+0.5)/(r_8)nc-0.5;
|
---|
| 317 | phi = xa*facteur+M_PI;
|
---|
| 318 | if ( (phi <= 2*M_PI) && (phi >= 0.) )
|
---|
[1580] | 319 | sprintf(m_buff,"(l,b=%5.1f,%5.1f)", phi*180./M_PI, 90.-teta*180./M_PI);
|
---|
[1553] | 320 | else
|
---|
[1580] | 321 | sprintf(m_buff,"(l,b=?,?)");
|
---|
[1553] | 322 |
|
---|
| 323 | return (m_buff);
|
---|
| 324 | }
|
---|
| 325 |
|
---|
[585] | 326 | // -------------------------------------------------------------
|
---|
| 327 |
|
---|
| 328 | /* --Methode-- */
|
---|
| 329 | template <class T>
|
---|
| 330 | NTupInt_PixelMap<T>::NTupInt_PixelMap(PixelMap<T>* m)
|
---|
| 331 | {
|
---|
| 332 | mMap = m;
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 | /* --Methode-- */
|
---|
| 336 | template <class T>
|
---|
| 337 | NTupInt_PixelMap<T>::~NTupInt_PixelMap()
|
---|
| 338 | {
|
---|
| 339 | }
|
---|
| 340 |
|
---|
| 341 | /* --Methode-- */
|
---|
| 342 | template <class T>
|
---|
| 343 | uint_4 NTupInt_PixelMap<T>::NbLines() const
|
---|
| 344 | {
|
---|
| 345 | return( mMap->NbPixels() );
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | /* --Methode-- */
|
---|
| 349 | template <class T>
|
---|
| 350 | uint_4 NTupInt_PixelMap<T>::NbColumns() const
|
---|
| 351 | {
|
---|
| 352 | return(8);
|
---|
| 353 | }
|
---|
| 354 |
|
---|
| 355 | /* --Methode-- */
|
---|
| 356 | template <class T>
|
---|
| 357 | r_8* NTupInt_PixelMap<T>::GetLineD(int n) const
|
---|
| 358 | {
|
---|
| 359 | int i;
|
---|
| 360 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 361 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 362 | else {
|
---|
| 363 | double teta,phi;
|
---|
| 364 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 365 | mRet[0] = n; mRet[1] = mMap->PixVal(n);
|
---|
| 366 | mRet[2] = mRet[1]; mRet[3] = 0.;
|
---|
| 367 | mRet[4] = mRet[1]; mRet[5] = 0.;
|
---|
| 368 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 369 | }
|
---|
| 370 | return(mRet);
|
---|
| 371 | }
|
---|
| 372 |
|
---|
| 373 | /* --Methode-- */
|
---|
| 374 | template <class T>
|
---|
| 375 | string NTupInt_PixelMap<T>::VarList_C(const char* nx) const
|
---|
| 376 | {
|
---|
| 377 | string nomx;
|
---|
| 378 | if (nx) nomx = nx;
|
---|
| 379 | else nomx = "_xh_";
|
---|
| 380 | string vardec = "double i,k,val,real,imag,mod,phas,teta,phi; \n";
|
---|
| 381 | vardec += "i = " + nomx + "[0]; k = " + nomx + "[0]; val = " + nomx + "[1]; \n";
|
---|
| 382 | vardec += "real = " + nomx + "[2]; imag = " + nomx + "[3]; \n";
|
---|
| 383 | vardec += "mod = " + nomx + "[4]; phas = " + nomx + "[5]; \n";
|
---|
| 384 | vardec += "teta = " + nomx + "[6]; phi = " + nomx + "[7]; \n";
|
---|
| 385 | return(vardec);
|
---|
| 386 | }
|
---|
| 387 |
|
---|
[2335] | 388 | #if defined(__SGICC__)
|
---|
| 389 | template <>
|
---|
| 390 | #endif
|
---|
[585] | 391 | r_8* NTupInt_PixelMap< complex<float> >::GetLineD(int n) const
|
---|
| 392 | {
|
---|
| 393 | int i;
|
---|
| 394 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 395 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 396 | else {
|
---|
| 397 | double teta,phi;
|
---|
| 398 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 399 | mRet[0] = n;
|
---|
| 400 | mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag();
|
---|
| 401 | mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
|
---|
| 402 | mRet[5] = atan2(mRet[3], mRet[2]);
|
---|
| 403 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 404 | }
|
---|
| 405 | return(mRet);
|
---|
| 406 | }
|
---|
| 407 |
|
---|
[2335] | 408 | #if defined(__SGICC__)
|
---|
| 409 | template <>
|
---|
| 410 | #endif
|
---|
[585] | 411 | r_8* NTupInt_PixelMap< complex<double> >::GetLineD(int n) const
|
---|
| 412 | {
|
---|
| 413 | int i;
|
---|
| 414 | if ((n < 0) || (n >= (int)(mMap->NbPixels()) ))
|
---|
| 415 | for(i=0; i<8; i++) mRet[i] = 0.;
|
---|
| 416 | else {
|
---|
| 417 | double teta,phi;
|
---|
| 418 | mMap->PixThetaPhi(n, teta, phi);
|
---|
| 419 | mRet[0] = n;
|
---|
| 420 | mRet[2] = mMap->PixVal(n).real(); mRet[3] = mMap->PixVal(n).imag();
|
---|
| 421 | mRet[1] = mRet[4] = sqrt(mRet[2]*mRet[2]+mRet[3]*mRet[3]);
|
---|
| 422 | mRet[5] = atan2(mRet[3], mRet[2]);
|
---|
| 423 | mRet[6] = teta; mRet[7] = phi;
|
---|
| 424 | }
|
---|
| 425 | return(mRet);
|
---|
| 426 | }
|
---|
| 427 |
|
---|
| 428 |
|
---|
| 429 | #ifdef __CXX_PRAGMA_TEMPLATES__
|
---|
[2084] | 430 | #pragma define_template NOMAdapter_PixelMap<int_4>
|
---|
[585] | 431 | #pragma define_template NOMAdapter_PixelMap<r_4>
|
---|
| 432 | #pragma define_template NOMAdapter_PixelMap<r_8>
|
---|
| 433 | #pragma define_template NOMAdapter_PixelMap< complex<float> >
|
---|
| 434 | #pragma define_template NOMAdapter_PixelMap< complex<double> >
|
---|
[2084] | 435 | #pragma define_template NTupInt_PixelMap<int_4>
|
---|
[585] | 436 | #pragma define_template NTupInt_PixelMap<r_4>
|
---|
| 437 | #pragma define_template NTupInt_PixelMap<r_8>
|
---|
| 438 | #pragma define_template NTupInt_PixelMap< complex<float> >
|
---|
| 439 | #pragma define_template NTupInt_PixelMap< complex<double> >
|
---|
| 440 | #endif
|
---|
| 441 |
|
---|
| 442 | #if defined(ANSI_TEMPLATES)
|
---|
[2084] | 443 | template class NOMAdapter_PixelMap<int_4>;
|
---|
[585] | 444 | template class NOMAdapter_PixelMap<r_4>;
|
---|
| 445 | template class NOMAdapter_PixelMap<r_8>;
|
---|
| 446 | template class NOMAdapter_PixelMap< complex<float> >;
|
---|
| 447 | template class NOMAdapter_PixelMap< complex<double> >;
|
---|
[2084] | 448 | template class NTupInt_PixelMap<int_4>;
|
---|
[585] | 449 | template class NTupInt_PixelMap<r_4>;
|
---|
| 450 | template class NTupInt_PixelMap<r_8>;
|
---|
| 451 | template class NTupInt_PixelMap< complex<float> >;
|
---|
| 452 | template class NTupInt_PixelMap< complex<double> >;
|
---|
| 453 | #endif
|
---|