pencil.sim.simulations
Contains the simulations class which can be used to store and perform actions on multiple simulations at once.
Classes
A container for multiple Simulation objects. |
Functions
|
Wrapper for |
Module Contents
- class pencil.sim.simulations.Simulations(*args, **kwargs)
A container for multiple Simulation objects.
- Ways to use the constructor:
- no args: create empty object, simulation objects can be added
with add()
- list, tuple: provide a list of simulation objects or paths or names
if one of the latter is provide, pc.get_sim() is used to generate simulation object from path or name
Any keyword arguments are used to populate attributes the resulting object. E.g. sims = Simulations(path1, path2, my_property=”something”) will result in sims.my_property == “something”.
- Properties:
self.sims: direct access on simulations list
- self.add()
add a simulation object, provide simulation object or name or path (pc.get_sim() is then used)
- self.sort sort self.sims list by, default by name, but also
different sorting algorithm are provided
- sims = []
- add(*args)
Add simulation(s) to simulations object.
- Valid arguments can be any of the following:
path to a simulation (pathlib.Path or str)
simulation object
list of simulation objects
iterable of simulation objects
simulations object
- filter(function)
Return a copy of self that contains only those simulations for which function(sim) is True.
E.g. >>> sims_magnetic = sims.filter(lambda sim: sim.param[‘lmagnetic’]) >>> sims_hydro = sims.filter(lambda sim: not sim.param[‘lmagnetic’])
- sort(key=None)
Default: sort by name
- sim_from_simdir(simdir)
- pencil.sim.simulations.simulations(*args, **kwargs)
Wrapper for
Simulations