Transformer¶
This module defines the Transformer class that performs the Fourier transforms
-
class
pystog.transformer.
Transformer
[source]¶ The Transformer class is used to Fourier transform between the difference spaces. Either: a reciprocal space function -> real space function or a real space function -> reciprocal space function
Examples: >>> import numpy >>> from pystog import Transformer >>> transformer = Transformer() >>> q, sq = numpy.loadtxt("my_sofq_file.txt",unpack=True) >>> r = numpy.linspace(0., 25., 2500) >>> r, gr, dgr = transformer.S_to_G(q, sq, r) >>> q = numpy.linspace(0., 25., 2500) >>> q, sq, dsq = transformer.G_to_S(r, gr, q)
-
DCS_to_G
(q, dcs, r, ddcs=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- dcs (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- ddcs (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
DCS_to_GK
(q, dcs, r, ddcs=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- dcs (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- ddcs (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
DCS_to_g
(q, dcs, r, ddcs=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- dcs (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- ddcs (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
FK_to_G
(q, fq_keen, r, dfq_keen=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq_keen (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq_keen (numpy.array or list) – vector uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
FK_to_GK
(q, fq_keen, r, dfq_keen=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq_keen (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq_keen (numpy.array or list) – vector uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
FK_to_g
(q, fq_keen, r, dfq_keen=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq_keen (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq_keen (numpy.array or list) – vector uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
F_to_G
(q, fq, r, dfq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq (numpy.array or list) – uncertainty on
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
F_to_GK
(q, fq, r, dfq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq (numpy.array or list) – uncertainty on
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
F_to_g
(q, fq, r, dfq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- fq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dfq (numpy.array or list) – uncertainty on
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
GK_to_DCS
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
GK_to_F
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
GK_to_FK
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
GK_to_S
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
G_to_DCS
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
G_to_F
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
G_to_FK
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
G_to_S
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
S_to_G
(q, sq, r, dsq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- sq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dsq (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
S_to_GK
(q, sq, r, dsq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- sq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dsq (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
S_to_g
(q, sq, r, dsq=None, **kwargs)[source]¶ Transforms from reciprocal space to real space
Parameters: - q (numpy.array or list) – -space vector
- sq (numpy.array or list) – vector
- r (numpy.array or list) – -space vector
- dsq (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
apply_cropping
(x, y, xmin, xmax, dy=None)[source]¶ Utility to crop x and y based on xmin and xmax along x. Provides the capability to specify the (Qmin,Qmax) or (Rmin,Rmax) in the Fourier transform
Parameters: - x (numpy.array or list) – domain vector
- y (numpy.array or list) – range vector
- xmin (float) – minimum x-value for crop
- xmax (float) – maximum x-value for crop
- dy (numpy.array or list) – uncertainty vector
Returns: vector pair (x,y) with cropping applied
Return type: (numpy.array, numpy.array, numpy.array)
-
fourier_transform
(xin, yin, xout, xmin=None, xmax=None, dyin=None, **kwargs)[source]¶ The Fourier transform function. The kwargs argument allows for different modifications: Lorch dampening, omitted low-x range correction,
Parameters: - xin (numpy.array or list) – domain vector for space to be transformed from
- yin (numpy.array or list) – range vector for space to be transformed from
- xout (numpy.array or list) – domain vector for space to be transformed to
- xmin (float) – minimum x-value for crop
- xmax (float) – maximum x-value for crop
- dyin (numpy.array or list) – uncertainty vector for yin
Returns: vector pair of transformed domain, range vectors, and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
g_to_DCS
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
g_to_F
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
g_to_FK
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-
g_to_S
(r, gr, q, dgr=None, **kwargs)[source]¶ Transforms from real space to reciprocal space
Parameters: - r (numpy.array or list) – -space vector
- gr (numpy.array or list) – vector
- q (numpy.array or list) – -space vector
- dgr (numpy.array or list) – uncertainties
Returns: , , and uncertainties
Return type: numpy.array, numpy.array, numpy.array
-