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__
= dict_proxy({'__module__': 'PyFoam.RunDictionary.SampleDirectory', 'isVector': <function isVector>, 'component': <function component>, 'domain': <function domain>, '__dict__': <attribute '__dict__' of 'SampleData' objects>, 'range': <function range>, '__repr__': <function __repr__>, 'time': <function time>, '__call__': <function __call__>, 'line': <function line>, '__weakref__': <attribute '__weakref__' of 'SampleData' objects>, '__doc__': 'Data from a sample-set', '__init__': <function __init__>})¶
-
__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__
= dict_proxy({'__module__': 'PyFoam.RunDictionary.SampleDirectory', '__getitem__': <function __getitem__>, '__contains__': <function __contains__>, 'lines': <function lines>, '__iter__': <function __iter__>, 'values': <function values>, '__len__': <function __len__>, '__dict__': <attribute '__dict__' of 'SampleDirectory' objects>, 'getData': <function getData>, '__weakref__': <attribute '__weakref__' of 'SampleDirectory' objects>, '__doc__': 'A directory of sampled times', '__init__': <function __init__>})¶
-
__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__
= dict_proxy({'extractValues': <function extractValues>, '__module__': 'PyFoam.RunDictionary.SampleDirectory', '__doc__': 'A directory with one sampled time', '__getitem__': <function __getitem__>, '__dict__': <attribute '__dict__' of 'SampleTime' objects>, '__weakref__': <attribute '__weakref__' of 'SampleTime' objects>, 'extractLine': <function extractLine>, '__init__': <function __init__>, 'determineIndex': <function determineIndex>})¶
-
__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
-