smrt.microstructure_model package¶
Submodules¶
smrt.microstructure_model.autocorrelation module¶
This module contains the base classes for the microstructure classes. It is not used directly.
-
class
AutocorrelationBase
(params)¶ Bases:
object
Low level base class for the Autocorrelation base class to handle optional and required arguments. It should not be used directly.
-
classmethod
compute_all_arguments
()¶
-
classmethod
valid_arguments
()¶
-
classmethod
-
class
Autocorrelation
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.AutocorrelationBase
Base class for autocorrelation function classes. It should not be used directly but sub-classed. It provides generic handling of the numerical fft and invfft when required by the user or when necessary due to the lack of implementation of the real or ft autocorrelation functions. See the source of
Exponential
to see how to use this class.-
args
= []¶
-
optional_args
= {'ft_numerical': False, 'real_numerical': False}¶
-
ft_autocorrelation_function_fft
(k)¶ compute the fourier transform of the autocorrelation function via fft Args: k: array of wave vector magnitude values, ordered, and non-negative
-
autocorrelation_function_invfft
(r)¶ Compute the autocorrelation function from an analytically known FT via fft Args: r: array of lag vector magnitude values, ordered, non-negative
-
inverted_medium
()¶ return the same autocorrelation for the inverted medium. In general, it is only necessary to invert the fractional volume if the autocorrelation function is numerically symmetric as it should be. This needs to be reimplemented in the sub classes if this is not sufficient.
-
smrt.microstructure_model.exponential module¶
Exponential autocorrelation function model of the microstructure. This microstructure model is used by MEMLS when IBA is selected.
parameters: frac_volume, corr_length
-
class
Exponential
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'corr_length']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
inv_slope_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ compute the ssa for the exponential model according to Debye 1957. See also Maetzler 2002 Eq. 11
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function
-
ft_autocorrelation_function
(k)¶ compute the fourier transform of the autocorrelation function analytically
-
smrt.microstructure_model.gaussian_random_field module¶
Gaussian Random field model of the microstructure.
parameters: frac_volume, corr_length, repeat_distance
-
class
GaussianRandomField
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'corr_length', 'repeat_distance']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
inv_slope_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ Compute the ssa for a sphere
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function for the Gaussian random field model
-
smrt.microstructure_model.homogeneous module¶
Homogeneous microstructure. This microstructure model is to be used with non-scattering emmodel.
parameters: none
-
class
Homogeneous
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
inv_slope_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ compute the ssa of an homogeneous medium
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function
-
ft_autocorrelation_function
(k)¶ compute the fourier transform of the autocorrelation function analytically
-
smrt.microstructure_model.independent_sphere module¶
Independent sphere model of the microstructure.
parameters: frac_volume, radius
-
class
IndependentSphere
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'radius']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
inv_slope_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ Compute the ssa for a sphere
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function for an independent sphere
-
ft_autocorrelation_function
(k)¶ Compute the 3D Fourier transform of the isotropic correlation function for an independent sphere for given magnitude k of the 3D wave vector (float).
-
smrt.microstructure_model.sampled_autocorrelation module¶
Sampled autocorrelation function model. To use when no analytical form of the autocorrelation function but the values of the autocorrelation function (acf) is known at a series of lag.
parameters: frac_volume, lag, acf
acf contains the values at different lag. These parameters must be lists or arrays.
-
class
SampledAutocorrelation
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'lag', 'acf']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ compute the ssa according to Debye 1957. See also Maetzler 2002 Eq. 11
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function by interpolation of requested values from known values
-
smrt.microstructure_model.sticky_hard_spheres module¶
Monodisperse sticky hard sphere model of the microstructure.
parameters: frac_volume, radius, stickiness.
The stickiness is optional but it is recommended to use value around 0.2 as a first guess.
Be aware that low values of stickiness are invalid, the limit depends on the fractional volume
(see for instance Loewe and Picard, 2015). See the tau_min()
method.
Currently the implementation is specific to ice / snow. It can not be used for other materials.
-
class
StickyHardSpheres
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'radius']¶
-
optional_args
= {'stickiness': 1000}¶
-
corr_func_at_origin
¶
-
inv_slope_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ Compute the ssa of a sphere assembly
-
ft_autocorrelation_function
(k)¶ Compute the 3D Fourier transform of the isotropic correlation function for sticky hard spheres in Percus–Yevick approximation for given magnitude k of the 3D wave vector (float).
-
compute_t
()¶ compute the t parameter used in the stickiness
-
tau_min
(frac_volume)¶ compute the minimum possible stickiness value for given ice volume fraction
-
smrt.microstructure_model.test_autocorrelation module¶
smrt.microstructure_model.test_sticky_hard_spheres module¶
-
test_constructor
()¶
-
test_autocorrelation
()¶
smrt.microstructure_model.teubner_strey module¶
Teubner Strey model model of the microstructure.
parameters: frac_volume, corr_length, repeat_distance
-
class
TeubnerStrey
(params)¶ Bases:
smrt.microstructure_model.autocorrelation.Autocorrelation
-
args
= ['frac_volume', 'corr_length', 'repeat_distance']¶
-
optional_args
= {}¶
-
corr_func_at_origin
¶
-
basic_check
()¶ check consistency between the parameters
-
compute_ssa
()¶ Compute the ssa for a sphere
-
autocorrelation_function
(r)¶ compute the real space autocorrelation function for the Teubner Strey model
-
ft_autocorrelation_function
(k)¶ Compute the 3D Fourier transform of the isotropic correlation function for Teubner Strey for given magnitude k of the 3D wave vector (float).
-
Module contents¶
Microstructure models are different representations of the snow microstructure. Because these representations are different, the
parameters to describe actual snow micro-structure depends on the model. For instance, the Sticky Hard Spheres medium is implemented
in sticky_hard_spheres
and its parameters are: the radius (required) and
the stickiness (optional, default value is non-sticky, even though we do recommend to use a stickiness of ~0.1-0.3 in practice).
Because IBA is one of the important electromagnetic theories provided by SMRT, the first/main role of microstructure models is to provide
the Fourier transform of the autocorrelation functions. Hence most microstructure models are named after the autocorrelation function.
For instance, the exponential
autocorrelation function is that used in MEMLS. Its only parameter is the
corr_length.
To use microstructure models, it is only required to read the documentation of each model to determine the required and optional parameters. Selecting the microstructure model is usually done with make_snowpack which only requires the name of the module (the filename with .py). The import of the module is automatic. For instance:
from smrt import make_snowpack
sp = make_snowpack([1, 1000], "exponential", density=[200, 300], corr_length=[0.2e-3, 0.5e-3])
This snippet creates a snowpack with the exponential autocorrelation function for all (2) layers. Import of the exponential
is automatic and creation of instance of the class Exponential
is done by the model
smrt.core.model.Model.run()
method.