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:
objectDatabase with information about runs. To be queried etc
- TheRunsName = 'theRuns'
- __adaptDatabase(data)
Make sure that all the required columns and tables are there
- __addColumnsToTable(table, data)
- __addContent(table, data, update_run=None)
- __denormalize(s)
Denormalize the column name that was normalized by _normalize
- __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>, '__annotations__': {}})
- __flattenDict(oData, prefix='')
- __getColumns(tablename)
- __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'
- __normalize(s)
Normalize a column-name so that the case-insensitve column-names of SQlite are no problem
- __weakref__
list of weak references to the object (if defined)
- 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
- 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'