pencil.sim.simulations ====================== .. py:module:: pencil.sim.simulations .. autoapi-nested-parse:: Contains the simulations class which can be used to store and perform actions on multiple simulations at once. Classes ------- .. autoapisummary:: pencil.sim.simulations.Simulations Functions --------- .. autoapisummary:: pencil.sim.simulations.simulations Module Contents --------------- .. py:class:: 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 .. method:: self.add add a simulation object, provide simulation object or name or path (pc.get_sim() is then used) .. method:: self.sort sort self.sims list by, default by name, but also different sorting algorithm are provided .. py:attribute:: sims :value: [] .. py:method:: 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 .. py:method:: 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']) .. py:method:: sort(key=None) Default: sort by name .. py:method:: sim_from_simdir(simdir) .. py:function:: simulations(*args, **kwargs) Wrapper for :py:class:`Simulations`