Changeset 1176 in Sophya


Ignore:
Timestamp:
Sep 4, 2000, 11:17:21 AM (25 years ago)
Author:
ansari
Message:

Mollweide et sinus projections

Location:
trunk/SophyaExt/FitsIOServer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc

    r1174 r1176  
    11#include "pexceptions.h"
    22#include "fitsspherehealpix.h"
    3 
     3#include "tarray.h"
     4#include "fitstarray.h"
    45
    56
     
    198199}
    199200
     201template <class T>
     202void FITS_SphereHEALPix<T>::Mollweide_picture_projection(char filename[])
     203{
     204  int ni = 300;
     205  int nj = 600;
     206  TMatrix<float> map(ni, nj);
     207
     208   int i,j;
     209   for(i=0; i < ni; i++)
     210     {
     211       double yd = (i+0.5)/ni-0.5;
     212       double facteur=2.*Pi/sin(acos(yd*2));
     213       double theta = (0.5-yd)*Pi;
     214       for(j=0; j < nj; j++) 
     215         {
     216           double xa = (j+0.5)/nj-0.5;
     217           double phi =  xa*facteur+Pi;
     218           float th=float(theta);
     219           float ff=float(phi);
     220           if (phi<2*Pi && phi>= 0)
     221             {
     222               map(i,j) = (float)dobj_->PixValSph(th, ff);
     223             }
     224         }
     225     }
     226   FitsOutFile  fout(filename);
     227   fout.firstImageOnPrimaryHeader();
     228   FITS_TArray<r_4> fta(map);
     229   fta.Write(fout);
     230   
     231}
     232template <class T>
     233void FITS_SphereHEALPix<T>::sinus_picture_projection(char filename[])
     234{
     235  int ni = 300;
     236  int nj = 600;
     237  TMatrix<float> map(ni, nj);
     238
     239  int i,j;
     240   for(i=0; i < ni; i++)
     241     {
     242       double yd = (i+0.5)/ni-0.5;
     243       double theta = (0.5-yd)*Pi;
     244        double facteur=1./sin(theta);
     245       for(j=0; j < nj; j++) 
     246         {
     247           double xa = (j+0.5)/nj-0.5;
     248           double phi = 2.*Pi*xa*facteur+Pi;
     249           float th=float(theta);
     250           float ff=float(phi);
     251           if (phi<2*Pi && phi>= 0)
     252             {
     253               map(i,j) = (float)dobj_->PixValSph(th, ff);
     254             }
     255         }
     256     }
     257   FitsOutFile  fout(filename);
     258   fout.firstImageOnPrimaryHeader();
     259   FITS_TArray<r_4> fta(map);
     260   fta.Write(fout);
     261
     262   
     263}
     264
    200265
    201266#ifdef __CXX_PRAGMA_TEMPLATES__
  • trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h

    r1174 r1176  
    2929virtual void        SetDataObj(AnyDataObj & o);
    3030
     31void Mollweide_picture_projection(char flnm[]);
     32void sinus_picture_projection(char flnm[]);
     33
     34
    3135inline operator SphereHEALPix<T>() { return(*dobj_); }
    3236
Note: See TracChangeset for help on using the changeset viewer.