def VisitFunctionDefInstantiation(self, o, **kwargs): import neurounits if type(o.function_def) == neurounits.ast.astobjects.BuiltInFunction: if o.function_def.funcname == "pow": p0_rhs = self.visit(o.parameters['base'].rhs_ast) p1_rhs = self.visit(o.parameters['exp'].rhs_ast) r = "%s(%s,%s)" % (o.function_def.funcname, p0_rhs, p1_rhs) return r else: assert len(o.parameters) == 1 p0_rhs = self.visit(o.parameters.values()[0].rhs_ast) r = "%s(%s)" % (o.function_def.funcname, p0_rhs) return r elif type(o.function_def) == neurounits.ast.astobjects.FunctionDef: #params = ",".join( self.visit(p.rhs_ast,varnames=varnames, varunits=varunits,**kwargs) for p in o.parameters.values() ) #func_call = "%s(%s)"%( varnames[o.function_def].raw_name, params) print 'T', [type(p.rhs_ast) for p in o.parameters.values()] params = ",".join( self.visit(p.rhs_ast) for p in o.parameters.values()) func_call = "%s(%s)" % (o.function_def.funcname.replace( ".", "__"), params) return func_call else: panic()
def VisitFunctionDefInstantiation(self, o, **kwargs): import neurounits if type(o.function_def) == neurounits.ast.astobjects.BuiltInFunction: if o.function_def.funcname == "pow": p0_rhs = self.visit(o.parameters['base'].rhs_ast) p1_rhs = self.visit(o.parameters['exp'].rhs_ast) r = "%s(%s,%s)"%( o.function_def.funcname, p0_rhs, p1_rhs ) return r else: assert len(o.parameters) == 1 p0_rhs = self.visit(o.parameters.values()[0].rhs_ast) r = "%s(%s)"%( o.function_def.funcname, p0_rhs ) return r elif type(o.function_def) == neurounits.ast.astobjects.FunctionDef: #params = ",".join( self.visit(p.rhs_ast,varnames=varnames, varunits=varunits,**kwargs) for p in o.parameters.values() ) #func_call = "%s(%s)"%( varnames[o.function_def].raw_name, params) print 'T', [ type(p.rhs_ast) for p in o.parameters.values()] params = ",".join( self.visit(p.rhs_ast) for p in o.parameters.values() ) func_call = "%s(%s)"%( o.function_def.funcname.replace(".","__"), params) return func_call else: panic()
def VisitEqnAssignmentByRegime(self, o, **kwargs): panic()
def VisitFunctionDefInstantiationParater(self, o, **kwargs): panic()
def VisitFunctionDef(self, o, **kwargs): panic()
def VisitAssignedVariable(self, o, **kwargs): panic()
def VisitStateVariable(self, o, **kwargs): panic()
def VisitEqnTimeDerivative(self, o, **kwargs): panic()
def VisitOnEventStateAssignment(self, o, **kwargs): panic()
def VisitOnEvent(self, o, **kwargs): panic()
def VisitEqnSet(self, o, **kwargs): panic()
def VisitBoolNot(self, o, **kwargs): panic()
def VisitBoolOr(self, o, **kwargs): panic()
def VisitBoolAnd(self, o, **kwargs): panic()
def VisitEqnAssignment(self, o, **kwargs): panic()
def VisitParameter(self, o, **kwargs): panic()
def VisitSuppliedValue(self, o, **kwargs): panic()
def VisitTimeDerivativeByRegime(self, o, **kwargs): panic()