pyoomph.utils.paramscan module
- class pyoomph.utils.paramscan.ParallelParameterScan(script_to_call, output_dir=None, max_procs=2, single_threaded_childs=True, interpreter='/home/docs/checkouts/readthedocs.org/user_builds/pyoomph/envs/latest/bin/python')[source]
Bases:
objectA class for performing parallel parameter scans.
- Parameters:
script_to_call (str) – The script to call for each parameter simulation.
output_dir (Optional[str]) – The output directory for the parameter simulations. If not provided, a default directory will be created based on the script’s name.
max_procs (Optional[int]) – The maximum number of processes to use for parallel execution. Defaults to the number of CPUs in the system.
single_threaded_childs (bool) – Whether to run each child process in single-threaded mode. Defaults to True.
interpreter (str) – The path to the Python interpreter to use. Defaults to the system’s default interpreter.
- new_sim(subdir=None, additional_args=[])[source]
Create a new simulation. You can set the parameters of the simulation by setting attributes of the returned instance.
- Parameters:
subdir (str, optional) – The subdirectory where the simulation will be saved. Defaults to None, will be determined automatically based on the parameters.
additional_args (List[str], optional) – Additional arguments to be passed to the simulation. Defaults to an empty list.
- Returns:
The newly created simulation instance.
- Return type:
- class pyoomph.utils.paramscan.SimulationNamespace[source]
Bases:
objectA class representing a namespace for simulation parameters for the parallel parameter scan. If your problem has e.g. an nested property like problem.droplet.contact_angle, you must create a SimulationNamespace object for the SingleParallelParameterSimulation object, i.e.
sim.droplet=SimulationNamespace() sim.droplet.contact_angle=…
Otherwise, nested properties cannot be set.
- class pyoomph.utils.paramscan.SingleParallelParameterSimulation(subdir, additional_args)[source]
Bases:
objectStorage class for the used parameters of a single simulation in a parallel parameter scan. Instances are generated by
sim=ParallelParameterScan.new_sim(...)
Once generated, the parameters can be set as attributes of the instance sim, e.g.
sim.paramA=...
For nested parameters, use the SimulationNamespace class, e.g.
sim.droplet=SimulationNamespace() sim.droplet.contact_angle=...