biosspheres.quadratures.sphere#
This module has the implementation of functions that return - Points and weights for doing the Gauss-Legendre quadrature with a
composite trapezoidal quadrature rule on the surface of a sphere.
Evaluation of real and complex spherical harmonics in the points of the Gauss-Legendre and composite trapezoidal quadrature.
Arrays for implementing a slow spherical harmonic transform (real or complex) on the surface of a sphere.
Translations from a coordinate system to another.
Extended summary#
This module has the implementation of functions that return - Points and weights for doing the Gauss-Legendre quadrature with a
- composite trapezoidal quadrature rule. See
gauss_legendre_trapezoidal_init, pre_vector_2d_init, pre_vector_1d_init gauss_legendre_trapezoidal_2d, gauss_legendre_trapezoidal_1d.
Evaluation of real and complex spherical harmonics in the points of the Gauss-Legendre and composite trapezoidal quadrature. See
gauss_legendre_trapezoidal_real_sh_mapping_2d, gauss_legendre_trapezoidal_complex_sh_mapping_2d.
Arrays for implementing a slow spherical harmonic transform (real or complex). See
real_spherical_harmonic_transform_1d, complex_spherical_harmonic_transform_1d.
- Translations from a coordinate system to another. See
from_sphere_s_cartesian_to_j_spherical_2d, from_sphere_s_cartesian_to_j_spherical_1d, from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d, from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d.
Routine listings#
gauss_legendre_trapezoidal_init pre_vector_2d_init pre_vector_1d_init gauss_legendre_trapezoidal_2d gauss_legendre_trapezoidal_1d gauss_legendre_trapezoidal_real_sh_mapping_2d gauss_legendre_trapezoidal_complex_sh_mapping_2d real_spherical_harmonic_transform_1d complex_spherical_harmonic_transform_1d from_sphere_s_cartesian_to_j_spherical_2d from_sphere_s_cartesian_to_j_spherical_1d from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d
Functions
It returns the vectors for the Gauss-Legendre and trapezoidal quadrature rule for computing a numerical integral in the surface of a sphere. |
|
Given points in the cartesian coordinate system "s", this algorithm writes them in the spherical coordinate system "j". |
|
Given points in the cartesian coordinate system "s", this algorithm writes them in the spherical coordinate system "j". |
|
|
Given points in the cartesian coordinate system "s", this algorithm writes them in the spherical coordinate system "j", and also gives the dot product between the unitary vectors of the spherical system obtained times the normal of the unitary sphere. |
|
Given points in the cartesian coordinate system "s", this algorithm writes them in the spherical coordinate system "j", and also gives the dot product between the unitary vectors of the spherical system obtained times the normal of the unitary sphere. |
|
It returns the weights and vectors for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere. |
|
It returns the weights and vectors for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere. |
This function is for obtaining the quadratures points to approximate numerically the integral in a surface of a sphere, and it also returns the evaluation of the complex spherical harmonics in those points. |
|
|
It returns the weights for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere. |
This function is for obtaining the quadratures points to approximate numerically the integral in a surface of a sphere, and it also returns the evaluation of the real spherical harmonics in those points. |
|
|
|
|
It returns the vectors ordered in a 1D array for coordinates phi and theta given implicitly in the evaluation of the sine and cosine functions in those coordinates. |
|
It returns the vectors ordered in a 2D array for coordinates phi and theta given implicitly in the evaluation of the sine and cosine functions in those coordinates. |
|
|
|
It returns the vectors for the Gauss-Legendre and trapezoidal quadrature rule for computing a numerical integral in the surface of a sphere. |
|
- biosspheres.quadratures.sphere.complex_spherical_harmonic_transform_1d(big_l: int, big_l_c: int) tuple[int, ndarray, ndarray][source]#
It returns the vectors for the Gauss-Legendre and trapezoidal quadrature rule for computing a numerical integral in the surface of a sphere. It also returns a vector that can be used to calculate the complex spherical harmonic transform on the surface of a sphere of radius equal to one.
The use of the results of this routine is for SLOW routines, because the vector used for the spherical harmonic transform does not have any performance improvements.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools. Composite trapezoidal rule in phi. Integral on theta are (big_l_c + 1) quadrature points. Integral on phi are (2 * big_l_c + 1) quadrature points.
- Parameters:
big_l (int) – >= 0.
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
final_length (int) – how many points for the surface integral, = (big_l_c + 1) * (2 * big_l_c + 1).
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, final_length).
transform (np.ndarray) – of complex numbers. Vector that can be used to calculate the complex spherical transform. Shape ((big_l+1)**2, final_length)
See also
- biosspheres.quadratures.sphere.from_sphere_s_cartesian_to_j_spherical_1d(r_s: float, p_j: ndarray, p_s: ndarray, final_length: int, pre_vector: ndarray) tuple[ndarray, ndarray, ndarray][source]#
Given points in the cartesian coordinate system “s”, this algorithm writes them in the spherical coordinate system “j”. The “j” has its center in a different point than the center of the coordinate system “s”.
This one is for a slow routine.
Notes
- put:
x_s = r_s sin(theta) cos(varphi) , y_s = r_s sin(theta) sin(varphi) , z_s = r_s cos(theta) ,
- To the cartesian coordinate system j:
x_j = x_s + (p_s - p_j)_x , y_j = y_s + (p_s - p_j)_y , z_j = z_s + (p_s - p_j)_z ,
- To the spherical coordinate system j:
r_j = sqrt{x^2_j + y^2_j + z^2_j} , cos theta = r_j / z_j , varphi = arctan2 (y_j / x_j)
- Parameters:
r_s (float) – > 0, radius of the sphere s.
p_j (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere j.
p_s (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere s.
final_length (int) – how many points.
pre_vector (np.ndarray) – of floats. Represents the vectors. Shape (3, final_length).
- Returns:
r_coord (np.ndarray) – One dimensional array of floats with the spherical coordinate r of the points in the coordinate system s. Length equals to final_length.
phi_coord (np.ndarray) – One dimensional array of floats with the phi coordinate r of the points in the coordinate system s. Length equals to final_length.
cos_theta_coord (np.ndarray) – One dimensional array of floats with the cosine of the spherical coordinate theta of the points in the coordinate system s. Length equals to final_length.
- biosspheres.quadratures.sphere.from_sphere_s_cartesian_to_j_spherical_2d(r_s: float, p_j: ndarray, p_s: ndarray, quantity_theta_points: int, quantity_phi_points: int, pre_vector: ndarray) tuple[ndarray, ndarray, ndarray][source]#
Given points in the cartesian coordinate system “s”, this algorithm writes them in the spherical coordinate system “j”. The “j” has its center in a different point than the center of the coordinate system “s”.
Notes
- Input:
x_s = r_s sin(theta) cos(varphi) , y_s = r_s sin(theta) sin(varphi) , z_s = r_s cos(theta) ,
- To the cartesian coordinate system j:
x_j = x_s + (p_s - p_j)_x , y_j = y_s + (p_s - p_j)_y , z_j = z_s + (p_s - p_j)_z ,
- To the spherical coordinate system j:
r_j = sqrt{x^2_j + y^2_j + z^2_j} , cos theta = r_j / z_j , varphi = arctan2 (y_j / x_j)
- Parameters:
r_s (float) – > 0, radius of the sphere s.
p_j (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere j.
p_s (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere s.
quantity_theta_points (int) – how many points in theta.
quantity_phi_points (int) – how many points in phi.
pre_vector (np.ndarray) – of floats. Represents the vectors. Shape (3, quantity_theta_points, quantity_phi_points).
- Returns:
r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
- biosspheres.quadratures.sphere.from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d(r_s: float, p_j: ndarray, p_s: ndarray, final_length: int, pre_vector: ndarray) tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray][source]#
Given points in the cartesian coordinate system “s”, this algorithm writes them in the spherical coordinate system “j”, and also gives the dot product between the unitary vectors of the spherical system obtained times the normal of the unitary sphere. The “j” has its center in a different point than the center of the coordinate system “s”.
Notes
- put:
x_s = r_s sin(theta) cos(varphi) , y_s = r_s sin(theta) sin(varphi) , z_s = r_s cos(theta) ,
- To the cartesian coordinate system j:
x_j = x_s + (p_s - p_j)_x , y_j = y_s + (p_s - p_j)_y , z_j = z_s + (p_s - p_j)_z ,
- To the spherical coordinate system j:
r_j = sqrt{x^2_j + y^2_j + z^2_j} , cos theta = r_j / z_j , varphi = arctan2 (y_j / x_j)
- Unitary vectors:
- hat{mathbf{e}}_r = sin(theta) cos(varphi) hat{mathbf{e}}_x
sin(theta) sin(varphi) hat{mathbf{e}}_y
cos(theta) hat{mathbf{e}}_z
- hat{mathbf{e}}_theta = cos(theta) cos(varphi) hat{mathbf{e}}_x
cos(theta) sin(varphi) hat{mathbf{e}}_y
sin(theta) hat{mathbf{e}}_z
- hat{mathbf{e}}_{varphi} = -sin(varphi) hat{mathbf{e}}_x
cos(varphi) hat{mathbf{e}}_y
- Parameters:
r_s (float) – > 0, radius of the sphere s.
p_j (np.ndarray) – of floats. Length 3, represents the position vector of the center of the sphere j.
p_s (np.ndarray) – of floats. Length 3, represents the position vector of the center of the sphere s.
final_length (int) – how many points.
pre_vector (np.ndarray) – of floats. Represents the vectors. Shape (3, final_length).
- Returns:
r_coord (np.ndarray) – One dimensional array of floats with the spherical coordinate r of the points in the coordinate system s. Length equals to final_length.
phi_coord (np.ndarray) – One dimensional array of floats with the phi coordinate r of the points in the coordinate system s. Length equals to final_length.
cos_theta_coord (np.ndarray) – One dimensional array of floats with the cosine of the spherical coordinate theta of the points in the coordinate system s. Length equals to final_length.
er_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate r in the points in the coordinate system s and the normal of a sphere. Length final_length.
etheta_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate theta in the points in the coordinate system s and the normal of a sphere. Length final_length.
ephi_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate phi in the points in the coordinate system s and the normal of a sphere. Length final_length.
- biosspheres.quadratures.sphere.from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d(r_s: float, p_j: ndarray, p_s: ndarray, quantity_theta_points: int, quantity_phi_points: int, pre_vector: ndarray) tuple[ndarray, ndarray, ndarray, ndarray, ndarray, ndarray][source]#
Given points in the cartesian coordinate system “s”, this algorithm writes them in the spherical coordinate system “j”, and also gives the dot product between the unitary vectors of the spherical system obtained times the normal of the unitary sphere. The “j” has its center in a different point than the center of the coordinate system “s”.
Notes
- put:
x_s = r_s sin(theta) cos(varphi) , y_s = r_s sin(theta) sin(varphi) , z_s = r_s cos(theta) ,
- To the cartesian coordinate system j:
x_j = x_s + (p_s - p_j)_x , y_j = y_s + (p_s - p_j)_y , z_j = z_s + (p_s - p_j)_z ,
- To the spherical coordinate system j:
r_j = sqrt{x^2_j + y^2_j + z^2_j} , cos theta = r_j / z_j , varphi = arctan2 (y_j / x_j)
- Unitary vectors:
- hat{mathbf{e}}_r = sin(theta) cos(varphi) hat{mathbf{e}}_x
sin(theta) sin(varphi) hat{mathbf{e}}_y
cos(theta) hat{mathbf{e}}_z
- hat{mathbf{e}}_theta = cos(theta) cos(varphi) hat{mathbf{e}}_x
cos(theta) sin(varphi) hat{mathbf{e}}_y
sin(theta) hat{mathbf{e}}_z
- hat{mathbf{e}}_{varphi} = -sin(varphi) hat{mathbf{e}}_x
cos(varphi) hat{mathbf{e}}_y
- Parameters:
r_s (float) – > 0, radius of the sphere s.
p_j (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere j.
p_s (np.ndarray) – of floats of dimension 1, length 3, represents the position vector of the center of the sphere s.
quantity_theta_points (int) – how many points in theta.
quantity_phi_points (int) – how many points in phi.
pre_vector (np.ndarray) – of floats. Represents the vectors. Shape (3, quantity_theta_points, quantity_phi_points).
- Returns:
r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points).
er_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate r in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points).
etheta_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate theta in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points).
ephi_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate phi in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points).
- biosspheres.quadratures.sphere.gauss_legendre_trapezoidal_1d(big_l_c: int) tuple[int, ndarray, ndarray][source]#
It returns the weights and vectors for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools for obtaining the points and weights. Integral on theta are (big_l_c + 1) quadrature points.
Composite trapezoidal rule in phi. Integral on phi are (2 * big_l_c + 1) quadrature points.
The weight for the variable phi (which is the same for all points) is considered in the return array total_weights along with the weights for the theta variable and the jacobian of the surface integral. The ordering of the arrays given by this function is not suited for fast fourier transform algorithms. The returns of this function is for using the simpler algorithm for obtaining integrals on the sphere.
Without considering errors produced by the approximation by finite numbers, the quadrature must be exact for functions consisting in polynomials of big_l_c degree times an exponential power to (m times i), with |m| <= big_l_c.
- Parameters:
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
final_length (int) – how many points for the surface integral, = (big_l_c + 1) * (2 * big_l_c + 1).
total_weights (np.ndarray) – of floats, with the weights for the integral quadrature and length final_length.
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, final_length).
See also
- biosspheres.quadratures.sphere.gauss_legendre_trapezoidal_2d(big_l_c: int) tuple[int, int, ndarray, ndarray][source]#
It returns the weights and vectors for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools for obtaining the points and weights. Integral on theta are (big_l_c + 1) quadrature points. The weights returned correspond to the integral on this variable.
Composite trapezoidal rule in phi. Integral on phi are (2 * big_l_c + 1) quadrature points. This function does not return any weight for the phi variable, because it is a trapezoidal rule equally spaced. The integral in this variable can be solved using the fast fourier transform.
Without considering errors produced by the approximation by finite numbers, the quadrature must be exact for functions consisting in polynomials of big_l_c degree times an exponential power to (m times i), with |m| <= big_l_c.
- Parameters:
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
quantity_theta_points (int) – how many points for the integral in theta, (big_l_c + 1).
quantity_phi_points (int) – how many points for the integral in phi, (2 * big_l_c + 1).
weights (np.ndarray) – of floats, with the weights for the integral quadrature in theta. Length (big_l_c + 1).
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, quantity_theta_points, quantity_phi_points).
- biosspheres.quadratures.sphere.gauss_legendre_trapezoidal_complex_sh_mapping_2d(big_l: int, big_l_c: int, pesykus: ndarray, p2_plus_p_plus_q: ndarray, p2_plus_p_minus_q: ndarray) tuple[int, int, ndarray, ndarray, ndarray][source]#
This function is for obtaining the quadratures points to approximate numerically the integral in a surface of a sphere, and it also returns the evaluation of the complex spherical harmonics in those points. It returns the weights and vectors for the Gauss-Legendre and composite trapezoidal quadrature rule. The complex spherical harmonics evaluated are of degree l and order m, with l <= big_l. See the shape of the returns.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools. Composite trapezoidal rule in phi. Integral on theta are (big_l_c + 1) quadrature points. Integral on phi are (2 * big_l_c + 1) quadrature points. Without considering errors produced by the approximation by finite numbers, the quadrature must be exact for functions consisting in polynomials of big_l_c degree times an exponential power to (m times i), with |m| <= big_l_c. Legendre’s functions are computed used pyshtools.
- Parameters:
big_l (int) – >= 0, max degree.
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
pesykus (np.ndarray) – dtype int, shape ((big_l+1) * big_l // 2, 2). Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)
p2_plus_p_plus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)
p2_plus_p_minus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)
- Returns:
quantity_theta_points (int) – how many points for the integral in theta, (big_l_c + 1).
quantity_phi_points (int) – how many points for the integral in phi, (2 * big_l_c + 1)
weights (np.ndarray) – of floats, with the weights for the integral quadrature in theta. Length (big_l_c + 1).
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, quantity_theta_points, quantity_phi_points).
spherical_harmonics (np.ndarray) – of complex numbers, represent the real spherical harmonics of degree and order l and m evaluated in the points given by pre_vector. Shape ((big_l + 1)**2, quantity_theta_points, quantity_phi_points)
- biosspheres.quadratures.sphere.gauss_legendre_trapezoidal_init(big_l_c: int) tuple[int, int, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray][source]#
It returns the weights for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere. Along with the coordinate phi of the quadrature points, and the evaluation of the cosine and sine of the phi and theta coordinates.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools for obtaining the points and weights. Integral on theta are (big_l_c + 1) quadrature points. The weights returned correspond to the integral on this variable.
Composite trapezoidal rule in phi. Integral on phi are (2 * big_l_c + 1) quadrature points. This function does not return any weight for the phi variable, because it is a trapezoidal rule equally spaced. The integral in this variable can be solved using the fast fourier transform.
Without considering errors produced by the approximation by finite numbers, the quadrature must be exact for functions consisting in polynomials of big_l_c degree times an exponential power to (m times i), with |m| <= big_l_c.
- Parameters:
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
quantity_theta_points (int) – how many points for the integral in theta, (big_l_c + 1).
quantity_phi_points (int) – how many points for the integral in phi, (2 * big_l_c + 1).
weights (np.ndarray) – of floats, with the weights for the integral quadrature in theta. Length (big_l_c + 1).
cos_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Cosine of the phi coordinate of the quadrature points.
sin_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Sine of the phi coordinate of the quadrature points.
cos_theta (np.ndarray) – of floats. Length (big_l_c + 1). Cosine of the theta coordinate of the quadrature points.
sin_theta (np.ndarray) – of floats. Length (big_l_c + 1). Sine of the theta coordinate of the quadrature points.
phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Phi coordinate of the quadrature points.
- biosspheres.quadratures.sphere.gauss_legendre_trapezoidal_real_sh_mapping_2d(big_l: int, big_l_c: int) tuple[int, int, ndarray, ndarray, ndarray][source]#
This function is for obtaining the quadratures points to approximate numerically the integral in a surface of a sphere, and it also returns the evaluation of the real spherical harmonics in those points. It returns the weights and vectors for the Gauss-Legendre and composite trapezoidal quadrature rule. The real spherical harmonics evaluated are of degree l and order m, with l <= big_l. See the shape of the returns.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools. Composite trapezoidal rule in phi. Integral on theta are (big_l_c + 1) quadrature points. Integral on phi are (2 * big_l_c + 1) quadrature points. Without considering errors produced by the approximation by finite numbers, the quadrature must be exact for functions consisting in polynomials of big_l_c degree times an exponential power to (m times i), with |m| <= big_l_c. Legendre’s functions are computed used pyshtools.
- Parameters:
big_l (int) – >= 0, max degree.
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
quantity_theta_points (int) – how many points for the integral in theta, (big_l_c + 1).
quantity_phi_points (int) – how many points for the integral in phi, (2 * big_l_c + 1)
weights (np.ndarray) – of floats, with the weights for the integral quadrature in theta. Length (big_l_c + 1).
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, quantity_theta_points, quantity_phi_points).
spherical_harmonics (np.ndarray) – of floats, represent the real spherical harmonics of degree and order l and m evaluated in the points given by pre_vector. Shape ((big_l + 1)**2, quantity_theta_points, quantity_phi_points)
- biosspheres.quadratures.sphere.phi_part_for_real_sh_mapping_2d(big_l: int, phi: ndarray) tuple[ndarray, ndarray][source]#
- Parameters:
big_l (int) – >= 0, max degree.
phi (np.ndarray) – of floats. Phi coordinates.
- Returns:
cos_m_phi (np.ndarray) – of floats. Size (big_l, length of phi).
sin_m_phi (np.ndarray) – of floats. Size (big_l, length of phi).
- biosspheres.quadratures.sphere.pre_vector_1d_init(sin_theta: ndarray, cos_theta: ndarray, sin_phi: ndarray, cos_phi: ndarray) ndarray[source]#
It returns the vectors ordered in a 1D array for coordinates phi and theta given implicitly in the evaluation of the sine and cosine functions in those coordinates. If the output of gauss_legendre_trapezoidal_init is used as input of this routine, then this functions returns the points for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere.
- Parameters:
sin_theta (np.ndarray) – of floats. Length (big_l_c + 1). Sine of the theta coordinate of the quadrature points.
cos_theta (np.ndarray) – of floats. Length (big_l_c + 1). Cosine of the theta coordinate of the quadrature points.
sin_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Sine of the phi coordinate of the quadrature points.
cos_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Cosine of the phi coordinate of the quadrature points.
- Returns:
pre_vector – of floats. Represents the vectors of the quadrature points. Shape (3, length of sin_theta x length of sin_phi).
- Return type:
np.ndarray
- biosspheres.quadratures.sphere.pre_vector_2d_init(sin_theta: ndarray, cos_theta: ndarray, sin_phi: ndarray, cos_phi: ndarray) ndarray[source]#
It returns the vectors ordered in a 2D array for coordinates phi and theta given implicitly in the evaluation of the sine and cosine functions in those coordinates. If the output of gauss_legendre_trapezoidal_init is used as input of this routine, then this functions returns the points for the Gauss-Legendre quadrature rule and a composite trapezoidal quadrature rule to approximate numerically the integral in a surface of a sphere.
- Parameters:
sin_theta (np.ndarray) – of floats. Length (big_l_c + 1). Sine of the theta coordinate of the quadrature points.
cos_theta (np.ndarray) – of floats. Length (big_l_c + 1). Cosine of the theta coordinate of the quadrature points.
sin_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Sine of the phi coordinate of the quadrature points.
cos_phi (np.ndarray) – of floats. Length (2 * big_l_c + 1). Cosine of the phi coordinate of the quadrature points.
- Returns:
pre_vector – of floats. Represents the vectors of the quadrature points. Shape (3, length of sin_theta, length of sin_phi).
- Return type:
np.ndarray
- biosspheres.quadratures.sphere.real_sh_mapping_2d(legendre_functions: ndarray, cos_m_phi: ndarray, sin_m_phi: ndarray) ndarray[source]#
- Parameters:
legendre_functions (np.ndarray) – of floats. Legendre functions normalized for real spherical harmonics evaluated in cos_theta. Size: ((big_l + 1) * (big_l + 2) // 2, quantity_theta_points)
cos_m_phi (np.ndarray) – of floats. Size (big_l, quantity_phi_points).
sin_m_phi (np.ndarray) – of floats. Size (big_l, quantity_phi_points).
- Returns:
spherical_harmonics
- Return type:
np.ndarray
- biosspheres.quadratures.sphere.real_spherical_harmonic_transform_1d(big_l: int, big_l_c: int) tuple[int, ndarray, ndarray][source]#
It returns the vectors for the Gauss-Legendre and trapezoidal quadrature rule for computing a numerical integral in the surface of a sphere. It also returns a vector that can be used to calculate the real spherical harmonic transform on the surface of a sphere of radius equal to one.
The use of the results of this routine is for SLOW routines, because the vector used for the spherical harmonic transform does not have any performance improvements.
Notes
Gauss-legendre quadrature in theta. This one uses the package pyshtools. Composite trapezoidal rule in phi. Integral on theta are (big_l_c + 1) quadrature points. Integral on phi are (2 * big_l_c + 1) quadrature points.
- Parameters:
big_l (int) – >= 0.
big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.
- Returns:
final_length (int) – how many points for the surface integral, = (big_l_c + 1) * (2 * big_l_c + 1).
pre_vector (np.ndarray) – of floats. Represents the vectors of the quadrature points. Shape (3, final_length).
transform (np.ndarray) – of floats. Vector that can be used to calculate the real spherical transform. Shape ((big_l+1)**2, final_length)
See also
- biosspheres.quadratures.sphere.theta_part_for_real_sh_mapping_2d(big_l: int, cos_theta: ndarray) ndarray[source]#
- Parameters:
big_l (int) – >= 0, max degree.
cos_theta (np.ndarray) – of floats. Length (big_l_c + 1). Cosine of the theta coordinates
- Returns:
legendre_functions – of floats. Legendre functions normalized for real spherical harmonics evaluated in cos_theta. Size: ((big_l + 1) * (big_l + 2) // 2, len(cos_theta))
- Return type:
np.ndarray