def proxify( reac, reacc, direction, pool, poolc ): reacc_elm = _moose.element( reacc ) reac_elm = _moose.element( reac ) # Preserve the rates which were set up for the x-compt reacn #_moose.showfield( reac ) dupname = pool.name + '_xfer_' + _moose.element(poolc).name #print "#############", pool, dupname, poolc if _moose.exists( reacc + '/' + dupname ): duppool = _moose.element( reacc + '/' + dupname ) else: # This also deals with cases where the duppool is buffered. duppool = _moose.copy(pool, reacc_elm, dupname ) duppool.diffConst = 0 # diffusion only happens in original compt removeEnzFromPool( duppool ) disconnectReactant( reac, pool, duppool ) _moose.connect( reac, direction, duppool, 'reac' )
def restoreXreacs( basepath ): proxyInfo = _moose.wildcardFind( basepath + "/##/#_xfer_#/info" ) for i in proxyInfo: msgs = i.notes.split( msgSeparator ) oldRates = getOldRates( msgs ) #print( "Deleting {}".format( i.parent.path ) ) #print msgs _moose.delete( i.parent ) for j in msgs[1:]: if len( j ) > 0: args = j.split( ' ' ) assert( len( args ) == 4 ) #_moose.showfield( args[0] ) _moose.connect( args[0], args[1], args[2], args[3] ) #print( "Reconnecting {}".format( args ) ) #_moose.showfield( args[0] ) restoreOldRates( oldRates, msgs )
def restoreXreacs(basepath): proxyInfo = _moose.wildcardFind(basepath + "/##/#_xfer_#/info") for i in proxyInfo: msgs = i.notes.split(msgSeparator) oldRates = getOldRates(msgs) #print( "Deleting {}".format( i.parent.path ) ) #print msgs _moose.delete(i.parent) for j in msgs[1:]: if len(j) > 0: args = j.split(' ') assert (len(args) == 4) #_moose.showfield( args[0] ) _moose.connect(args[0], args[1], args[2], args[3]) #print( "Reconnecting {}".format( args ) ) #_moose.showfield( args[0] ) restoreOldRates(oldRates, msgs)
def restoreXreacs( basepath ): proxyInfo = _moose.wildcardFind( basepath + "/##/#_xfer_#/info" ) for i in proxyInfo: msgs = i.notes.split( msgSeparator ) oldRates = getOldRates( msgs ) #print( "Deleting {}".format( i.parent.path ) ) #print msgs _moose.delete( i.parent ) for j in msgs[1:]: if len( j ) > 0: args = j.split( ' ' ) assert( len( args ) == 4 ) #_moose.showfield( args[0] ) #check to see if object exist before moose.connect, cases where object is deleted but #_xref_ annotation info field still holds the reference if (_moose.exists(args[0]) and _moose.exists(args[2])): _moose.connect( args[0], args[1], args[2], args[3] ) #print( "Reconnecting {}".format( args ) ) #_moose.showfield( args[0] ) restoreOldRates( oldRates, msgs )
def record(obj, field=None, label=None): """""" global _counter # Checking if object is an iterable like list or a tuple, but not a string. if hasattr(obj, "__iter__"): return [record(o, field, label) for o in obj] if isinstance(obj, str): obj = _moose.element(obj) if field is None: field = _defaultField(obj) path = _path.format(_counter) _counter += 1 p = _Plot(path, obj, field, label) _plots.append(p) _moose.connect(p, "requestData", obj, "get_" + field) _moose.useClock(_tick, path, "process") return p