ConfigMap#
- class lumopt2.utils.config_map.ConfigMap(sim_results: list, project_name: str = None)#
Organises simulation results into per-configuration groups and manages filenames.
Accepts a list of simulation result objects and groups them by their associated
Configinstance (currently alwaysNoneuntil multi-config support is added). For each group it generates:a forward simulation filename (
fwd_<config>.fsp)per-result adjoint simulation filenames (
adj_<config>_<monitor>.fsp)
It also determines the project folder name — either from an explicit
project_nameargument or by auto-generating a timestamped name — and exposes helpers to retrieve results, filenames, and FOM values in the exact positional order expected by the user-definedfctinFom.- Parameters:
- sim_results
list Simulation result objects to organise. Each must expose a
configattribute (Nonefor the default single-config workflow) and amonitor_nameattribute used to build adjoint filenames.- project_name
str,optional Name to use for the project folder. If
None, a name of the formlumopt2_project_YYYYMMDD_HHMMSSis generated automatically.
- sim_results
- Attributes:
- config_map
dict Dictionary keyed by
Configinstance (orNonefor the default config). Each value is a dict with:'config': theConfiginstance for this group.'sources':Noneplaceholder, populated later when the FDTD session is available.'fwd_filename': forward simulation filename string.'adjoints': list of dicts, each with'sim_result'and'adj_filename'for one result in this group.
- sim_results_ordered
list Simulation results in the exact order supplied to the constructor. This order must match the positional arguments of the user-defined
fctinFom(e.g.custom_fct(int_red, int_green, ...)).- project_folder
str Path/name of the project folder where simulation files are written.
- config_map
Methods
Return filenames for each simulation result in the order matching the custom_fct arguments.
Return simulation results in the original order matching the custom_fct arguments.
Return the
.valuesof each simulation result in the order matching the custom_fct arguments.ConfigMap.set_filename_iteration(iteration)Update all forward and adjoint filenames to include an iteration suffix.