Example 1: Organizing Simulation Parameters¶
Two versions of configuration processing are shown. The first one merely collects the simulation parameters into a dictionary. The Second version stores them additionally in a database.
Without the use of a database:¶
1from cytoskeleton_analyser.inout import Paths # simulation-specific paths
2from cytoskeleton_analyser.config.drivers import process # driver fuction
3from sim_specs import cell, data_in, data_out, rinds
4
5# Decide if this is a new analysis, or we merely want to import one.
6new = True
7
8if __name__ == '__main__':
9
10 for ci in rinds:
11 paths = Paths(data_in, data_out, cell, ci)
12 process(new, paths, ci, cell)
Accumulate the settings in a database:¶
Similar to the above, but the database module is included (line 3). The data are collected in ‘cfs’ (lines 11,12) list before sending to the database (line 13).
1from cytoskeleton_analyser.inout import Paths # simulation-specific paths
2from cytoskeleton_analyser.config.drivers import process # driver fuction
3import cytoskeleton_analyser.database.sqlite_alchemy_orm.db as db # database
4from sim_specs import cell, data_in, data_out, rinds
5
6# Decide if this is a new analysis, or we merely want to import one.
7new = True
8
9if __name__ == '__main__':
10
11 cfs = [process(new, Paths(data_in, data_out, cell, ci), ci, cell)
12 for ci in rinds]
13 db.update(cfs, cell, Paths(data_in, data_out, cell).data_out.parent)