PyFoam.LogAnalysis.RegExpLineAnalyzer module

Analyzes lines with regular expressions

class PyFoam.LogAnalysis.RegExpLineAnalyzer.RegExpLineAnalyzer(name, exp, idNr=None, dataTransformations=None, stringValues=None, titles=[], doTimelines=False, doFiles=True, accumulation=None, progressTemplate=None, singleFile=False, startTime=None, endTime=None)[source]

Bases: PyFoam.LogAnalysis.GeneralLineAnalyzer.GeneralLineAnalyzer

Parses lines for an arbitrary regular expression

Only one data-set is stored per time-step

One pattern group of the RegExp can be used as a unique identifier, so that more than one data-sets can be stored per time-step

The string %f% in the regular expression is replaced with the regular expression for a floating point number

__init__(name, exp, idNr=None, dataTransformations=None, stringValues=None, titles=[], doTimelines=False, doFiles=True, accumulation=None, progressTemplate=None, singleFile=False, startTime=None, endTime=None)[source]
Parameters
  • name – name of the expression (needed for output

  • exp – the regular expression, %f% will be replaced with the

regular expression for a float :param idNr: number of the pattern group that is used as an identifier :param titles: titles of the columns :param dataTransformations: List of expression strings with replacement values of the form “$1”, “$2” which are replaced with the groups of the regular expression. If this is set the original data is discarded and the values when inserting them to the replacements are used :param accumulation: How multiple values should be accumulated

__module__ = 'PyFoam.LogAnalysis.RegExpLineAnalyzer'
addToFiles(match)[source]

Method that adds matched data to files

Parameters

match – data matched by a regular expression

addToTimelines(match)[source]

Method that adds matched data to timelines

Parameters

match – data matched by a regular expression

filterIdFromData(fdata)[source]
getCurrentData(structured=False)[source]

Give back the current analyzed data in a dictionary

To be overwritten by subclasses

getData(time=None, ID=None)[source]

get a data value at a specific time for a specific ID

getIDs()[source]

get a list of the available IDs

getLast(ID=None)[source]

get the last time for the identifier ID

getTimes(ID=None)[source]

get the available time for the identifier ID

makeID(match)[source]
processProgressTemplate(data)[source]

Add progress information

startAnalysis(match)[source]

Method at the start of a successfull match

stringToMatch(line)[source]

Returns string to match. To be overriden for multi-line expressions

sub(ID)[source]

get the data set for the identifier ID

transformData(d)[source]
class PyFoam.LogAnalysis.RegExpLineAnalyzer.RegExpTimeLineLineAnalyzer(name, exp, titles=[], startTime=None, endTime=None)[source]

Bases: PyFoam.LogAnalysis.RegExpLineAnalyzer.RegExpLineAnalyzer

Class that stores results as timelines, too

__init__(name, exp, titles=[], startTime=None, endTime=None)[source]
Parameters
  • name – name of the expression (needed for output

  • exp – the regular expression, %f% will be replaced with the

regular expression for a float :param titles: titles of the columns

__module__ = 'PyFoam.LogAnalysis.RegExpLineAnalyzer'