glassure.configuration module
This module contains all configurations classes necessary for the glassure package.
The main entrypoints are the glassure.configuration.CalculationConfig and :class: glassure.configuration.DataModel
pydantic models containing all necessary information for the analysis. These two configurations can then be used analysis
parameters for the glassure.calc.calculate_pdf() calculate to perform the analysis. The output of the calculation
will be a glassure.configuration.Result object containing the results of the analysis.
The models are then further split into submodels for better readability and maintainability.
- pydantic model glassure.configuration.CalculationConfig
Bases:
BaseModelMain calculation configuration model for the glassure data processing. Does not contain any data, but only the information how to process the dataset.
To reuse the calculation config for a different calculation with some parameters changed, it is advised to use the model_copy(deep=True) method of the config.
This will create a deep copy of the configuration object and not overwrite parameters of the original one. (see https://docs.pydantic.dev/latest/concepts/serialization/#model_copy for more information).
For example: ``` config = CalculationConfig() config.sample.composition = {“Si”: Si, “O”: 2}
config_copy = config.model_copy(deep=True) config_copy.sample.composition = {“Ge”: 1, “O”: 2} ```
Show JSON schema
{ "title": "CalculationConfig", "description": "Main calculation configuration model for the glassure data processing.\nDoes not contain any data, but only the information how to process the dataset.\n\nTo reuse the calculation config for a different calculation with some parameters changed, it is advised to use the\nmodel_copy(deep=True) method of the config.\n\nThis will create a deep copy of the configuration object and not\noverwrite parameters of the original one. (see https://docs.pydantic.dev/latest/concepts/serialization/#model_copy\nfor more information).\n\nFor example:\n```\nconfig = CalculationConfig()\nconfig.sample.composition = {\"Si\": Si, \"O\": 2}\n\nconfig_copy = config.model_copy(deep=True)\nconfig_copy.sample.composition = {\"Ge\": 1, \"O\": 2}\n```", "type": "object", "properties": { "sample": { "$ref": "#/$defs/SampleConfig", "description": "Sample configuration model, containing the composition and density of the material." }, "transform": { "$ref": "#/$defs/TransformConfig", "description": "Transform configuration model, containing the normalization, transform and \n extrapolation settings." }, "optimize": { "anyOf": [ { "$ref": "#/$defs/OptimizeConfig" }, { "type": "null" } ], "default": null, "description": "Optimization configuration model. If None, no optimization is performed" } }, "$defs": { "ExtrapolationConfig": { "properties": { "method": { "$ref": "#/$defs/ExtrapolationMethod", "default": "step", "description": "Method for the extrapolation of the structure factor S(q) from q_min to zero." }, "s0": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Target value at S(0) for the extrapolation to. If is None, the theorethical value is used.", "title": "S0" }, "overlap": { "default": 0.2, "description": "Overlap in q-space [1/A] for the extrapolation. E.g. the fitting range.", "title": "Overlap", "type": "number" }, "replace": { "default": false, "description": "Whether to replace the original S(q) data in the overlap region with the extrapolated values.", "title": "Replace", "type": "boolean" } }, "title": "ExtrapolationConfig", "type": "object" }, "ExtrapolationMethod": { "description": "Enum class for the different extrapolation methods of the S(Q) to\nS(0)", "enum": [ "step", "linear", "poly", "spline" ], "title": "ExtrapolationMethod", "type": "string" }, "FitNormalization": { "properties": { "TYPE": { "const": "fit", "default": "fit", "description": "Normalization type", "title": "Type", "type": "string" }, "q_cutoff": { "default": 3.0, "description": "Cutoff q in 1/A for the normalization. Only above this value the normalization is performed.", "title": "Q Cutoff", "type": "number" }, "method": { "default": "squared", "description": "How to scale the values in respect to q during fitting. \"linear\" or \"squared\" are possible.", "title": "Method", "type": "string" }, "multiple_scattering": { "default": false, "description": "Whether to consider multiple scattering - if true, the multiple scattering is approximated by a constant value.", "title": "Multiple Scattering", "type": "boolean" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization.", "title": "Incoherent Scattering", "type": "boolean" }, "container_scattering": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Composition of the container material in the experiment. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'. Only the incoherent scattering of the container is considered. The container scattering is subtracted from the total scattering and the amount is fitted by just muliplying it with a constant value. If None, no container scattering is considered.", "title": "Container Scattering" } }, "title": "FitNormalization", "type": "object" }, "FourierTransformMethod": { "description": "Enum class for the different methods to perform a Fourier transform.", "enum": [ "fft", "integral" ], "title": "FourierTransformMethod", "type": "string" }, "IntNormalization": { "properties": { "TYPE": { "const": "integral", "default": "integral", "description": "Normalization type", "title": "Type", "type": "string" }, "attenuation_factor": { "default": 0.001, "description": "Attenuation factor for the normalization", "title": "Attenuation Factor", "type": "number" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization", "title": "Incoherent Scattering", "type": "boolean" } }, "title": "IntNormalization", "type": "object" }, "OptimizationMethod": { "description": "Enum class for the different S(Q) optimization methods.", "enum": [ "iterative", "fit" ], "title": "OptimizationMethod", "type": "string" }, "OptimizeConfig": { "properties": { "method": { "$ref": "#/$defs/OptimizationMethod", "default": "iterative", "description": "Method for S(Q) optimization. 'iterative' uses the Kaplow back-and-forth Fourier transform method (Eggert et al. 2002). 'fit' uses polynomial fitting to remove low-r artifacts (Juh\u00e1s et al. 2013)." }, "r_cutoff": { "default": 1.4, "description": "Cutoff r for the optimization. Should be below the first peak in g(r).", "title": "R Cutoff", "type": "number" }, "iterations": { "default": 5, "description": "Number of iterations for the Kaplow optimization. Only used when method='iterative'.", "title": "Iterations", "type": "integer" }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function during the optimization procedure. Only used when method='iterative'. This can be different from the transform configuration.", "title": "Use Modification Fcn", "type": "boolean" } }, "title": "OptimizeConfig", "type": "object" }, "SampleConfig": { "properties": { "composition": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" } ], "description": "Composition of the sample. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'.", "title": "Composition" }, "density": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Density in g/cm^3. Will be automatically updated when the atomic density is set", "title": "Density" } }, "title": "SampleConfig", "type": "object" }, "TransformConfig": { "properties": { "q_min": { "default": 0.0, "description": "Minimum q in 1/Angstrom from the data. Below it will be extended to zero.", "title": "Q Min", "type": "number" }, "q_max": { "default": 10.0, "description": "Maximum q in 1/Angstrom from the data.", "title": "Q Max", "type": "number" }, "r_min": { "default": 0.0, "description": "Minimum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Min", "type": "number" }, "r_max": { "default": 10.0, "description": "Maximum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Max", "type": "number" }, "r_step": { "default": 0.01, "description": "Step size for the r values in Angstrom for the calculated pair distribution function g(r).", "title": "R Step", "type": "number" }, "normalization": { "anyOf": [ { "$ref": "#/$defs/FitNormalization" }, { "$ref": "#/$defs/IntNormalization" } ], "description": "Normalization configuration model. Possible values are :class:`FitNormalization` or :class:`IntNormalization`.", "title": "Normalization" }, "extrapolation": { "$ref": "#/$defs/ExtrapolationConfig", "description": "Extrapolation configuration model." }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function.", "title": "Use Modification Fcn", "type": "boolean" }, "kn_correction": { "default": false, "description": "Whether to apply the Klein-Nishima correction to the Compton scattering of the sample and the container (defined in normalization).", "title": "Kn Correction", "type": "boolean" }, "wavelength": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Wavelength in Angstrom. Needs to be set for the Klein-Nishima correction.", "title": "Wavelength" }, "fourier_transform_method": { "$ref": "#/$defs/FourierTransformMethod", "default": "fft" }, "scattering_factor_source": { "default": "brown_hubbell", "description": "Source of the scattering factors. Possible values are: 'brown_hubbell' for scattering factors from Brown et al., 2006 and Hubbell et al., 1975 or 'haijdu' for scattering factors from Hajdu et al. (Acta Cryst. (1992). A48, 344-352).", "title": "Scattering Factor Source", "type": "string" } }, "title": "TransformConfig", "type": "object" } } }
- Fields:
- field optimize: OptimizeConfig | None = None
Optimization configuration model. If None, no optimization is performed
- field sample: SampleConfig [Optional]
Sample configuration model, containing the composition and density of the material.
- field transform: TransformConfig [Optional]
Transform configuration model, containing the normalization, transform and extrapolation settings.
- pydantic model glassure.configuration.DataConfig
Bases:
BaseModelConfiguration for the collected data, containing the data pattern, the background pattern and the bkg scaling parameter.
Show JSON schema
{ "title": "DataConfig", "description": "Configuration for the collected data, containing the data pattern, the background pattern and the bkg scaling\nparameter.", "type": "object", "properties": { "data": { "$ref": "#/$defs/Pattern", "description": "The data pattern." }, "bkg": { "anyOf": [ { "$ref": "#/$defs/Pattern" }, { "type": "null" } ], "default": null, "description": "The background pattern." }, "bkg_scaling": { "default": 1.0, "description": "The scaling factor for the background pattern.", "title": "Bkg Scaling", "type": "number" } }, "$defs": { "Pattern": { "description": "A Pattern is a set of x and y values.\nIt can be loaded from a file or created from scratch and can be modified by\ndifferent methods.\nIt builds the basis for all calculations in glassure.\n\n:param x: x values of the pattern\n:param y: y values of the pattern\n:param name: name of the pattern", "properties": { "x": { "title": "X" }, "y": { "title": "Y" }, "name": { "default": "", "title": "Name", "type": "string" } }, "required": [ "x", "y" ], "title": "Pattern", "type": "object" } }, "required": [ "data" ] }
- field bkg_scaling: float = 1.0
The scaling factor for the background pattern.
- pydantic model glassure.configuration.ExtrapolationConfig
Bases:
BaseModelShow JSON schema
{ "title": "ExtrapolationConfig", "type": "object", "properties": { "method": { "$ref": "#/$defs/ExtrapolationMethod", "default": "step", "description": "Method for the extrapolation of the structure factor S(q) from q_min to zero." }, "s0": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Target value at S(0) for the extrapolation to. If is None, the theorethical value is used.", "title": "S0" }, "overlap": { "default": 0.2, "description": "Overlap in q-space [1/A] for the extrapolation. E.g. the fitting range.", "title": "Overlap", "type": "number" }, "replace": { "default": false, "description": "Whether to replace the original S(q) data in the overlap region with the extrapolated values.", "title": "Replace", "type": "boolean" } }, "$defs": { "ExtrapolationMethod": { "description": "Enum class for the different extrapolation methods of the S(Q) to\nS(0)", "enum": [ "step", "linear", "poly", "spline" ], "title": "ExtrapolationMethod", "type": "string" } } }
- Fields:
- field method: ExtrapolationMethod = ExtrapolationMethod.STEP
Method for the extrapolation of the structure factor S(q) from q_min to zero.
- field overlap: float = 0.2
Overlap in q-space [1/A] for the extrapolation. E.g. the fitting range.
- field replace: bool = False
Whether to replace the original S(q) data in the overlap region with the extrapolated values.
- field s0: float | None = None
Target value at S(0) for the extrapolation to. If is None, the theorethical value is used.
- pydantic model glassure.configuration.FitNormalization
Bases:
BaseModelShow JSON schema
{ "title": "FitNormalization", "type": "object", "properties": { "TYPE": { "const": "fit", "default": "fit", "description": "Normalization type", "title": "Type", "type": "string" }, "q_cutoff": { "default": 3.0, "description": "Cutoff q in 1/A for the normalization. Only above this value the normalization is performed.", "title": "Q Cutoff", "type": "number" }, "method": { "default": "squared", "description": "How to scale the values in respect to q during fitting. \"linear\" or \"squared\" are possible.", "title": "Method", "type": "string" }, "multiple_scattering": { "default": false, "description": "Whether to consider multiple scattering - if true, the multiple scattering is approximated by a constant value.", "title": "Multiple Scattering", "type": "boolean" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization.", "title": "Incoherent Scattering", "type": "boolean" }, "container_scattering": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Composition of the container material in the experiment. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'. Only the incoherent scattering of the container is considered. The container scattering is subtracted from the total scattering and the amount is fitted by just muliplying it with a constant value. If None, no container scattering is considered.", "title": "Container Scattering" } } }
- Fields:
- Validators:
_validate_container_scattering»container_scattering
- field TYPE: Literal['fit'] = 'fit'
Normalization type
- field container_scattering: dict[str, float] | dict[str, int] | None = None
Composition of the container material in the experiment. Can be a dictionary of elements, e.g. {‘Si’: 1, ‘O’: 2}, and their abundances or a string of the form ‘SiO2’. Only the incoherent scattering of the container is considered. The container scattering is subtracted from the total scattering and the amount is fitted by just muliplying it with a constant value. If None, no container scattering is considered.
- Validated by:
_validate_container_scattering
- field incoherent_scattering: bool = True
Whether to subtract the incoherent scattering during the normalization.
- field method: str = 'squared'
How to scale the values in respect to q during fitting. “linear” or “squared” are possible.
- field multiple_scattering: bool = False
Whether to consider multiple scattering - if true, the multiple scattering is approximated by a constant value.
- field q_cutoff: float = 3.0
Cutoff q in 1/A for the normalization. Only above this value the normalization is performed.
- pydantic model glassure.configuration.IntNormalization
Bases:
BaseModelShow JSON schema
{ "title": "IntNormalization", "type": "object", "properties": { "TYPE": { "const": "integral", "default": "integral", "description": "Normalization type", "title": "Type", "type": "string" }, "attenuation_factor": { "default": 0.001, "description": "Attenuation factor for the normalization", "title": "Attenuation Factor", "type": "number" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization", "title": "Incoherent Scattering", "type": "boolean" } } }
- field TYPE: Literal['integral'] = 'integral'
Normalization type
- field attenuation_factor: float = 0.001
Attenuation factor for the normalization
- field incoherent_scattering: bool = True
Whether to subtract the incoherent scattering during the normalization
- pydantic model glassure.configuration.OptimizeConfig
Bases:
BaseModelShow JSON schema
{ "title": "OptimizeConfig", "type": "object", "properties": { "method": { "$ref": "#/$defs/OptimizationMethod", "default": "iterative", "description": "Method for S(Q) optimization. 'iterative' uses the Kaplow back-and-forth Fourier transform method (Eggert et al. 2002). 'fit' uses polynomial fitting to remove low-r artifacts (Juh\u00e1s et al. 2013)." }, "r_cutoff": { "default": 1.4, "description": "Cutoff r for the optimization. Should be below the first peak in g(r).", "title": "R Cutoff", "type": "number" }, "iterations": { "default": 5, "description": "Number of iterations for the Kaplow optimization. Only used when method='iterative'.", "title": "Iterations", "type": "integer" }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function during the optimization procedure. Only used when method='iterative'. This can be different from the transform configuration.", "title": "Use Modification Fcn", "type": "boolean" } }, "$defs": { "OptimizationMethod": { "description": "Enum class for the different S(Q) optimization methods.", "enum": [ "iterative", "fit" ], "title": "OptimizationMethod", "type": "string" } } }
- Fields:
- field iterations: int = 5
Number of iterations for the Kaplow optimization. Only used when method=’iterative’.
- field method: OptimizationMethod = OptimizationMethod.ITERATIVE
Method for S(Q) optimization. ‘iterative’ uses the Kaplow back-and-forth Fourier transform method (Eggert et al. 2002). ‘fit’ uses polynomial fitting to remove low-r artifacts (Juhás et al. 2013).
- field r_cutoff: float = 1.4
Cutoff r for the optimization. Should be below the first peak in g(r).
- field use_modification_fcn: bool = False
Whether to use the Lorch modification function during the optimization procedure. Only used when method=’iterative’. This can be different from the transform configuration.
- pydantic model glassure.configuration.Result
Bases:
BaseModelShow JSON schema
{ "title": "Result", "type": "object", "properties": { "calculation_config": { "$ref": "#/$defs/CalculationConfig", "description": "The configuration used for the calculation." }, "sq": { "anyOf": [ { "$ref": "#/$defs/Pattern" }, { "type": "null" } ], "default": null, "description": "The calculated structure factor S(q)." }, "fr": { "anyOf": [ { "$ref": "#/$defs/Pattern" }, { "type": "null" } ], "default": null, "description": "The calculated pair distribution function F(r)." }, "gr": { "anyOf": [ { "$ref": "#/$defs/Pattern" }, { "type": "null" } ], "default": null, "description": "The calculated g(r)." } }, "$defs": { "CalculationConfig": { "description": "Main calculation configuration model for the glassure data processing.\nDoes not contain any data, but only the information how to process the dataset.\n\nTo reuse the calculation config for a different calculation with some parameters changed, it is advised to use the\nmodel_copy(deep=True) method of the config.\n\nThis will create a deep copy of the configuration object and not\noverwrite parameters of the original one. (see https://docs.pydantic.dev/latest/concepts/serialization/#model_copy\nfor more information).\n\nFor example:\n```\nconfig = CalculationConfig()\nconfig.sample.composition = {\"Si\": Si, \"O\": 2}\n\nconfig_copy = config.model_copy(deep=True)\nconfig_copy.sample.composition = {\"Ge\": 1, \"O\": 2}\n```", "properties": { "sample": { "$ref": "#/$defs/SampleConfig", "description": "Sample configuration model, containing the composition and density of the material." }, "transform": { "$ref": "#/$defs/TransformConfig", "description": "Transform configuration model, containing the normalization, transform and \n extrapolation settings." }, "optimize": { "anyOf": [ { "$ref": "#/$defs/OptimizeConfig" }, { "type": "null" } ], "default": null, "description": "Optimization configuration model. If None, no optimization is performed" } }, "title": "CalculationConfig", "type": "object" }, "ExtrapolationConfig": { "properties": { "method": { "$ref": "#/$defs/ExtrapolationMethod", "default": "step", "description": "Method for the extrapolation of the structure factor S(q) from q_min to zero." }, "s0": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Target value at S(0) for the extrapolation to. If is None, the theorethical value is used.", "title": "S0" }, "overlap": { "default": 0.2, "description": "Overlap in q-space [1/A] for the extrapolation. E.g. the fitting range.", "title": "Overlap", "type": "number" }, "replace": { "default": false, "description": "Whether to replace the original S(q) data in the overlap region with the extrapolated values.", "title": "Replace", "type": "boolean" } }, "title": "ExtrapolationConfig", "type": "object" }, "ExtrapolationMethod": { "description": "Enum class for the different extrapolation methods of the S(Q) to\nS(0)", "enum": [ "step", "linear", "poly", "spline" ], "title": "ExtrapolationMethod", "type": "string" }, "FitNormalization": { "properties": { "TYPE": { "const": "fit", "default": "fit", "description": "Normalization type", "title": "Type", "type": "string" }, "q_cutoff": { "default": 3.0, "description": "Cutoff q in 1/A for the normalization. Only above this value the normalization is performed.", "title": "Q Cutoff", "type": "number" }, "method": { "default": "squared", "description": "How to scale the values in respect to q during fitting. \"linear\" or \"squared\" are possible.", "title": "Method", "type": "string" }, "multiple_scattering": { "default": false, "description": "Whether to consider multiple scattering - if true, the multiple scattering is approximated by a constant value.", "title": "Multiple Scattering", "type": "boolean" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization.", "title": "Incoherent Scattering", "type": "boolean" }, "container_scattering": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Composition of the container material in the experiment. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'. Only the incoherent scattering of the container is considered. The container scattering is subtracted from the total scattering and the amount is fitted by just muliplying it with a constant value. If None, no container scattering is considered.", "title": "Container Scattering" } }, "title": "FitNormalization", "type": "object" }, "FourierTransformMethod": { "description": "Enum class for the different methods to perform a Fourier transform.", "enum": [ "fft", "integral" ], "title": "FourierTransformMethod", "type": "string" }, "IntNormalization": { "properties": { "TYPE": { "const": "integral", "default": "integral", "description": "Normalization type", "title": "Type", "type": "string" }, "attenuation_factor": { "default": 0.001, "description": "Attenuation factor for the normalization", "title": "Attenuation Factor", "type": "number" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization", "title": "Incoherent Scattering", "type": "boolean" } }, "title": "IntNormalization", "type": "object" }, "OptimizationMethod": { "description": "Enum class for the different S(Q) optimization methods.", "enum": [ "iterative", "fit" ], "title": "OptimizationMethod", "type": "string" }, "OptimizeConfig": { "properties": { "method": { "$ref": "#/$defs/OptimizationMethod", "default": "iterative", "description": "Method for S(Q) optimization. 'iterative' uses the Kaplow back-and-forth Fourier transform method (Eggert et al. 2002). 'fit' uses polynomial fitting to remove low-r artifacts (Juh\u00e1s et al. 2013)." }, "r_cutoff": { "default": 1.4, "description": "Cutoff r for the optimization. Should be below the first peak in g(r).", "title": "R Cutoff", "type": "number" }, "iterations": { "default": 5, "description": "Number of iterations for the Kaplow optimization. Only used when method='iterative'.", "title": "Iterations", "type": "integer" }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function during the optimization procedure. Only used when method='iterative'. This can be different from the transform configuration.", "title": "Use Modification Fcn", "type": "boolean" } }, "title": "OptimizeConfig", "type": "object" }, "Pattern": { "description": "A Pattern is a set of x and y values.\nIt can be loaded from a file or created from scratch and can be modified by\ndifferent methods.\nIt builds the basis for all calculations in glassure.\n\n:param x: x values of the pattern\n:param y: y values of the pattern\n:param name: name of the pattern", "properties": { "x": { "title": "X" }, "y": { "title": "Y" }, "name": { "default": "", "title": "Name", "type": "string" } }, "required": [ "x", "y" ], "title": "Pattern", "type": "object" }, "SampleConfig": { "properties": { "composition": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" } ], "description": "Composition of the sample. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'.", "title": "Composition" }, "density": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Density in g/cm^3. Will be automatically updated when the atomic density is set", "title": "Density" } }, "title": "SampleConfig", "type": "object" }, "TransformConfig": { "properties": { "q_min": { "default": 0.0, "description": "Minimum q in 1/Angstrom from the data. Below it will be extended to zero.", "title": "Q Min", "type": "number" }, "q_max": { "default": 10.0, "description": "Maximum q in 1/Angstrom from the data.", "title": "Q Max", "type": "number" }, "r_min": { "default": 0.0, "description": "Minimum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Min", "type": "number" }, "r_max": { "default": 10.0, "description": "Maximum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Max", "type": "number" }, "r_step": { "default": 0.01, "description": "Step size for the r values in Angstrom for the calculated pair distribution function g(r).", "title": "R Step", "type": "number" }, "normalization": { "anyOf": [ { "$ref": "#/$defs/FitNormalization" }, { "$ref": "#/$defs/IntNormalization" } ], "description": "Normalization configuration model. Possible values are :class:`FitNormalization` or :class:`IntNormalization`.", "title": "Normalization" }, "extrapolation": { "$ref": "#/$defs/ExtrapolationConfig", "description": "Extrapolation configuration model." }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function.", "title": "Use Modification Fcn", "type": "boolean" }, "kn_correction": { "default": false, "description": "Whether to apply the Klein-Nishima correction to the Compton scattering of the sample and the container (defined in normalization).", "title": "Kn Correction", "type": "boolean" }, "wavelength": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Wavelength in Angstrom. Needs to be set for the Klein-Nishima correction.", "title": "Wavelength" }, "fourier_transform_method": { "$ref": "#/$defs/FourierTransformMethod", "default": "fft" }, "scattering_factor_source": { "default": "brown_hubbell", "description": "Source of the scattering factors. Possible values are: 'brown_hubbell' for scattering factors from Brown et al., 2006 and Hubbell et al., 1975 or 'haijdu' for scattering factors from Hajdu et al. (Acta Cryst. (1992). A48, 344-352).", "title": "Scattering Factor Source", "type": "string" } }, "title": "TransformConfig", "type": "object" } }, "required": [ "calculation_config" ] }
- Fields:
- field calculation_config: CalculationConfig [Required]
The configuration used for the calculation.
- pydantic model glassure.configuration.SampleConfig
Bases:
BaseModelShow JSON schema
{ "title": "SampleConfig", "type": "object", "properties": { "composition": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" } ], "description": "Composition of the sample. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'.", "title": "Composition" }, "density": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Density in g/cm^3. Will be automatically updated when the atomic density is set", "title": "Density" } } }
- Fields:
- Validators:
_validate_composition»composition
- field composition: dict[str, float] | dict[str, int] [Optional]
Composition of the sample. Can be a dictionary of elements, e.g. {‘Si’: 1, ‘O’: 2}, and their abundances or a string of the form ‘SiO2’.
- Validated by:
_validate_composition
- field density: float | None = None
Density in g/cm^3. Will be automatically updated when the atomic density is set
- property atomic_density: float | None
- pydantic model glassure.configuration.TransformConfig
Bases:
BaseModelShow JSON schema
{ "title": "TransformConfig", "type": "object", "properties": { "q_min": { "default": 0.0, "description": "Minimum q in 1/Angstrom from the data. Below it will be extended to zero.", "title": "Q Min", "type": "number" }, "q_max": { "default": 10.0, "description": "Maximum q in 1/Angstrom from the data.", "title": "Q Max", "type": "number" }, "r_min": { "default": 0.0, "description": "Minimum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Min", "type": "number" }, "r_max": { "default": 10.0, "description": "Maximum r in Angstrom for the calculated pair distribution function g(r).", "title": "R Max", "type": "number" }, "r_step": { "default": 0.01, "description": "Step size for the r values in Angstrom for the calculated pair distribution function g(r).", "title": "R Step", "type": "number" }, "normalization": { "anyOf": [ { "$ref": "#/$defs/FitNormalization" }, { "$ref": "#/$defs/IntNormalization" } ], "description": "Normalization configuration model. Possible values are :class:`FitNormalization` or :class:`IntNormalization`.", "title": "Normalization" }, "extrapolation": { "$ref": "#/$defs/ExtrapolationConfig", "description": "Extrapolation configuration model." }, "use_modification_fcn": { "default": false, "description": "Whether to use the Lorch modification function.", "title": "Use Modification Fcn", "type": "boolean" }, "kn_correction": { "default": false, "description": "Whether to apply the Klein-Nishima correction to the Compton scattering of the sample and the container (defined in normalization).", "title": "Kn Correction", "type": "boolean" }, "wavelength": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Wavelength in Angstrom. Needs to be set for the Klein-Nishima correction.", "title": "Wavelength" }, "fourier_transform_method": { "$ref": "#/$defs/FourierTransformMethod", "default": "fft" }, "scattering_factor_source": { "default": "brown_hubbell", "description": "Source of the scattering factors. Possible values are: 'brown_hubbell' for scattering factors from Brown et al., 2006 and Hubbell et al., 1975 or 'haijdu' for scattering factors from Hajdu et al. (Acta Cryst. (1992). A48, 344-352).", "title": "Scattering Factor Source", "type": "string" } }, "$defs": { "ExtrapolationConfig": { "properties": { "method": { "$ref": "#/$defs/ExtrapolationMethod", "default": "step", "description": "Method for the extrapolation of the structure factor S(q) from q_min to zero." }, "s0": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Target value at S(0) for the extrapolation to. If is None, the theorethical value is used.", "title": "S0" }, "overlap": { "default": 0.2, "description": "Overlap in q-space [1/A] for the extrapolation. E.g. the fitting range.", "title": "Overlap", "type": "number" }, "replace": { "default": false, "description": "Whether to replace the original S(q) data in the overlap region with the extrapolated values.", "title": "Replace", "type": "boolean" } }, "title": "ExtrapolationConfig", "type": "object" }, "ExtrapolationMethod": { "description": "Enum class for the different extrapolation methods of the S(Q) to\nS(0)", "enum": [ "step", "linear", "poly", "spline" ], "title": "ExtrapolationMethod", "type": "string" }, "FitNormalization": { "properties": { "TYPE": { "const": "fit", "default": "fit", "description": "Normalization type", "title": "Type", "type": "string" }, "q_cutoff": { "default": 3.0, "description": "Cutoff q in 1/A for the normalization. Only above this value the normalization is performed.", "title": "Q Cutoff", "type": "number" }, "method": { "default": "squared", "description": "How to scale the values in respect to q during fitting. \"linear\" or \"squared\" are possible.", "title": "Method", "type": "string" }, "multiple_scattering": { "default": false, "description": "Whether to consider multiple scattering - if true, the multiple scattering is approximated by a constant value.", "title": "Multiple Scattering", "type": "boolean" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization.", "title": "Incoherent Scattering", "type": "boolean" }, "container_scattering": { "anyOf": [ { "additionalProperties": { "type": "number" }, "type": "object" }, { "additionalProperties": { "type": "integer" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Composition of the container material in the experiment. Can be a dictionary of elements, e.g. {'Si': 1, 'O': 2}, and their abundances or a string of the form 'SiO2'. Only the incoherent scattering of the container is considered. The container scattering is subtracted from the total scattering and the amount is fitted by just muliplying it with a constant value. If None, no container scattering is considered.", "title": "Container Scattering" } }, "title": "FitNormalization", "type": "object" }, "FourierTransformMethod": { "description": "Enum class for the different methods to perform a Fourier transform.", "enum": [ "fft", "integral" ], "title": "FourierTransformMethod", "type": "string" }, "IntNormalization": { "properties": { "TYPE": { "const": "integral", "default": "integral", "description": "Normalization type", "title": "Type", "type": "string" }, "attenuation_factor": { "default": 0.001, "description": "Attenuation factor for the normalization", "title": "Attenuation Factor", "type": "number" }, "incoherent_scattering": { "default": true, "description": "Whether to subtract the incoherent scattering during the normalization", "title": "Incoherent Scattering", "type": "boolean" } }, "title": "IntNormalization", "type": "object" } } }
- Fields:
- field extrapolation: ExtrapolationConfig [Optional]
Extrapolation configuration model.
- field fourier_transform_method: FourierTransformMethod = FourierTransformMethod.FFT
- field kn_correction: bool = False
Whether to apply the Klein-Nishima correction to the Compton scattering of the sample and the container (defined in normalization).
- field normalization: FitNormalization | IntNormalization [Optional]
Normalization configuration model. Possible values are
FitNormalizationorIntNormalization.
- field q_max: float = 10.0
Maximum q in 1/Angstrom from the data.
- field q_min: float = 0.0
Minimum q in 1/Angstrom from the data. Below it will be extended to zero.
- field r_max: float = 10.0
Maximum r in Angstrom for the calculated pair distribution function g(r).
- field r_min: float = 0.0
Minimum r in Angstrom for the calculated pair distribution function g(r).
- field r_step: float = 0.01
Step size for the r values in Angstrom for the calculated pair distribution function g(r).
- field scattering_factor_source: str = 'brown_hubbell'
Source of the scattering factors. Possible values are: ‘brown_hubbell’ for scattering factors from Brown et al., 2006 and Hubbell et al., 1975 or ‘haijdu’ for scattering factors from Hajdu et al. (Acta Cryst. (1992). A48, 344-352).
- field use_modification_fcn: bool = False
Whether to use the Lorch modification function.
- field wavelength: float | None = None
Wavelength in Angstrom. Needs to be set for the Klein-Nishima correction.