PyFoam.Basics.RunDatabase module

Collects data about runs in a small SQLite database

class PyFoam.Basics.RunDatabase.RunDatabase(name, create=False, verbose=False)[source]

Bases: object

Database with information about runs. To be queried etc

_RunDatabase__adaptDatabase(data)

Make sure that all the required columns and tables are there

_RunDatabase__addColumnsToTable(table, data)
_RunDatabase__addContent(table, data)
_RunDatabase__denormalize(s)

Denormalize the column name that was normalized by _normalize

_RunDatabase__flattenDict(oData, prefix='')
_RunDatabase__getColumns(tablename)
_RunDatabase__normalize(s)

Normalize a column-name so that the case-insensitve column-names of SQlite are no problem

__dict__ = mappingproxy({'dumpToCSV': <function RunDatabase.dumpToCSV>, '_RunDatabase__addContent': <function RunDatabase.__addContent>, '__module__': 'PyFoam.Basics.RunDatabase', 'separator': '//', '__doc__': '\n Database with information about runs. To be queried etc\n ', 'initDatabase': <function RunDatabase.initDatabase>, 'add': <function RunDatabase.add>, 'specialString': '_specialChar', '_RunDatabase__adaptDatabase': <function RunDatabase.__adaptDatabase>, '_RunDatabase__normalize': <function RunDatabase.__normalize>, '__init__': <function RunDatabase.__init__>, '__weakref__': <attribute '__weakref__' of 'RunDatabase' objects>, '_RunDatabase__denormalize': <function RunDatabase.__denormalize>, '_RunDatabase__flattenDict': <function RunDatabase.__flattenDict>, '__dict__': <attribute '__dict__' of 'RunDatabase' objects>, '_RunDatabase__addColumnsToTable': <function RunDatabase.__addColumnsToTable>, 'specialChars': {'|': 'pip', '(': 'pro', ')': 'prc', '{': 'cro', '[': 'bro', '}': 'crc', ']': 'brc'}, '_RunDatabase__getColumns': <function RunDatabase.__getColumns>})
__init__(name, create=False, verbose=False)[source]
Parameters:
  • name – name of the file
  • create – should the database be created if it does not exist
__module__ = 'PyFoam.Basics.RunDatabase'
__weakref__

list of weak references to the object (if defined)

add(data)[source]

Add a dictionary with data to the database

dumpToCSV(fname, selection=None, disableRunData=None, pandasFormat=True, excel=False)[source]

Dump the contents of the database to a csv-file :param name: the CSV-file :param selection: list of regular expressions. Only data entries fitting those will be added to the CSV-file (except for the basic run). If unset all data will be written

initDatabase(name)[source]

Create a new database file

separator = '//'
specialChars = {'|': 'pip', '(': 'pro', ')': 'prc', '{': 'cro', '[': 'bro', '}': 'crc', ']': 'brc'}
specialString = '_specialChar'