pyPRISM.core.Domain module¶
-
class
pyPRISM.core.Domain.
Domain
(length, dr=None, dk=None)[source]¶ Bases:
object
Define domain and transform between Real and Fourier space
Mathematical Definition
The continuous, 1-D, radially symmetric Fourier transform is written as follows:
\[k\ \hat{f}(k) = 4 \pi \int r\ f(r) \sin(k\ r) dr\]We define the following discretizations
\[ \begin{align}\begin{aligned}r = (i+1)\Delta r\\k = (j+1)\Delta k\\\Delta k = \frac{\pi}{\Delta r (N + 1)}\end{aligned}\end{align} \]to yield
\[\hat{F}_j = 4 \pi \Delta r \sum_{i=0}^{N-1} F_i \sin\left(\frac{\pi}{N+1} (i+1)(j+1)\right)\]with the following definitions:
\[\hat{F}_j = (j+1)\ \Delta k\ \hat{f}((j+1)\Delta k) = k \hat{f}(k)\]\[F_i = (i+1)\Delta r\ f((i+1)\Delta r) = r f(r)\]The above equations describe a Real to Real, type-I discrete sine transform (DST). To tranform to and from Fourier space we will use the type-II and type-III DST’s respectively. With Scipy’s interface to fftpack, the following functional coeffcients are
\[C^{DSTII} = 2 \pi r \Delta r\]\[C^{DSTIII} = \frac{k \Delta k}{4 \pi^2}\]Description
Domain describes the discretization of Real and Fourier space and also sets up the functions and coefficients for transforming data between them.-
MatrixArray_to_fourier
(marray)[source]¶ Transform all pair-functions of a MatrixArray to Fourier space in-place
Parameters: marray ( pyPRISM.core.MatrixArray.MatrixArray
) – MatrixArray to be transformedRaises: *ValueError*: – If the supplied MatrixArray is already in Real-space
-
MatrixArray_to_real
(marray)[source]¶ Transform all pair-functions of a MatrixArray to Real space in-place
Parameters: marray ( pyPRISM.core.MatrixArray.MatrixArray
) – MatrixArray to be transformedRaises: ValueError: – If the supplied MatrixArray is already in Real-space
-
__init__
(length, dr=None, dk=None)[source]¶ Constructor
Parameters: - length (int) – Number of gridpoints in Real and Fourier space grid
- dr,dk (float) – Grid spacing in Real space or Fourier space. Only one can be specified as it fixes the other.
-
dk
¶ Fourier grid spacing
-
dr
¶ Real grid spacing
-
length
¶ Number of points in grid
-
to_fourier
(array)[source]¶ Discrete Sine Transform of a numpy array
Parameters: array (float ndarray) – Real-space data to be transformed Returns: array – data transformed to fourier space Return type: float ndarray Peforms a Real-to-Real Discrete Sine Transform of type II on a numpy array of non-complex values. For radial data that is symmetric in \(\phi\) and :math`theta`, this is a correct transform to go from Real-space to Fourier-space.
-
to_real
(array)[source]¶ Discrete Sine Transform of a numpy array
Parameters: array (float ndarray) – Fourier-space data to be transformed Returns: - array (float ndarray) – data transformed to Real space
- Peforms a Real-to-Real Discrete Sine Transform of type III
- on a numpy array of non-complex values. For radial data that is
- symmetric in :math:`phi` and (math` heta`, this is a correct transform)
- to go from Real-space to Fourier-space.
-