Output

The settings described on this page regulate the name and very specific content of the output file generated by DREAM.

File name

At the end of a simulation, DREAM will save data from the simulation to an output file. By default, this file is named output.h5 and is created right before DREAM exits. The user can specify a custom name for the output file by calling the setFilename() method on the Output object of the DREAMSettings object:

ds = DREAMSettings()
...
ds.output.setFilename("custom-output-filename.h5")

Timing information

DREAM automatically monitors the execution time of certain critical parts of the simulation. Information about the execution time can be output to stdout at the end of a successfull simulation, and can also be stored in the final output file.

Measurement of execution time is regulated by the setTiming() method which takes two booleans as arguments: stdout, whether details about execution time should be printed to stdout at the end of the simulation, and file, whether the details should be stored in the final output file generated.

ds = DREAMSettings()
...
# Print timing info to stdout AND store in output file
ds.output.setTiming(stdout=True, file=True)

By default, no timing information is created.

Tip

Simulation output will generally be stored even if DREAM crashes. The named output file will then be created (or overwritten if it already exists) and contain data from all time steps that finished successfully. The data file can be loaded as usual with the DREAM Python output interface.

Class documentation

class DREAM.Settings.Output.Output(filename='output.h5')

Bases: object

__init__(filename='output.h5')

Constructor.

fromdict(data)

Load settings from the given dictionary.

Parameters

data (dict) – Dictionary to load settings from.

setFilename(filename)

Set the name of the output file.

Parameters

filename (str) – Name of output file to store simulation data to.

setSaveSettings(save=True)

Specify whether or not to save a copy of the input settings to the output file (enabled by default).

Parameters

save (bool) – If True, copy settings to the output file.

setTiming(stdout=None, file=None)

Specifies whether to print timing information and/or include it in the output file.

Parameters
  • stdout (bool) – If True, prints details about execution time to stdout at the end of the simulation.

  • file (bool) – If True, stores details about execution time in the output file after the simulation.

todict(verify=True)

Returns a Python dictionary containing all settings of this Output object.

Parameters

verify (bool) – If True, verifies the settings of this object before generating the dictionary.

verifySettings()

Verify that the Output settings are consistent.