fourier¶
This module define the Fourier class and other functions related to the fourier transformation.
-
class
javelin.fourier.
Fourier
[source]¶ The Fourier class contains everything required to calculate the diffuse scattering. The only required thing to be set is
javelin.fourier.Fourier.structure
. There are defaults for all other options including grid, radiation, average structure subtraction and lots options.Examples: >>> from javelin.structure import Structure >>> fourier = Fourier() >>> fourier.structure = Structure() >>> print(fourier) Structure : Structure(False, a=1.0, b=1.0, c=1.0, alpha=90.0, beta=90.0, gamma=90.0) Radiation : neutron Fourier volume : complete crystal Aver. subtraction : False Reciprocal layer : lower left corner : [0 0 0] lower right corner : [1 0 0] upper left corner : [0 1 0] top left corner : [0 0 1] hor. increment : [ 0.01 0. 0. ] vert. increment : [ 0. 0.01 0. ] top increment : [0 0 1] # of points : 101 x 101 x 1 >>> results = fourier.calc() >>> print(results) <xarray.DataArray 'Intensity' ([1 0 0]: 101, [0 1 0]: 101, [0 0 1]: 1)> array([[[ 0.], [ 0.], ..., [ 0.], [ 0.]], [[ 0.], [ 0.], ..., [ 0.], [ 0.]], ..., [[ 0.], [ 0.], ..., [ 0.], [ 0.]], [[ 0.], [ 0.], ..., [ 0.], [ 0.]]]) Coordinates: * [1 0 0] ([1 0 0]) float64 0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 ... * [0 1 0] ([0 1 0]) float64 0.0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 ... * [0 0 1] ([0 0 1]) float64 0.0 Attributes: units: r.l.u
-
approximate
¶ This sets the options of calculating the approximate scattering instead of exact. This is much quicker and is likely good enough for most cases.
Getter: Returns bool of approximate scattering option Setter: Sets whether approximate sacttering is calculated Type: bool
-
average
¶ This sets the options of calculating average structure and subtracted it from the simulated scattering
Getter: Returns bool of average structure subtraction option Setter: Sets whether average stucture is subtracted Type: bool
-
calc
()[source]¶ Calculates the fourier transform
Returns: DataArray containing calculated diffuse scattering Return type: xarray.DataArray
-
calc_average
()[source]¶ Calculates the scattering from the avarage structure
Returns: DataArray containing calculated average scattering Return type: xarray.DataArray
-
grid
= None¶ The grid attribute defines the reciprocal volume from which the scattering will be calculated. Must of type
javelin.grid.Grid
And checkjavelin.grid.Grid
for details on how to change the grid.
-
lots
¶ The size of lots
Getter: Returns the lots size Setter: Sets the lots size Type: list of 3 integers or None
-
magnetic
¶ This sets the options of calculating the magnetic scattering instead of nuclear. This assume neutrons are being used.
Getter: Returns bool of magnetic scattering option Setter: Sets whether magnetic sacttering is calculated Type: bool
-
number_of_lots
¶ The number of lots to use
Getter: Returns the number of lots Setter: Sets the number of lots Type: int
-
radiation
¶ The radiation used
Getter: Returns the radiation selected Setter: Sets the radiation Type: str (‘xray’ or ‘neutron’)
-
structure
¶ The structure from which fourier transform is calculated. The calculation work with any of the following types of structures
javelin.structure.Structure
,ase.Atoms
ordiffpy.Structure.structure.Structure
but if you are using average stucture subtraction or the lots option it needs to bejavelin.structure.Structure
type.Getter: Returns the structure Setter: Sets the structure Type: javelin.structure.Structure
,ase.Atoms
,diffpy.Structure.structure.Structure
-
-
javelin.fourier.
create_xarray_dataarray
(values, grid)[source]¶ Create a xarry DataArray from the input numpy array and grid object.
Parameters: - values (
numpy.ndarray
) – Input array containing the scattering intensities - numbers (
javelin.grid.Grid
) – Grid object describing the array properties
Returns: DataArray produced from the values and grid object
Return type: - values (
-
javelin.fourier.
get_ff
(atomic_number, radiation, q=None)[source]¶ Returns the form factor for a given atomic number, radiation and q values
Parameters: - atomic_number (int) – atomic number
- radiation (str) – type of radiation (‘xray’ or ‘neutron’)
- q (float, list,
numpy.ndarray
) – value or values of q for which to get form factors
Returns: form factors for given q
Return type: float,
numpy.ndarray
Examples: >>> get_ff(8, 'neutron') 5.805
>>> get_ff(8, 'xray', q=2.0) 6.31826029176493
>>> get_ff(8, 'xray', q=[0.0, 3.5, 7.0]) array([ 7.999706 , 4.38417867, 2.08928068])
-
javelin.fourier.
get_mag_ff
(atomic_number, q, ion=0, j=0)[source]¶ Returns the j0 magnetic form factor for a given atomic number, radiation and q values
Parameters: - atomic_number (int) – atomic number
- q (float, list,
numpy.ndarray
) – value or values of q for which to get form factors - ion (int) – charge of selected atom
- j (int) – order of spherical Bessel function (0, 2, 4 or 6)
Returns: magnetic form factor for given q
Return type: float,
numpy.ndarray
Examples: >>> get_mag_ff(8, q=2, ion=1) 0.58510426376585045
>>> get_mag_ff(26, q=[0.0, 3.5, 7.0], ion=2) array([ 1. , 0.49729671, 0.09979243])
>>> get_mag_ff(26, q=[0.0, 3.5, 7.0], ion=4) array([ 0.9997 , 0.58273549, 0.13948496])
>>> get_mag_ff(26, q=[0.0, 3.5, 7.0], ion=4, j=4) array([ 0. , 0.0149604, 0.0759222])