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

TheRunsName = 'theRuns'
_RunDatabase__adaptDatabase(data)

Make sure that all the required columns and tables are there

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

get_runID(uniqueId)[source]
id_exists(theId)[source]
initDatabase(name)[source]

Create a new database file

modify(unique_id, data)[source]

Modify a dataset for which we have a unique id with the data in a dictionary

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