yasfpy.export#
Export container models.
This module defines lightweight Pydantic models used to serialize simulation inputs/outputs (particles, wavelengths, angular phase functions) to common file formats.
Notes
The models are intentionally permissive (arbitrary_types_allowed=True) and
are primarily used as an interchange format rather than as strict validation of
scientific inputs.
Classes#
Particle geometry and material inputs for export. |
|
Wavelength-dependent scalar outputs for export. |
|
Angle-resolved outputs for export. |
|
Spatially resolved outputs for export. |
|
Serializable export record. |
Module Contents#
- class yasfpy.export.Particles#
Particle geometry and material inputs for export.
- Variables:
position – Particle center positions
(N, 3).radii – Particle radii (length
N).refractive_index – Per-particle complex refractive index. For multi-wavelength simulations, each particle may store a list of values.
radius_of_gyration – Radius of gyration of the particle ensemble.
metadata – Optional free-form metadata.
- class yasfpy.export.Wavelength#
Wavelength-dependent scalar outputs for export.
- class yasfpy.export.Angle#
Angle-resolved outputs for export.
- class yasfpy.export.Spatial#
Spatially resolved outputs for export.
- class yasfpy.export.Export(/, **data)#
Bases:
pydantic.BaseModelSerializable export record.
This is a convenience wrapper that collects all exportable sections.
Notes
The section fields accept either validated dataclass instances or raw Python mappings;
model_post_init()coerces mappings to the corresponding model.- wavelength: Wavelength | dict[str, Any] = None#
- model_config: pydantic.ConfigDict#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(__context)#
Coerce mapping sections to their dataclass models.
- save(filename)#
Write the export record to disk.
- Parameters:
filename – Output file path. The extension determines the serialization format (
.json,.yml/.yaml,.pkl,.bz2,.mat).