pencil.read.averages

Contains the classes and methods to read average files.

Classes

Averages

Averages -- holds Pencil Code averages data and methods.

Functions

aver(*args, **kwargs)

Wrapper for Averages.read()

Module Contents

class pencil.read.averages.Averages

Bases: object

Averages – holds Pencil Code averages data and methods.

Fill members with default values.

property t
property keys
read(datadir='data', simdir='.', plane_list=None, avfile_list=None, infile_list=None, var_index=-1, var_names=None, iter_list=None, niter=9999, iter_step=1, time_range=None, param=None, proc=-1, precision='f', comp_time=False, quiet=True, sim=None)

read(plane_list=None, datadir=’data’, proc=-1, var_index=-1, proc=-1):

Read Pencil Code average data.

Parameters:
  • datadir (string) – Directory where the data is stored. By default, “data”

  • simdir (string) – Simulation directory containing the .in files. By default, current directory.

  • plane_list (list of string) – A list of the 2d/1d planes over which the averages were taken. Takes ‘xy’, ‘xz’, ‘yz’, ‘y’, ‘z’. By default, it is [p for p in [“xy”, “xz”, “yz”] if corresponding_dot_in_file_exists_in_simdir].

  • avfile_list (list of string) – File names if alternative to standard files used.

  • infile_list (list of string) – File names if alternative to standard files used.

  • var_names (string or list of strings matching format in *aver.in for given plane) – Variable names from among h5 averages.

  • var_index (int) – Index of variable from among within the ‘y’ or ‘z’ averages. Takes an integer value < len(yaver.in or zaver.in).

  • time_range (float or list of two floats.) – Single float indicates end time of sample taking 0 to be the start time. Two floats indicates start and end time to sample.

  • iter_list (list of int, or index range) – Iteration indices for which to sample the slices. Single value only that index is sampled. Two indices indicate first and last index (last value excluded). More than two indicies specifies the precise list of indices to be sampled. Note that the indices specified here start from 0.

  • niter (int) – if iter_list is not used for fortran format a default index list will be used of size niter.

  • iter_step (when sampling iterations number of steps, when iter_list length is two.)

  • param (Param object) – Param object belonging to the simulation.

  • proc (int) – Processor to be read. If -1 read all and assemble to one array. Only affects the reading of ‘yaverages.dat’ and ‘zaverages.dat’.

  • precision (string) – Float (f), double (d) or half (half).

  • quiet (bool) – Whether to suppress diagnostic output. Default: True

  • sim (Simulation obejct.) – If specified, get simdir and datadir from this.

Return type:

Class containing the averages.

Examples

>>> aver = pc.read.aver()
>>> aver.lnrho.shape
(134, 134, 134)

Notes

The axis ordering of the 2D averages (yaver and zaver) is [t,x,z] or [t,x,y]

pencil.read.averages.aver(*args, **kwargs)

Wrapper for Averages.read()