2.9.1. prismatique.thermal.Params
- class Params(enable_thermal_effects=False, num_frozen_phonon_configs_per_subset=1, num_subsets=1, rng_seed=None, skip_validation_and_conversion=False)[source]
Bases:
PreSerializableAndUpdatableThe simulation parameters related to the thermal properties of the sample and its environment.
In STEM experiments, the intensity pattern for a given probe collected by the STEM detector measures the diagonal elements of the state operator \(\hat{\rho}_{t}\) of a transmitted beam electron, in the electron’s transverse momentum basis:
(2.9.1.1)\[I_{\text{STEM}}\left(k_{x},k_{y}\right)\Delta k_{x}\Delta k_{y} \approx N_{e}\left\langle k_{x},k_{y}\right| \hat{\rho}_{t}\left|k_{x},k_{y}\right\rangle \Delta k_{x}\Delta k_{y},\]where \(N_{e}\) is the number of electrons collected by the detector for said intensity pattern; \(\left|k_{x},k_{y}\right\rangle\) is the electron transverse momentum eigenvector; \(\Delta k_{x}\) is the resolution of the STEM detector in the \(k_{x}\)-direction; \(\Delta k_{y}\) is the resolution of the STEM detector in the \(k_{y}\)-direction; \(I_{\text{STEM}}\left(k_{x},k_{y}\right)\Delta k_{x}\Delta k_{y}\) is the measured intensity, i.e. electron count, over the STEM detector pixel with the effective transverse momentum coordinates \(\left(k_{x},k_{y}\right)\). Similarly, in HRTEM experiments, the intensity image for a given beam collected by the TEM detector measures the diagonal elements of the state operator \(\hat{\rho}_{t}\) of a transmitted beam electron, in the transverse (i.e. \(xy\)) position basis:
(2.9.1.2)\[I_{\text{HRTEM}}\left(x,y\right)\Delta x\Delta y\approx N_{e}\left\langle x,y\right|\hat{\rho}_{t}\left|x,y\right\rangle \Delta x\Delta y,\]where \(\left|x,y\right\rangle\) is the electron transverse position eigenvector; \(\Delta x\) is the resolution of the TEM detector in the \(x\)-direction; \(\Delta y\) is the resolution of the TEM detector in the \(y\)-direction; \(I_{\text{HRTEM}}\left(x,y\right)\Delta x\Delta y\) is the measured intensity, i.e. electron count, over the TEM detector pixel with the effective transverse position coordinates \(\left(x,y\right)\).
Due to various sources of decoherence, a given transmitted beam electron will generally be in a mixed state. In
prismatique, we consider thermal fluctuations in the sample and chromatic aberrations as the dominant sources of decoherence for STEM and HRTEM simulations, where for the latter we also consider finite source size effects. At finite temperature, the atoms in the sample collectively vibrate to form phonons. Typically, the phonons have vibration periods on the order of \(10^{-13}`s [Loane1]_. A beam electron will typically pass through the sample in a time on the order of :math:`10^{-16}`s [Loane1]_, which is several orders of magnitude faster than the typical phonon vibration period. Hence, at a semiclassical level, any beam electron passing through the sample will interact with the vibrating atoms as if they were effectively stationary, i.e. the atoms are effectively in a frozen atomic or phonon configuration during the time interval it takes for a beam electron to pass through the sample. For typical beam currents, the average time between successive electrons passing through the specimen is about :math:`10^3\) phonon vibration periods, therefore the effective frozen phonon configurations that successive beam electrons interact with are essentially uncorrelated. In scenarios where chromatic aberrations are present, and there are small fluctuations in the electron beam energy over time, there will be correspondingly small fluctuations in the defocus of the electron beam over time. In HRTEM experiments, the electron beam will generally illuminate the sample with a small distribution of angles, due to finite source size effects from the electron gun.To model the decoherence effects, we consider the following general state operator for a transmitted beam electron:
(2.9.1.3)\[\begin{split}\hat{\rho}_{t}&=\int_{-\infty}^{\infty}d\delta_{f}\, \prod_{j=1}^{N}\left\{ \int d\mathbf{u}_{j}\right\} \, \int d\boldsymbol{\delta}_{\beta}\\ &\phantom{=}\quad\mathop{\times}p_{\sigma_{f}}\left(\delta_{f}\right) p_{a}\left(\mathbf{u}_{1},\ldots,\mathbf{u}_{N}\right) p_{\sigma_{\beta}}\left(\boldsymbol{\delta}_{\beta}\right)\\ &\phantom{=}\quad\mathop{\times} \hat{\rho}_{t}\left(\delta_{f};\mathbf{u}_{1},\ldots,\mathbf{u}_{N}; \boldsymbol{\delta}_{\beta}\right),\end{split}\]where \(\delta_{f}\) is the defocal offset, i.e. a deviation from the target operating defocus \(\Delta f\); \(p_{\sigma_{f}}\left(\delta_{f}\right)\) is the distribution of \(\delta_{f}\):
(2.9.1.4)\[p_{\sigma_{f}}\left(\delta_{f}\right)=\frac{1}{\sigma_{f}\sqrt{2\pi}} \exp\left(-\frac{1}{2}\frac{\delta_{f}^{2}}{\sigma_{f}^{2}}\right),\]with \(\sigma_{f}\) being the defocal spread; \(\boldsymbol{\delta}_{\beta}\) is the deviation from the target operating beam tilt \(\mathbf{k}_{xy,\beta}\); \(p_{\sigma_{\beta}}\left(\boldsymbol{\delta}_{\beta}\right)\) is the distribution of \(\boldsymbol{\delta}_{\beta}\):
(2.9.1.5)\[p_{\sigma_{\beta}}\left(\boldsymbol{\delta}_{\beta}\right)= \frac{1}{\sigma_{\beta}\sqrt{2\pi}} \exp\left(-\frac{1}{2} \frac{\left|\boldsymbol{\delta}_{\beta}\right|^{2}}{\sigma_{\beta}^{2}} \right),\]with \(\sigma_{\beta}\) being the beam tilt spread; \(N\) is the number of atoms in the sample’s supercell [see the documentation for the class
prismatique.discretization.Paramsfor a discussion on sample supercells]; \(\mathbf{u}_{j}\) is the displacement of the \(j^{\text{th}}\) atom of the sample’s supercell from the expectation value of its position at zero-temperature; \(p_{a}\left(\mathbf{u}_{1},\ldots,\mathbf{u}_{N}\right)\) is the distribution of the sample’s supercell atomic configuration \(\left\{ \mathbf{u}_{j}\right\} _{j=1}^{N}\); and(2.9.1.6)\[\begin{split}&\hat{\rho}_{t}\left(\delta_{f};\mathbf{u}_{1},\ldots,\mathbf{u}_{N}; \boldsymbol{\delta}_{\beta}\right)\\ &\quad=\left|\psi_{t}\left(\delta_{f}; \mathbf{u}_{1},\ldots,\mathbf{u}_{N}; \boldsymbol{\delta}_{\beta}\right)\right\rangle \left\langle \psi_{t}\left(\delta_{f};\mathbf{u}_{1},\ldots,\mathbf{u}_{N}; \boldsymbol{\delta}_{\beta}\right)\right|,\end{split}\]with \(\left|\psi_{t}\left(\delta_{f};\mathbf{u}_{1},\ldots,\mathbf{u}_{N}; \boldsymbol{\delta}_{\beta}\right)\right\rangle\) being the state vector of a transmitted beam electron for a perfectly coherent beam operating at a defocus of \(\Delta f+\delta_{f}\) and a beam tilt of \(\mathbf{k}_{xy,\beta}+\boldsymbol{\delta}_{\beta}\), and a sample with a frozen supercell atomic configuration \(\left\{ \mathbf{u}_{j}\right\} _{j=1}^{N}\). The defocal spread \(\sigma_{f}\) is calculated by:
(2.9.1.7)\[\sigma_{f}=C_{c}\sqrt{\left(\frac{\sigma_{E}/e}{V}\right)^{2} +\left(2\frac{\sigma_{I}}{I}\right)^{2} +\left(\frac{\sigma_{V}}{V}\right)^{2}},\]where \(C_c\) is the chromatic aberration coefficient; \(I\) is the mean current of the lens [the probe forming lens in STEM simulations and the objective lens in HRTEM simulations]; \(\sigma_I\) is the standard deviation of the current of the lens; \(V\) is the mean accelerating voltage; \(e\) is the elementary charge; \(\sigma_V\) is the standard deviation of the accelerating voltage; and \(\sigma_E\) is the standard deviation of the electrons in the gun when operating a voltage supply that does not fluctuate [i.e. \(\sigma_E\) is the intrinsic energy spread of the gun]. As mentioned above, we do not explicitly consider finite source size effects for STEM simulations in
prismatique, hence for such scenarios we can set(2.9.1.8)\[\sigma_{\beta}\to0,\quad\left(\text{for STEM}\right).\]In
prismatic, \(p_{a}\left( \mathbf{u}_{1},\ldots,\mathbf{u}_{N}\right)\) is approximated using a simple Einstein model [Loane1]:(2.9.1.9)\[p_{a}\left(\mathbf{u}_{1},\ldots,\mathbf{u}_{N}\right)=\prod_{i=1}^{N} \left\{ p_{a}\left(\left|\mathbf{u}_{i}\right|\right)\right\},\](2.9.1.10)\[p_{a}\left(\mathbf{u}_{i}\right)= \left(\frac{3}{2\pi u_{i,\text{rms}}^{2}}\right)^{3/2} e^{-\frac{3}{2}\left( \frac{\mathbf{u}_{i}}{u_{i,\text{rms}}}\right)^{2}},\](2.9.1.11)\[u_{i,\text{rms}}=\sqrt{\left\langle \mathbf{u}_{i}^{2}\right\rangle } = \frac{A\left(T\right)}{m_i^{\frac{1}{2}}},\]where \(A\left(T\right)\) is some function of the temperature \(T\) which would need to be determined experimentally, and \(m_i\) is the mass of the \(i^{\text{th}}\) atom. The incoherent average over the phonon configurations in Eq. (2.9.1.3) is approximated by sampling a random set of frozen phonon configurations from the distribution \(p_{a}\left(\mathbf{u}_{1},\ldots,\mathbf{u}_{N}\right)\). The larger the sampling size of frozen phonon configurations, the more accurate the estimate. For a discussion on the convergence of this sampling approach, see Ref. [DaCosta1], in particular Sec. 4.4. Note that throughout the documentation of the
prismatiquelibrary, we refer to \(u_{i,\text{rms}}\) as the effective root-mean-squared displacement of the \(i^{\text{th}}\) atom.- Parameters:
- enable_thermal_effectsbool, optional
If
enable_thermal_effectsis set toTrue, then for each atom in the sample supercell, \(u_{i,\text{rms}}\) is set according to the specifications given in the “atomic coordinates file”, which among other things specifies the zero-temperature expectation value of the atomic coordinates for each atom in the unit cell of the sample. Ifenable_thermal_effectsis set toFalse, then for each atom, \(u_{i,\text{rms}}\) is set to zero. See the documentation for the classprismatique.sample.ModelParams, in particular the documentation for the construction parameteratomic_coords_filenamefor a description of the file format of the atomic coordinates file.- num_frozen_phonon_configs_per_subsetint, optional
Sometimes one might be implementing a simulation that requires significant computational resources, namely RAM. In such cases, rather than call a single session of
prismaticto calculate \(p_{\text{STEM}}\left(k_{x},k_{y}\left|\mathbf{u}_{1},\ldots, \mathbf{u}_{N}\right.\right)\) for all sampled frozen phonon configurations, it is advantageous to partition the set of sampled frozen phonon configurations into disjoint subsets and subsequently call multiple sessions ofprismaticsequentially, wherein for each session \(p_{\text{STEM}}\left(k_{x},k_{y}\left|\mathbf{u}_{1},\ldots, \mathbf{u}_{N}\right.\right)\) is calculated for a different subset of the sampled frozen phonon configurations. This way, one need only store the potential slice data or the S-matrix data [depending on the algorithm used] for a single subset of frozen phonon configurations at a time, thus reducing memory requirements. See the documentation for the classprismatique.sample.ModelParamsfor a discussion on potential slices, and the subpackageprismatique.stemfor a discussion on S-matrices.num_frozen_phonon_configs_per_subsetis the number of frozen phonon configurations to sample per subset.- num_subsetsint, optional
Continuing from above,
num_subsetsis the number of subsets of frozen phonon configurations. The total number of frozen phonon configurations to sample isnum_frozen_phonon_configs_per_subset*num_subsets.- rng_seedint | None, optional
A seed to pass to the random number generator used to sample the frozen phonon configurations. If set,
rng_seedmust be a non-negative integer or None.- skip_validation_and_conversionbool, optional
Let
validation_and_conversion_funcsandcore_attrsdenote the attributesvalidation_and_conversion_funcsandcore_attrsrespectively, both of which being dict objects.Let
params_to_be_mapped_to_core_attrsdenote the dict representation of the constructor parameters excluding the parameterskip_validation_and_conversion, where each dict keykeyis a different constructor parameter name, excluding the name"skip_validation_and_conversion", andparams_to_be_mapped_to_core_attrs[key]would yield the value of the constructor parameter with the name given bykey.If
skip_validation_and_conversionis set toFalse, then for each keykeyinparams_to_be_mapped_to_core_attrs,core_attrs[key]is set tovalidation_and_conversion_funcs[key] (params_to_be_mapped_to_core_attrs).Otherwise, if
skip_validation_and_conversionis set toTrue, thencore_attrsis set toparams_to_be_mapped_to_core_attrs.copy(). This option is desired primarily when the user wants to avoid potentially expensive deep copies and/or conversions of the dict values ofparams_to_be_mapped_to_core_attrs, as it is guaranteed that no copies or conversions are made in this case.
- Attributes:
core_attrsdict: The “core attributes”.
de_pre_serialization_funcsdict: The de-pre-serialization functions.
pre_serialization_funcsdict: The pre-serialization functions.
validation_and_conversion_funcsdict: The validation and conversion functions.
Methods
de_pre_serialize([serializable_rep, ...])Construct an instance from a serializable representation.
dump([filename, overwrite])Serialize instance and save the result in a JSON file.
dumps()Serialize instance.
get_core_attrs([deep_copy])Return the core attributes.
Return the de-pre-serialization functions.
Return the pre-serialization functions.
Return the validation and conversion functions.
load([filename, skip_validation_and_conversion])Construct an instance from a serialized representation that is stored in a JSON file.
loads([serialized_rep, ...])Construct an instance from a serialized representation.
Pre-serialize instance.
update([new_core_attr_subset_candidate, ...])Update a subset of the core attributes.
Methods
Construct an instance from a serializable representation.
Serialize instance and save the result in a JSON file.
Serialize instance.
Return the core attributes.
Return the de-pre-serialization functions.
Return the pre-serialization functions.
Return the validation and conversion functions.
Construct an instance from a serialized representation that is stored in a JSON file.
Construct an instance from a serialized representation.
Pre-serialize instance.
Update a subset of the core attributes.
Attributes
dict: The "core attributes".
dict: The de-pre-serialization functions.
dict: The pre-serialization functions.
dict: The validation and conversion functions.
- property core_attrs
dict: The “core attributes”.
The keys of
core_attrsare the same as the attributevalidation_and_conversion_funcs, which is also a dict object.Note that
core_attrsshould be considered read-only.
- property de_pre_serialization_funcs
dict: The de-pre-serialization functions.
de_pre_serialization_funcshas the same keys as the attributevalidation_and_conversion_funcs, which is also a dict object.Let
validation_and_conversion_funcsandpre_serialization_funcsdenote the attributesvalidation_and_conversion_funcspre_serialization_funcsrespectively, the last of which being a dict object as well.Let
core_attrs_candidate_1be any dict object that has the same keys asvalidation_and_conversion_funcs, where for each dict keykeyincore_attrs_candidate_1,validation_and_conversion_funcs[key](core_attrs_candidate_1)does not raise an exception.Let
serializable_repbe a dict object that has the same keys ascore_attrs_candidate_1, where for each dict keykeyincore_attrs_candidate_1,serializable_rep[key]is set topre_serialization_funcs[key](core_attrs_candidate_1[key]).The items of
de_pre_serialization_funcsare expected to be set to callable objects that would lead tode_pre_serialization_funcs[key](serializable_rep[key])not raising an exception for each dict keykeyinserializable_rep.Let
core_attrs_candidate_2be a dict object that has the same keys asserializable_rep, where for each dict keykeyinvalidation_and_conversion_funcs,core_attrs_candidate_2[key]is set tode_pre_serialization_funcs[key](serializable_rep[key]).The items of
de_pre_serialization_funcsare also expected to be set to callable objects that would lead tovalidation_and_conversion_funcs[key](core_attrs_candidate_2)not raising an exception for each dict keykeyincore_attrs_candidate_2.Note that
de_pre_serialization_funcsshould be considered read-only.
- classmethod de_pre_serialize(serializable_rep={}, skip_validation_and_conversion=False)
Construct an instance from a serializable representation.
- Parameters:
- serializable_repdict, optional
A dict object that has the same keys as the attribute
validation_and_conversion_funcs, which is also a dict object.Let
validation_and_conversion_funcsandde_pre_serialization_funcsdenote the attributesvalidation_and_conversion_funcsde_pre_serialization_funcsrespectively, the last of which being a dict object as well.The items of
serializable_repare expected to be objects that would lead tode_pre_serialization_funcs[key](serializable_rep[key])not raising an exception for each dict keykeyinserializable_rep.Let
core_attrs_candidatebe a dict object that has the same keys asserializable_rep, where for each dict keykeyinserializable_rep,core_attrs_candidate[key]is set to de_pre_serialization_funcs[key](serializable_rep[key])``.The items of
serializable_repare also expected to be set to objects that would lead tovalidation_and_conversion_funcs[key](core_attrs_candidate)not raising an exception for each dict keykeyinserializable_rep.- skip_validation_and_conversionbool, optional
Let
core_attrsdenote the attributecore_attrs, which is a dict object.If
skip_validation_and_conversionis set toFalse, then for each keykeyinserializable_rep,core_attrs[key]is set tovalidation_and_conversion_funcs[key] (core_attrs_candidate), withvalidation_and_conversion_funcsandcore_attrs_candidate_1being introduced in the above description ofserializable_rep.Otherwise, if
skip_validation_and_conversionis set toTrue, thencore_attrsis set tocore_attrs_candidate.copy(). This option is desired primarily when the user wants to avoid potentially expensive deep copies and/or conversions of the dict values ofcore_attrs_candidate, as it is guaranteed that no copies or conversions are made in this case.
- Returns:
- instance_of_current_clsCurrent class
An instance constructed from the serializable representation
serializable_rep.
- dump(filename='serialized_rep_of_fancytype.json', overwrite=False)
Serialize instance and save the result in a JSON file.
- Parameters:
- filenamestr, optional
The relative or absolute path to the JSON file in which to store the serialized representation of an instance.
- overwritebool, optional
If
overwriteis set toFalseand a file exists at the pathfilename, then the serialized instance is not written to that file and an exception is raised. Otherwise, the serialized instance will be written to that file barring no other issues occur.
- Returns:
- dumps()
Serialize instance.
- Returns:
- serialized_repdict
A serialized representation of an instance.
- get_core_attrs(deep_copy=True)
Return the core attributes.
- Parameters:
- deep_copybool, optional
Let
core_attrsdenote the attributecore_attrs, which is a dict object.If
deep_copyis set toTrue, then a deep copy ofcore_attrsis returned. Otherwise, a shallow copy ofcore_attrsis returned.
- Returns:
- core_attrsdict
The attribute
core_attrs.
- classmethod get_de_pre_serialization_funcs()[source]
Return the de-pre-serialization functions.
- Returns:
- de_pre_serialization_funcsdict
The attribute
de_pre_serialization_funcs.
- classmethod get_pre_serialization_funcs()[source]
Return the pre-serialization functions.
- Returns:
- pre_serialization_funcsdict
The attribute
pre_serialization_funcs.
- classmethod get_validation_and_conversion_funcs()[source]
Return the validation and conversion functions.
- Returns:
- validation_and_conversion_funcsdict
The attribute
validation_and_conversion_funcs.
- classmethod load(filename='serialized_rep_of_fancytype.json', skip_validation_and_conversion=False)
Construct an instance from a serialized representation that is stored in a JSON file.
Users can save serialized representations to JSON files using the method
fancytypes.PreSerializable.dump().- Parameters:
- filenamestr, optional
The relative or absolute path to the JSON file that is storing the serialized representation of an instance.
filenameis expected to be such thatjson.load(open(filename, "r"))does not raise an exception.Let
serializable_rep=json.load(open(filename, "r")).Let
validation_and_conversion_funcsandde_pre_serialization_funcsdenote the attributesvalidation_and_conversion_funcsde_pre_serialization_funcsrespectively, both of which being dict objects as well.filenameis also expected to be such thatde_pre_serialization_funcs[key](serializable_rep[key])does not raise an exception for each dict keykeyinde_pre_serialization_funcs.Let
core_attrs_candidatebe a dict object that has the same keys asde_pre_serialization_funcs, where for each dict keykeyinserializable_rep,core_attrs_candidate[key]is set to de_pre_serialization_funcs[key](serializable_rep[key])``.filenameis also expected to be such thatvalidation_and_conversion_funcs[key](core_attrs_candidate)does not raise an exception for each dict keykeyinserializable_rep.- skip_validation_and_conversionbool, optional
Let
core_attrsdenote the attributecore_attrs, which is a dict object.Let
core_attrs_candidatebe as defined in the above description offilename.If
skip_validation_and_conversionis set toFalse, then for each keykeyincore_attrs_candidate,core_attrs[key]is set tovalidation_and_conversion_funcs[key] (core_attrs_candidate), , withvalidation_and_conversion_funcsandcore_attrs_candidatebeing introduced in the above description offilename.Otherwise, if
skip_validation_and_conversionis set toTrue, thencore_attrsis set tocore_attrs_candidate.copy(). This option is desired primarily when the user wants to avoid potentially expensive deep copies and/or conversions of the dict values ofcore_attrs_candidate, as it is guaranteed that no copies or conversions are made in this case.
- Returns:
- instance_of_current_clsCurrent class
An instance constructed from the serialized representation stored in the JSON file.
- classmethod loads(serialized_rep='{}', skip_validation_and_conversion=False)
Construct an instance from a serialized representation.
Users can generate serialized representations using the method
dumps().- Parameters:
- serialized_repstr | bytes | bytearray, optional
The serialized representation.
serialized_repis expected to be such thatjson.loads(serialized_rep)does not raise an exception.Let
serializable_rep=json.loads(serialized_rep).Let
validation_and_conversion_funcsandde_pre_serialization_funcsdenote the attributesvalidation_and_conversion_funcsde_pre_serialization_funcsrespectively, both of which being dict objects as well.serialized_repis also expected to be such thatde_pre_serialization_funcs[key](serializable_rep[key])does not raise an exception for each dict keykeyinde_pre_serialization_funcs.Let
core_attrs_candidatebe a dict object that has the same keys asserializable_rep, where for each dict keykeyinde_pre_serialization_funcs,core_attrs_candidate[key]is set to de_pre_serialization_funcs[key](serializable_rep[key])``.serialized_repis also expected to be such thatvalidation_and_conversion_funcs[key](core_attrs_candidate)does not raise an exception for each dict keykeyinserializable_rep.- skip_validation_and_conversionbool, optional
Let
core_attrsdenote the attributecore_attrs, which is a dict object.If
skip_validation_and_conversionis set toFalse, then for each keykeyincore_attrs_candidate,core_attrs[key]is set tovalidation_and_conversion_funcs[key] (core_attrs_candidate), withvalidation_and_conversion_funcsandcore_attrs_candidate_1being introduced in the above description ofserialized_rep.Otherwise, if
skip_validation_and_conversionis set toTrue, thencore_attrsis set tocore_attrs_candidate.copy(). This option is desired primarily when the user wants to avoid potentially expensive deep copies and/or conversions of the dict values ofcore_attrs_candidate, as it is guaranteed that no copies or conversions are made in this case.
- Returns:
- instance_of_current_clsCurrent class
An instance constructed from the serialized representation.
- property pre_serialization_funcs
dict: The pre-serialization functions.
pre_serialization_funcshas the same keys as the attributevalidation_and_conversion_funcs, which is also a dict object.Let
validation_and_conversion_funcsandcore_attrsdenote the attributesvalidation_and_conversion_funcsandcore_attrsrespectively, the last of which being a dict object as well.For each dict key
keyincore_attrs,pre_serialization_funcs[key](core_attrs[key])is expected to yield a serializable object, i.e. it should yield an object that can be passed into the functionjson.dumpswithout raising an exception.Note that
pre_serialization_funcsshould be considered read-only.
- pre_serialize()
Pre-serialize instance.
- Returns:
- serializable_repdict
A serializable representation of an instance.
- update(new_core_attr_subset_candidate={}, skip_validation_and_conversion=False)
Update a subset of the core attributes.
- Parameters:
- new_core_attr_subset_candidatedict, optional
A dict object.
- skip_validation_and_conversionbool, optional
Let
validation_and_conversion_funcsandcore_attrsdenote the attributesvalidation_and_conversion_funcsandcore_attrsrespectively, both of which being dict objects.If
skip_validation_and_conversionis set toFalse, then for each keykeyincore_attrsthat is also innew_core_attr_subset_candidate,core_attrs[key]is set tovalidation_and_conversion_funcs[key] (new_core_attr_subset_candidate).Otherwise, if
skip_validation_and_conversionis set toTrue, then for each keykeyincore_attrsthat is also innew_core_attr_subset_candidate,core_attrs[key]is set tonew_core_attr_subset_candidate[key]. This option is desired primarily when the user wants to avoid potentially expensive deep copies and/or conversions of the dict values ofnew_core_attr_subset_candidate, as it is guaranteed that no copies or conversions are made in this case.
- property validation_and_conversion_funcs
dict: The validation and conversion functions.
The keys of
validation_and_conversion_funcsare the names of the constructor parameters, excludingskip_validation_and_conversionif it exists as a construction parameter.Let
core_attrsdenote the attributecore_attrs, which is also a dict object.For each dict key
keyincore_attrs,validation_and_conversion_funcs[key](core_attrs)is expected to not raise an exception.Note that
validation_and_conversion_funcsshould be considered read-only.