The ScalarQuantity class encapsulates data from scalar quantities in DREAM output, i.e. data which only has a single, scalar value at a given time. Scalar quantities only evolve in time. Examples of scalar quantities found in DREAM are the total plasma current I_p and the poloidal flux on the tokamak wall psi_edge.


s1 = ScalarQuantity(name='MyScalarQuantity', data=[1,2,3], grid=grid, output=do)
s2 = ScalarQuantity(name='MyScalarQuantity', data=[4,5,6], grid=grid, output=do)

As with any UnknownQuantity, a ScalarQuantity can be part of an arithmetic expression with another ScalarQuantity:

s3 = s1 + s2
s4 = s1 - s2
s5 = s1 * s2
s6 = s1 / s2

Operations are element-wise.

It is also possible to easily plot a ScalarQuantity by calling the plot() member method:


If desired, a selection of time points for which to plot the quantity can be specified to plot():


Class definition

class DREAM.Output.ScalarQuantity.ScalarQuantity(name, data, grid, output, attr=[])

Bases: DREAM.Output.UnknownQuantity.UnknownQuantity


Direct access to data.

__init__(name, data, grid, output, attr=[])


  • name (str) – Name of quantity.

  • data (numpy.ndarray) – Data for quanity.

  • attr (list) – List of attributes for quantity.

  • grid – Grid on which the quantity is defined.

  • output (DREAMOutput) – Parent output object.


Dumps the data of this quantity as a string.


t – Selection of time points to dump.


Get the number of “multiples” (e.g. number of ion species and charge states) covered by this quantity. The total number of elements in ‘’ is the size of the grid on which this quantity lives (i.e. scalar grid, fluid grid, or a kinetic grid) times this number.

plot(ax=None, show=None, t=None, t_shift=0, **kwargs)

Generate a plot of the time evolution of this quantity.

  • ax (matplotlib.axes.Axes) – Axes object to create the plot on.

  • show (bool) – If True, calls after creating the plot.

  • t – Selection of time points to plot. Can be a list, numpy array, slice or None.


Print the data in this quantity at the given time.


t – Time, or selection of times, from which to print the data.