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