ecoli.processes.struct_array_demo

class ecoli.processes.struct_array_demo.StructArrayDemo(parameters=None)[source]

Bases: Process

Process allowing for easy comparison of _add and _delete operations with/without using a struct array.

Adds/deletes an active_RNAP molecule at exponentially distributed random intervals with the rate parameters specified.

DTYPE = dtype([('_key', '<U16'), ('unique_index', '<i8'), ('domain_index', '<i8'), ('coordinates', '<i8'), ('direction', '?')])
defaults: Dict[str, Any]
{   'mean_add': 1,
    'mode': 'default',
    'rate_add': 0.5,
    'rate_delete': 0.2,
    'seed': 0}
name = 'StructArrayDemo'
next_update(timestep, states)[source]
ports_schema()[source]
ecoli.processes.struct_array_demo.dict_value_updater(current, update)[source]

Updater which translates add_item and delete_item -style updates into operations on a dictionary.

Expects current to be a dictionary, with no restriction on the types of objects stored within it, and no defaults. For enforcing expectations/defaults, try make_dict_value_updater(**defaults).

ecoli.processes.struct_array_demo.main()[source]
ecoli.processes.struct_array_demo.make_dict_value_updater(**defaults)[source]

Returns an updater which translates add_item and delete_item -style updates into operations on a dictionary.

The returned updater expects current to be a dictionary. Each added item can have a subset of the provided defaults as its keys; entries not provided will have values supplied by the defaults.

ecoli.processes.struct_array_demo.struct_array_updater(current, update)[source]

Updater which translates _add and _delete -style updates into operations on a structured array.

Expects current to be a numpy structured array, whose dtype will be maintained by the result returned. The first element of the dtype must be (“_key”, “<U16”), an index targeted by _add and _delete operations.