Skip to content

Commit

Permalink
changed normalisation in spherical harmonics
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlouden committed Aug 4, 2017
1 parent 6bd5af5 commit 8325bf5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions c_src/brightness_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,17 @@ double spherical(double lat, double lon, double *a){
fx2 = fx2_vec[l];
free(fx2_vec);

norm = pow((2*l + 1)*factorial(l-m)/factorial(l+m),0.5);

if(m >= 0){
val = val + a[k]*norm*cos(m*phi)*fx2;
if(m > 0){
norm = pow(2*(2*l + 1)*factorial(l-m)/factorial(l+m),0.5);
val = val + a[k]*norm*fx2*cos(m*phi);
}
else if (m < 0){
norm = pow(2*(2*l + 1)*factorial(l-m)/factorial(l+m),0.5);
val = val + a[k]*norm*fx2*sin(pow(pow(m,2),0.5)*phi);
}
else{
val = val + a[k]*norm*cos((m*phi) + (M_PI/(2*m) ))*fx2;
else if (m == 0){
norm = pow((2*l + 1),0.5);
val = val + a[k]*norm*fx2;
}

k = k +1;
Expand Down

0 comments on commit 8325bf5

Please sign in to comment.