yasfpy.yasf =========== .. py:module:: yasfpy.yasf .. autoapi-nested-parse:: High-level YASF front door. The :class:`~yasfpy.yasf.YASF` class is a convenience wrapper that wires together configuration parsing, particle geometry, solver/numerics settings, the core simulation, and optics post-processing. .. rubric:: 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 ------- .. autoapisummary:: yasfpy.yasf.YASF Module Contents --------------- .. py:class:: YASF(path_config, preprocess = True, path_cluster = '', *, cluster_scale = None, cluster_dimensional_scale = None, quiet = False) Run a YASF simulation from a configuration file. :param path_config: Path to the YAML/JSON configuration file. :param preprocess: If `True`, performs preprocessing steps during configuration loading (e.g., refractive-index interpolation). :param path_cluster: Optional path to the particle cluster/geometry file. If empty, the path is taken from the configuration. :param quiet: If `True`, reduces logging verbosity. .. rubric:: Notes This class constructs the core objects (:class:`~yasfpy.simulation.Simulation`, :class:`~yasfpy.optics.Optics`, etc.) eagerly in ``__init__``. .. py:attribute:: path_config :type: str .. py:attribute:: path_cluster :type: str .. py:attribute:: preprocess :type: bool .. py:attribute:: quiet :value: False .. py:attribute:: particles .. py:attribute:: initial_field .. py:attribute:: parameters .. py:attribute:: solver .. py:attribute:: numerics .. py:attribute:: simulation .. py:attribute:: optics .. py:property:: config :type: yasfpy.config.Config Loaded :class:`~yasfpy.config.Config` instance (cached). .. py:method:: run(points = None) Execute the simulation and (optionally) compute derived optics. :param points: Optional Cartesian coordinates ``(M, 3)`` at which the total/scattered fields are evaluated. This is a legacy path and may be removed. .. py:method:: export() :abstractmethod: Export results to a serializable record. .. rubric:: Notes Not implemented yet. Intended to use :class:`yasfpy.export.Export`. .. py:method:: benchmark(config_path = None, runner = None) :staticmethod: Benchmark initialization and run time with :mod:`pyperf`. .. py:method:: profiler(config_path = None, *, cluster_path = '', output = None, sort = 'cumtime', limit = 50, warmup = 1, include_init = False, quiet = True) :staticmethod: Profile a run with :mod:`cProfile`. :param config_path: Path to the configuration file. :param cluster_path: Optional override for the cluster/geometry path. :param output: If given, dumps stats to this file (``pstats`` format). If omitted, prints stats to stdout. :param sort: Sorting key for ``pstats`` (default ``"cumtime"``). :param limit: Limit number of printed lines. :param warmup: Number of warm-up runs before profiling. :param include_init: If `True`, include object construction in the profile. :param quiet: If `True`, reduce logging verbosity. :returns: The profiled simulation instance. :rtype: YASF