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({'__init__': <function RunDatabase.__init__>, '_RunDatabase__flattenDict': <function RunDatabase.__flattenDict>, 'specialString': '_specialChar', '__module__': 'PyFoam.Basics.RunDatabase', '_RunDatabase__denormalize': <function RunDatabase.__denormalize>, '_RunDatabase__getColumns': <function RunDatabase.__getColumns>, 'initDatabase': <function RunDatabase.initDatabase>, 'separator': '//', '__weakref__': <attribute '__weakref__' of 'RunDatabase' objects>, '_RunDatabase__normalize': <function RunDatabase.__normalize>, '__doc__': '\n Database with information about runs. To be queried etc\n ', '_RunDatabase__addContent': <function RunDatabase.__addContent>, 'specialChars': {']': 'brc', '[': 'bro', '}': 'crc', '{': 'cro', '|': 'pip', ')': 'prc', '(': 'pro'}, '_RunDatabase__adaptDatabase': <function RunDatabase.__adaptDatabase>, 'add': <function RunDatabase.add>, '__dict__': <attribute '__dict__' of 'RunDatabase' objects>, 'dumpToCSV': <function RunDatabase.dumpToCSV>, '_RunDatabase__addColumnsToTable': <function RunDatabase.__addColumnsToTable>})
__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 = {']': 'brc', '[': 'bro', '}': 'crc', '{': 'cro', '|': 'pip', ')': 'prc', '(': 'pro'}
specialString = '_specialChar'