param_sweep#

simpleEMS.sim_tools.param_sweep(simulate_fn: Callable, sweep_vals: dict[str, tuple], output_path: Path, sweep: bool = True) → list[SimData]#

Run a simulation function over a Cartesian product of parameter values and plot S11 for each combination.

Supports sweeping multiple parameters at once; the total number of simulations run is the Cartesian product of each parameter’s num_points, which can get expensive quickly with more than one or two swept parameters.

Parameters:
  • simulate_fn (callable) – Simulation function invoked for each sweep combination as simulate_fn(sweep_path, sweep, values), where sweep_path is a per-combination output directory, sweep is the sweep argument passed through unchanged, and values is the tuple of parameter values for that combination (in sweep_vals key order). Must return a SimData (or compatible object with freqs/s11 attributes).

  • sweep_vals (dict[str, tuple]) – Dictionary defining the parameter sweep ranges. Keys are parameter names (for labeling only); values are (start, stop, num_points) tuples passed to numpy.linspace.

  • output_path (Path) – Directory under which a ``sweep/<param>_<value>_…” `` subfolder is created for each combination.

  • sweep (bool, optional) – Passed through unchanged as the second positional argument to simulate_fn on every call. Default is True.

Returns:

The simulation data from every parameter combination in the sweep, in the same order as the Cartesian product of sweep_vals. Empty if sweep_vals has no combinations to run.

Return type:

list[SimData]