PyFoam.RunDictionary.SampleDirectory module

Working with a directory of samples

class PyFoam.RunDictionary.SampleDirectory.SampleData(fName, name, line, index, coord, data, note='', scale=(1, 1), offset=(0, 0))[source]

Bases: object

Data from a sample-set

component(component=None)[source]

Return the data as a number of single scalars. :param component: If None for vectors the absolute value is taken. else the number of the component

domain()[source]

Range of the data domain

isVector()[source]

Is this vector or scalar data?

line()[source]

Get the line of the sample

range(component=None)[source]

Range of the data

time()[source]

Get the time of the sample (as a string)

class PyFoam.RunDictionary.SampleDirectory.SampleDirectory(case, dirName='samples', postfixes=[], prefixes=[], valueNames=None, linePattern=None, namesFromFirstLine=False, needsExtension=True)[source]

Bases: object

A directory of sampled times

getData(line=None, value=None, time=None, note='', scale=(1, 1), offset=(0, 0))[source]

Get Sample sets :param line: name of the line. All if unspecified :param value: name of the sampled value. All if unspecified :param time: times for which the samples are to be got. All if unspecified :param note: A short annotation (for plots) :param scale: pair of factors with which the data is scaled when being plotted :param offset: pair of offsets

lines()[source]

Returns all the found sample lines

values()[source]

Returns all the found sampled values

class PyFoam.RunDictionary.SampleDirectory.SampleTime(sDir, time, postfixes=[], prefixes=[], valueNames=None, namesFromFirstLine=False, linePattern=None, needsExtension=True)[source]

Bases: object

A directory with one sampled time

determineIndex(fName, vName, data)[source]

Determines the index of the data from the filename and a dataset :param fName: name of the file :param vName: Name of the quantity :param data: A list with the data :returns: A tuple of a boolean (whether the data is supposed to be a vector or a scalar) and an integer (the index of the data set - or the first component of the vector

extractLine(fName)[source]

Extract the name of the line from a filename

extractValues(fName)[source]

Extracts the names of the contained Values from a filename