Simulation

class sorts.simulation.Simulation(scheduler, root, logger=True, profiler=True, **kwargs)[source]

Bases: object

Convenience simulation handler, creates a step-by-step simulation sequence and creates file system structure for saving of data to disk.

Parameters
  • scheduler (Scheduler) – A scheduler instance to run. This input is used to assure that the same logger and profiler is used for the Simulation and the Scheduler.

  • root (str/pathlib.Path) – The path to the root folder where all files will be stored.

  • logger (bool) – If False, do not instantiate a logger.

  • profiler (bool) – If False, do not instantiate a profiler.

Methods

__init__(scheduler, root[, logger, profiler])

Initialize self.

branch(name[, empty, linkfiles])

Create branch by creating a copy of the current branch state and checkout that branch.

checkout(branch)

Change to branch.

delete(branch)

Delete branch.

get_path([name])

Given a relative file path, get the absolute path including root and branch.

load_h5(path)

load_pickle(path)

make_paths()

Make all the folder for the current branch according to self.paths.

run(*args, **kwargs)

save_h5(path, data)

save_pickle(path, data)

Attributes

log_path

Path to the current log-output folder

paths

List of the name of all folders