PyFoam.Basics.TimeLineCollection module

Collection of array of timelines

class PyFoam.Basics.TimeLineCollection.TimeLineCollection(deflt=nan, extendCopy=False, splitThres=None, split_fraction_unchanged=0.2, splitFun=None, noEmptyTime=True, advancedSplit=False, preloadData=None, accumulation='first', registry=None)[source]

Bases: object

__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.TimeLineCollection', 'possibleAccumulations': ['first', 'last', 'min', 'max', 'average', 'sum', 'count'], '__init__': <function TimeLineCollection.__init__>, 'resetValid': <function TimeLineCollection.resetValid>, 'nrValid': <function TimeLineCollection.nrValid>, 'addSlave': <function TimeLineCollection.addSlave>, 'addCollector': <function TimeLineCollection.addCollector>, 'setAccumulator': <function TimeLineCollection.setAccumulator>, 'setSplitting': <function TimeLineCollection.setSplitting>, 'setDefault': <function TimeLineCollection.setDefault>, 'setExtend': <function TimeLineCollection.setExtend>, 'nr': <function TimeLineCollection.nr>, 'setTime': <function TimeLineCollection.setTime>, '_time_resolution_split': <function TimeLineCollection._time_resolution_split>, '_advanced_split': <function TimeLineCollection._advanced_split>, 'split': <function TimeLineCollection.split>, 'getTimes': <function TimeLineCollection.getTimes>, 'getValueNames': <function TimeLineCollection.getValueNames>, 'getValues': <function TimeLineCollection.getValues>, 'setValue': <function TimeLineCollection.setValue>, 'getData': <function TimeLineCollection.getData>, 'getLatestData': <function TimeLineCollection.getLatestData>, '__dict__': <attribute '__dict__' of 'TimeLineCollection' objects>, '__weakref__': <attribute '__weakref__' of 'TimeLineCollection' objects>, '__doc__': None})
__init__(deflt=nan, extendCopy=False, splitThres=None, split_fraction_unchanged=0.2, splitFun=None, noEmptyTime=True, advancedSplit=False, preloadData=None, accumulation='first', registry=None)[source]
Parameters
  • deflt – default value for timelines if none has been defined before

  • extendCopy – Extends the timeline by cpying the last element

  • splitThres – Threshold after which the number of points is halved

  • splitFun – Function that is used for halving. If none is specified the mean function is used

  • noEmptyTime – if there is no valid entry no data is stored for this time

  • advancedSplit – Use another split algorithm than one that condenses two values into one

  • preloadData – a dictionary with a dictionary to initialize the values

  • accumulation – if more than one value is given at any time-step, how to accumulate them (possible values: “first”, “last”, “min”, “max”, “average”, “sum”,”count”)

__module__ = 'PyFoam.Basics.TimeLineCollection'
__weakref__

list of weak references to the object (if defined)

_advanced_split()[source]
_time_resolution_split()[source]
addCollector(collector)[source]

Adds a collector time-line-collection

addSlave(slave)[source]
getData()[source]

Return the whole current data as a SpreadsheetData-object

getLatestData(structured=False)[source]

Return a dictionary with the latest values from all data sets

getTimes(name=None)[source]
Returns

A list of the time values

getValueNames()[source]
Returns

A list with the names of the safed values

getValues(name)[source]

Gets a timeline :param name: Name of the timeline :return: List with the values

nr()[source]

Number of elements in timelines

nrValid()[source]

Helper function that gets the number of valid values

possibleAccumulations = ['first', 'last', 'min', 'max', 'average', 'sum', 'count']
resetValid(val=False)[source]

Helper function that resets the information whether the last entry is valid

setAccumulator(name, accu)[source]

Sets a special accumulator fopr a timeline :param name: Name of the timeline :param accu: Name of the accumulator

setDefault(deflt)[source]
Parameters

deflt – default value to be used

setExtend(mode)[source]
Parameters

mode – whether or not to extend the timeline by copying or setting the default value

setSplitting(splitThres=None, split_fraction_unchanged=0.2, splitFun=None, advancedSplit=False, noEmptyTime=True)[source]

Sets the parameters for splitting

setTime(time, noLock=False, forceAppend=False)[source]

Sets the time. If time is new all the timelines are extended :param time: the new current time :param noLock: do not acquire the lock that ensures consistent data transmission

setValue(name, value)[source]

Sets the value of the last element in a timeline :param name: name of the timeline :param value: the last element

split(array, func)[source]

Makes the array smaller by joining every two points :param array: the field to split :param func: The function to use for joining two points

class PyFoam.Basics.TimeLineCollection.TimeLinesRegistry[source]

Bases: object

Collects references to TimeLineCollection objects

__dict__ = mappingproxy({'__module__': 'PyFoam.Basics.TimeLineCollection', '__doc__': 'Collects references to TimeLineCollection objects', 'nr': 1, '__init__': <function TimeLinesRegistry.__init__>, 'clear': <function TimeLinesRegistry.clear>, 'add': <function TimeLinesRegistry.add>, 'get': <function TimeLinesRegistry.get>, 'prepareForTransfer': <function TimeLinesRegistry.prepareForTransfer>, 'resolveSlaves': <function TimeLinesRegistry.resolveSlaves>, 'resolveCollectors': <function TimeLinesRegistry.resolveCollectors>, '__dict__': <attribute '__dict__' of 'TimeLinesRegistry' objects>, '__weakref__': <attribute '__weakref__' of 'TimeLinesRegistry' objects>})
__init__()[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'PyFoam.Basics.TimeLineCollection'
__weakref__

list of weak references to the object (if defined)

add(line, nr=None)[source]
clear()[source]
get(nr)[source]
nr = 1
prepareForTransfer()[source]

Makes sure that the data about the timelines is to be transfered via XMLRPC

resolveCollectors()[source]

Looks through all the registered lines and replaces integers with the actual registered line

resolveSlaves()[source]
PyFoam.Basics.TimeLineCollection.allLines()[source]
PyFoam.Basics.TimeLineCollection.mean(a, b)[source]

Mean value of a and b

PyFoam.Basics.TimeLineCollection.signedMax(a, b)[source]

Absolute Maximum of a and b with the sign preserved