Use MSection.m_setdefault method to automatically compose the sub-section using the definition. This is helpful when these schemas are used as a parent for a more specialized section. The automatic composition will pick whatever sub-section is defined in the specialized data model.
For example, let's assume we define SpecializedELNUVVisNIRTransmission using ELNUVVisNIRTransmission as an inheriting section, and compose another specialized results sections in it.
class SpecializedUVVisNirTransmissionResult(UVVisNirTransmissionResult):
# some special code
class SpecializedELNUVVisNIRTransmission(ELNUVVisNIRTransmission):
results = SubSection(section_def=SpecializedUVVisNirTransmissionResult, repeats=True)
Because of the automatic composition based on m_setdefault, when SpecializedELNUVVisNIRTransmission.normalize() runs, it will pick the SpecializedUVVisNirTransmissionResult to compose the results. It removes the need to redefine the composition in the normalization of the specialized section. One can efficiently reuse the normalize method of the parent to work with the new composition.
Use
MSection.m_setdefault
method to automatically compose the sub-section using the definition. This is helpful when these schemas are used as a parent for a more specialized section. The automatic composition will pick whatever sub-section is defined in the specialized data model.For example, let's assume we define
SpecializedELNUVVisNIRTransmission
usingELNUVVisNIRTransmission
as an inheriting section, and compose another specialized results sections in it.Because of the automatic composition based on
m_setdefault
, whenSpecializedELNUVVisNIRTransmission.normalize()
runs, it will pick theSpecializedUVVisNirTransmissionResult
to compose the results. It removes the need to redefine the composition in the normalization of the specialized section. One can efficiently reuse thenormalize
method of the parent to work with the new composition.