Skip to content

Commit 7c88aad

Browse files
committed
Fix normalization factor for m != 0
1 parent 999f34f commit 7c88aad

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

magField.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from planetmagfields.libbfield import *
55
import sys
66

7-
levels=30
7+
levels=20
88
cmap='RdBu_r'
99
proj = 'Mollweide'
1010
r = 1

planetmagfields/libgauss.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ def getB(lmax,glm,hlm,idx,r,p2D,th2D,planet="earth"):
183183
fac_m = 1.
184184
else:
185185
fac_m = (-1)**m
186+
187+
if m != 0:
188+
fac_m *= np.sqrt(2)
189+
186190
fac = fac_m * (l+1) * r**(-l-2) * np.sqrt((4.*np.pi)/(2*l+1))
187191

188192
G = glm[idx[l,m]] * np.real(ylm)

0 commit comments

Comments
 (0)