[Kst] extragear/graphics/kst/kst/datasources/healpix

Ted Kisner tskisner.public at gmail.com
Mon Oct 31 00:59:54 CET 2005


SVN commit 475915 by tskisner:

Add support for QU vectorfields.  Also move some declarations to eliminate compiler warnings

 M  +11 -2     healpix.cpp  
 M  +0 -9      healpix_tools.h  
 M  +9 -0      healpix_tools_pix.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/healpix/healpix.cpp #475914:475915
@@ -428,11 +428,20 @@
     double tailtheta;
     double headphi;
     double tailphi;
+    double pmag;
+    double alpha;
     // only compute as many elements as requested
     for (size_t i = 0; i < (size_t)n; i++) {
       if (!healpix_is_fnull(comptheta[i]) && !healpix_is_fnull(compphi[i])) {
-        thetapart = (double)comptheta[i];
-        phipart = (double)compphi[i];
+        if (_vecQU) { //theta is really Q, phi really U
+          pmag = sqrt((double)(comptheta[i]*comptheta[i] + compphi[i]*compphi[i]));
+          alpha = 0.5 * atan((double)compphi[i] / (double)comptheta[i]);
+          thetapart = pmag * cos(alpha);
+          phipart = pmag * sin(alpha);
+        } else {
+          thetapart = (double)comptheta[i];
+          phipart = (double)compphi[i];
+        }
         if (_mapOrder == HEALPIX_RING) {
           healpix_pix2ang_ring(vecNside, i, &theta, &phi);
         } else {
--- trunk/extragear/graphics/kst/kst/datasources/healpix/healpix_tools.h #475914:475915
@@ -152,15 +152,6 @@
     float *fkeyvals;
     char **fkeycoms;
   } healpix_keys;
-  
-  static size_t healpix_ctab[0x100];
-  static size_t healpix_utab[0x100];
-
-  static const size_t healpix_jrll[] = {2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
-  static const size_t healpix_jpll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7};
-
-  static int healpix_doneinit = 0;
-  void healpix_init();
     
   int healpix_is_dnull(double val);
   int healpix_is_fnull(float val);
--- trunk/extragear/graphics/kst/kst/datasources/healpix/healpix_tools_pix.cpp #475914:475915
@@ -30,6 +30,15 @@
 
 #define HEALPIX_CHK if(!healpix_doneinit)healpix_init()
 
+static size_t healpix_ctab[0x100];
+static size_t healpix_utab[0x100];
+
+static const size_t healpix_jrll[] = {2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
+static const size_t healpix_jpll[] = {1, 3, 5, 7, 0, 2, 4, 6, 1, 3, 5, 7};
+
+static int healpix_doneinit = 0;
+void healpix_init();
+
 /* NULL checking */
 
 int healpix_is_dnull(double val)


More information about the Kst mailing list