yasfpy.yasf#
High-level YASF front door.
The YASF class is a convenience wrapper that wires together
configuration parsing, particle geometry, solver/numerics settings, the core
simulation, and optics post-processing.
Notes
This module currently provides a lightweight imperative API (not a Pydantic model). The public surface is intended to stay stable even if underlying components evolve.
Classes#
Run a YASF simulation from a configuration file. |
Module Contents#
- class yasfpy.yasf.YASF(path_config, preprocess=True, path_cluster='', *, cluster_scale=None, cluster_dimensional_scale=None, quiet=False)#
Run a YASF simulation from a configuration file.
- Parameters:
path_config – Path to the YAML/JSON configuration file.
preprocess – If True, performs preprocessing steps during configuration loading (e.g., refractive-index interpolation).
path_cluster – Optional path to the particle cluster/geometry file. If empty, the path is taken from the configuration.
quiet – If True, reduces logging verbosity.
Notes
This class constructs the core objects (
Simulation,Optics, etc.) eagerly in__init__.- quiet = False#
- particles#
- initial_field#
- parameters#
- solver#
- numerics#
- simulation#
- optics#
- property config: yasfpy.config.Config#
Loaded
Configinstance (cached).
- run(points=None)#
Execute the simulation and (optionally) compute derived optics.
- Parameters:
points – Optional Cartesian coordinates
(M, 3)at which the total/scattered fields are evaluated. This is a legacy path and may be removed.
- abstractmethod export()#
Export results to a serializable record.
Notes
Not implemented yet. Intended to use
yasfpy.export.Export.
- static benchmark(config_path=None, runner=None)#
Benchmark initialization and run time with
pyperf.
- static profiler(config_path=None, *, cluster_path='', output=None, sort='cumtime', limit=50, warmup=1, include_init=False, quiet=True)#
Profile a run with
cProfile.- Parameters:
config_path – Path to the configuration file.
cluster_path – Optional override for the cluster/geometry path.
output – If given, dumps stats to this file (
pstatsformat). If omitted, prints stats to stdout.sort – Sorting key for
pstats(default"cumtime").limit – Limit number of printed lines.
warmup – Number of warm-up runs before profiling.
include_init – If True, include object construction in the profile.
quiet – If True, reduce logging verbosity.
- Returns:
The profiled simulation instance.
- Return type: