IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37538


Ignore:
Timestamp:
Oct 30, 2014, 9:25:31 AM (12 years ago)
Author:
eugene
Message:

vsh polynomials kind of defined...

Location:
branches/eam_branches/ipp-20140904/Ohana/src/libohana
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/Makefile

    r37533 r37538  
    3535$(SRC)/time.$(ARCH).o            \
    3636$(SRC)/gaussj.$(ARCH).o          \
    37 $(SRC)/legendre.$(ARCH).o        \
    38 $(SRC)/gsl_utils.$(ARCH).o       \
     37$(SRC)/spherical.$(ARCH).o       \
    3938$(SRC)/vstats.$(ARCH).o          \
    4039$(SRC)/config.$(ARCH).o          \
     
    4847$(SRC)/gprint.$(ARCH).o  \
    4948$(SRC)/version.$(ARCH).o
     49
     50# $(SRC)/legendre.$(ARCH).o      \
     51# $(SRC)/gsl_utils.$(ARCH).o     \
    5052
    5153TYPETEST = \
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/include/ohana.h

    r37533 r37538  
    447447double legendre_Plm_sphere(int l, int m, double x, double *err);
    448448
    449 # endif
     449typedef struct {
     450  double *dR_B;
     451  double *dR_E;
     452  double *dD_B;
     453  double *dD_E;
     454  int lmax;
     455  int Nterms;
     456} VSHterms;
     457
     458VSHterms *InitVSHterms (int lmax);
     459void getVSHterms (VSHterms *terms, double R, double D);
     460
     461# endif
  • branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/spherical.c

    r37537 r37538  
    11# include "ohana.h"
    2 
    3 typedef struct {
    4   double *dR_B;
    5   double *dR_E;
    6   double *dD_B;
    7   double *dD_E;
    8   int lmax;
    9   int Nterms;
    10 } VSHterms;
     2# include <gsl/gsl_sf_legendre.h>
    113
    124VSHterms *InitVSHterms (int lmax) {
    135
    146  // 0,0  -- N = 1, S = 1
    15   // 1,-1; 1,0; 1,1 -- N = 3, S = 4
    16   // 2,-2; 2,-1; 2,0; 2,1; 2,2 -- N = 5, S = 9
    17   // 3,-3; 3,-2; 3,-1; 3,0; 3,1; 3,2, 3,3 -- N = 7, S = 16
    18   int
     7  // 1,-1; 1,0; 1,1 -- N = 3, S = 4 (l+1)^2
     8  // 2,-2; 2,-1; 2,0; 2,1; 2,2 -- N = 5, S = 9 (l+1)^2
     9  // 3,-3; 3,-2; 3,-1; 3,0; 3,1; 3,2, 3,3 -- N = 7, S = 16 (l+1)^2
    1910
     11  VSHterms *terms = NULL;
     12  ALLOCATE (terms, VSHterms, 1);
     13  terms->lmax = lmax;
     14  terms->Nterms = SQ(lmax+1);
     15
     16  ALLOCATE (terms->dR_B, double, terms->Nterms);
     17  ALLOCATE (terms->dR_E, double, terms->Nterms);
     18  ALLOCATE (terms->dD_B, double, terms->Nterms);
     19  ALLOCATE (terms->dD_E, double, terms->Nterms);
     20 
     21  return terms;
    2022}
    2123
    22 void getVSHterms (int lmax, double R, double D, VSHterms *VlmSet) {
     24void getVSHterms (VSHterms *terms, double R, double D) {
    2325
    2426  // given a point on the sky R,D
     
    8284
    8385  int l, m;
     86
     87  // Vlm(l=0) = 0, so assign directly (we ignore for fitting)
    8488  int n = 0;
    85   for (l = 1; l < lmax; l++) {
     89  terms->dR_B[n] = 0.0;
     90  terms->dD_B[n] = 0.0;
     91  terms->dR_E[n] = 0.0;
     92  terms->dD_E[n] = 0.0;
     93  n++;
     94
     95  for (l = 1; l < terms->lmax; l++) {
    8696
    8797    for (m = -l; m <= l; m++) {
     
    101111      double S_D_lm = (m < 0) ? dPlm_dD * sin(m_abs * Rrad) : dPlm_dD * cos(m_abs * Rrad);
    102112 
    103       VlmSet->dR_B[n] = +S_D_lm;
    104       VlmSet->dD_B[n] = -S_R_lm / cos(Drad);
    105       VlmSet->dR_E[n] = +S_R_lm / cos(Drad);
    106       VlmSet->dR_B[n] = +S_D_lm;
     113      terms->dR_B[n] = +S_D_lm;
     114      terms->dD_B[n] = -S_R_lm / cos(Drad);
     115      terms->dR_E[n] = +S_R_lm / cos(Drad);
     116      terms->dD_E[n] = +S_D_lm;
    107117      n++;
    108118    }
Note: See TracChangeset for help on using the changeset viewer.