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
-
__call__
(scaleX=1.0, scaleData=1, offsetData=0, offsetX=0)[source]¶ Return the data as SpreadsheetData-object
-
__dict__
= mappingproxy({'__module__': 'PyFoam.RunDictionary.SampleDirectory', '__doc__': 'Data from a sample-set', '__init__': <function SampleData.__init__>, '__repr__': <function SampleData.__repr__>, 'line': <function SampleData.line>, 'time': <function SampleData.time>, 'isVector': <function SampleData.isVector>, 'range': <function SampleData.range>, 'domain': <function SampleData.domain>, 'component': <function SampleData.component>, '__call__': <function SampleData.__call__>, '__dict__': <attribute '__dict__' of 'SampleData' objects>, '__weakref__': <attribute '__weakref__' of 'SampleData' objects>})¶
-
__init__
(fName, name, line, index, coord, data, note='', scale=(1, 1), offset=(0, 0))[source]¶ - Parameters
fName – Name of the file
name – Name of the value
index – Index of the data in the file
coord – Values that identify the data (the location)
data – The actual data
scale – pair of factors with which the data is scaled when being plotted
offset – pair of offsets
-
__module__
= 'PyFoam.RunDictionary.SampleDirectory'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
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
-
__dict__
= mappingproxy({'__module__': 'PyFoam.RunDictionary.SampleDirectory', '__doc__': 'A directory of sampled times', '__init__': <function SampleDirectory.__init__>, '__len__': <function SampleDirectory.__len__>, '__iter__': <function SampleDirectory.__iter__>, '__getitem__': <function SampleDirectory.__getitem__>, '__contains__': <function SampleDirectory.__contains__>, 'lines': <function SampleDirectory.lines>, 'values': <function SampleDirectory.values>, 'getData': <function SampleDirectory.getData>, '__dict__': <attribute '__dict__' of 'SampleDirectory' objects>, '__weakref__': <attribute '__weakref__' of 'SampleDirectory' objects>})¶
-
__init__
(case, dirName='samples', postfixes=[], prefixes=[], valueNames=None, linePattern=None, namesFromFirstLine=False, needsExtension=True)[source]¶ - Parameters
case – The case directory
dirName – Name of the directory with the samples
postfixes – list of possible extensions to a field name of the form
name_postfix to help splitting such field names. :param prefixes: list of possible extensions to a field name of the form prefix_name to help splitting such field names :param valueNames: List of value names. If specified then the classes do not try to determine the names automatically :param linePattern: Regular expression to determine the name of the line from the filename. The first group in the expression is the name. If unset the linename is determined automatically :param needsExtension: whether a file needs an extension
-
__module__
= 'PyFoam.RunDictionary.SampleDirectory'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
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
-
-
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
-
__dict__
= mappingproxy({'__module__': 'PyFoam.RunDictionary.SampleDirectory', '__doc__': 'A directory with one sampled time', '__init__': <function SampleTime.__init__>, 'extractLine': <function SampleTime.extractLine>, 'extractValues': <function SampleTime.extractValues>, '__getitem__': <function SampleTime.__getitem__>, 'determineIndex': <function SampleTime.determineIndex>, '__dict__': <attribute '__dict__' of 'SampleTime' objects>, '__weakref__': <attribute '__weakref__' of 'SampleTime' objects>})¶
-
__getitem__
(key)[source]¶ Get the data for a value on a specific line :param key: A tuple with the line-name and the value-name :returns: A SampleData-object
-
__init__
(sDir, time, postfixes=[], prefixes=[], valueNames=None, namesFromFirstLine=False, linePattern=None, needsExtension=True)[source]¶ - Parameters
sDir – The sample-dir
time – the timename
postfixes – list of possible extensions to a field name of the form
name_postfix to help splitting such field names. :param prefixes: list of possible extensions to a field name of the form prefix_name to help splitting such field names
-
__module__
= 'PyFoam.RunDictionary.SampleDirectory'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
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
-