Coverage for webgeodyn/data/normPnm.py: 0%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-18 09:33 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-12-18 09:33 +0000
1import numpy as np
4def semiNormalisedSchmidt(lmax):
5 """ Given the maximal degree lmax, builds an array of
6 Schmidt semi-normalisation constants for the Legendre functions.
8 :param lmax: maximum degree
9 :type lmax: int
10 :return: normalisation of the Legendre functions for all l and m.
11 :rtype: np.array
12 """
13 PnmNorm = np.zeros((lmax+1, lmax+1))
14 for n in range(lmax+1):
15 for m in range(lmax+1):
16 if m > n:
17 continue
18 if m == 0:
19 PnmNorm[m, n] = 1
20 continue
21 faclminusm = np.math.factorial(n-m)
22 faclplusm = np.math.factorial(n+m)
23 PnmNorm[m, n] = np.sqrt(2*faclminusm/faclplusm)*(-1)**m
24 return PnmNorm
27def noNorm(lmax):
28 """ Returns an array of ones ('1') of appropriate dimensions to have
29 non-normalised Legendre functions.
31 :param lmax: maximum degree
32 :type lmax: int
33 :return: array of ones ('1') (dim: lmax x lmax+1)
34 :rtype: np.array
35 """
36 return np.ones((lmax+1, lmax+1))