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), wheresweep_pathis a per-combination output directory,sweepis thesweepargument passed through unchanged, andvaluesis the tuple of parameter values for that combination (insweep_valskey order). Must return aSimData(or compatible object withfreqs/s11attributes).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 tonumpy.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_fnon every call. Default isTrue.
- Returns:
The simulation data from every parameter combination in the sweep, in the same order as the Cartesian product of
sweep_vals. Empty ifsweep_valshas no combinations to run.- Return type:
list[SimData]