Commit 170dee9c authored by Boris Bonev's avatar Boris Bonev
Browse files

Changed docstrings to raw strings

parent 80361eaf
......@@ -24,7 +24,9 @@ jobs:
# python -m pip install -e .
# cd ../..
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools wheel
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
- name: Install package
run: |
python -m pip install -e .
......
......@@ -40,7 +40,7 @@ def clm(l, m):
def precompute_legpoly(mmax, lmax, t, norm="ortho", inverse=False, csphase=True):
"""
r"""
Computes the values of (-1)^m c^l_m P^l_m(\cos \theta) at the positions specified by x (theta)
The resulting tensor has shape (mmax, lmax, len(x)).
The Condon-Shortley Phase (-1)^m can be turned off optionally
......@@ -92,7 +92,7 @@ def precompute_legpoly(mmax, lmax, t, norm="ortho", inverse=False, csphase=True)
return torch.from_numpy(pct)
def precompute_dlegpoly(mmax, lmax, x, norm="ortho", inverse=False, csphase=True):
"""
r"""
Computes the values of the derivatives $\frac{d}{d \theta} P^m_l(\cos \theta)$
at the positions specified by x (theta), as well as $\frac{1}{\sin \theta} P^m_l(\cos \theta)$,
needed for the computation of the vector spherical harmonics. The resulting tensor has shape
......
......@@ -32,7 +32,7 @@
import numpy as np
def legendre_gauss_weights(n, a=-1.0, b=1.0):
"""
r"""
Helper routine which returns the Legendre-Gauss nodes and weights
on the interval [a, b]
"""
......@@ -44,7 +44,7 @@ def legendre_gauss_weights(n, a=-1.0, b=1.0):
return xlg, wlg
def lobatto_weights(n, a=-1.0, b=1.0, tol=1e-16, maxiter=100):
"""
r"""
Helper routine which returns the Legendre-Gauss-Lobatto nodes and weights
on the interval [a, b]
"""
......@@ -86,7 +86,7 @@ def lobatto_weights(n, a=-1.0, b=1.0, tol=1e-16, maxiter=100):
def clenshaw_curtiss_weights(n, a=-1.0, b=1.0):
"""
r"""
Computation of the Clenshaw-Curtis quadrature nodes and weights.
This implementation follows
......@@ -123,7 +123,7 @@ def clenshaw_curtiss_weights(n, a=-1.0, b=1.0):
return tcc, wcc
def fejer2_weights(n, a=-1.0, b=1.0):
"""
r"""
Computation of the Fejer quadrature nodes and weights.
This implementation follows
......
......@@ -35,7 +35,8 @@ from .sht import InverseRealSHT
class GaussianRandomFieldS2(torch.nn.Module):
def __init__(self, nlat, alpha=2.0, tau=3.0, sigma=None, radius=1.0, grid="equiangular", dtype=torch.float32):
super().__init__()
"""A mean-zero Gaussian Random Field on the sphere with Matern covariance:
r"""
A mean-zero Gaussian Random Field on the sphere with Matern covariance:
C = sigma^2 (-Lap + tau^2 I)^(-alpha).
Lap is the Laplacian on the sphere, I the identity operator,
......@@ -93,7 +94,8 @@ class GaussianRandomFieldS2(torch.nn.Module):
self.gaussian_noise = torch.distributions.normal.Normal(self.mean, self.var)
def forward(self, N, xi=None):
"""Sample random functions from a spherical GRF.
r"""
Sample random functions from a spherical GRF.
Parameters
----------
......
......@@ -39,7 +39,7 @@ from .legendre import *
class RealSHT(nn.Module):
"""
r"""
Defines a module for computing the forward (real-valued) SHT.
Precomputes Legendre Gauss nodes, weights and associated Legendre polynomials on these nodes.
The SHT is applied to the last two dimensions of the input
......@@ -49,7 +49,7 @@ class RealSHT(nn.Module):
"""
def __init__(self, nlat, nlon, lmax=None, mmax=None, grid="lobatto", norm="ortho", csphase=True):
"""
r"""
Initializes the SHT Layer, precomputing the necessary quadrature weights
Parameters:
......@@ -97,7 +97,7 @@ class RealSHT(nn.Module):
self.register_buffer('weights', weights, persistent=False)
def extra_repr(self):
"""
r"""
Pretty print module
"""
return f'nlat={self.nlat}, nlon={self.nlon},\n lmax={self.lmax}, mmax={self.mmax},\n grid={self.grid}, csphase={self.csphase}'
......@@ -127,7 +127,7 @@ class RealSHT(nn.Module):
return x
class InverseRealSHT(nn.Module):
"""
r"""
Defines a module for computing the inverse (real-valued) SHT.
Precomputes Legendre Gauss nodes, weights and associated Legendre polynomials on these nodes.
nlat, nlon: Output dimensions
......@@ -172,7 +172,7 @@ class InverseRealSHT(nn.Module):
self.register_buffer('pct', pct, persistent=False)
def extra_repr(self):
"""
r"""
Pretty print module
"""
return f'nlat={self.nlat}, nlon={self.nlon},\n lmax={self.lmax}, mmax={self.mmax},\n grid={self.grid}, csphase={self.csphase}'
......@@ -197,7 +197,7 @@ class InverseRealSHT(nn.Module):
class RealVectorSHT(nn.Module):
"""
r"""
Defines a module for computing the forward (real) vector SHT.
Precomputes Legendre Gauss nodes, weights and associated Legendre polynomials on these nodes.
The SHT is applied to the last three dimensions of the input.
......@@ -207,7 +207,7 @@ class RealVectorSHT(nn.Module):
"""
def __init__(self, nlat, nlon, lmax=None, mmax=None, grid="lobatto", norm="ortho", csphase=True):
"""
r"""
Initializes the vector SHT Layer, precomputing the necessary quadrature weights
Parameters:
......@@ -259,7 +259,7 @@ class RealVectorSHT(nn.Module):
self.register_buffer('weights', weights, persistent=False)
def extra_repr(self):
"""
r"""
Pretty print module
"""
return f'nlat={self.nlat}, nlon={self.nlon},\n lmax={self.lmax}, mmax={self.mmax},\n grid={self.grid}, csphase={self.csphase}'
......@@ -301,7 +301,7 @@ class RealVectorSHT(nn.Module):
class InverseRealVectorSHT(nn.Module):
"""
r"""
Defines a module for computing the inverse (real-valued) vector SHT.
Precomputes Legendre Gauss nodes, weights and associated Legendre polynomials on these nodes.
......@@ -343,7 +343,7 @@ class InverseRealVectorSHT(nn.Module):
self.register_buffer('dpct', dpct, persistent=False)
def extra_repr(self):
"""
r"""
Pretty print module
"""
return f'nlat={self.nlat}, nlon={self.nlon},\n lmax={self.lmax}, mmax={self.mmax},\n grid={self.grid}, csphase={self.csphase}'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment