本文整理汇总了Python中pynestml.symbols.predefined_types.PredefinedTypes.get_real_type方法的典型用法代码示例。如果您正苦于以下问题:Python PredefinedTypes.get_real_type方法的具体用法?Python PredefinedTypes.get_real_type怎么用?Python PredefinedTypes.get_real_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynestml.symbols.predefined_types.PredefinedTypes
的用法示例。
在下文中一共展示了PredefinedTypes.get_real_type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __register_exp1_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_exp1_function(cls):
"""
Registers the alternative version of the exponent function, exp1.
"""
params = list()
params.append(PredefinedTypes.get_real_type()) # the argument
symbol = FunctionSymbol(name=cls.EXPM1, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.EXPM1] = symbol
示例2: __register_log_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_log_function(cls):
"""
Registers the logarithm function (to base 10).
"""
params = list()
params.append(PredefinedTypes.get_real_type()) # the argument
symbol = FunctionSymbol(name=cls.LOG, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.LOG] = symbol
示例3: __register_convolve
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_convolve(cls):
"""
Registers the convolve function into the system.
"""
params = list()
params.append(PredefinedTypes.get_real_type())
params.append(PredefinedTypes.get_real_type())
symbol = FunctionSymbol(name=cls.CONVOLVE, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.CONVOLVE] = symbol
示例4: __register_min_bounded_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_min_bounded_function(cls):
"""
Registers the minimum (bounded) function.
"""
params = list()
params.append(PredefinedTypes.get_real_type())
params.append(PredefinedTypes.get_real_type())
symbol = FunctionSymbol(name=cls.BOUNDED_MIN, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.BOUNDED_MIN] = symbol
示例5: __register_max_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_max_function(cls):
"""
Registers the maximum function.
"""
params = list()
params.append(PredefinedTypes.get_real_type())
params.append(PredefinedTypes.get_real_type())
symbol = FunctionSymbol(name=cls.MAX, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.MAX] = symbol
示例6: __register_power_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_power_function(cls):
"""
Registers the power function.
"""
params = list()
params.append(PredefinedTypes.get_real_type()) # the base type
params.append(PredefinedTypes.get_real_type()) # the exponent type
symbol = FunctionSymbol(name=cls.POW, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.POW] = symbol
示例7: visit_simple_expression
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def visit_simple_expression(self, node):
"""
Visit a simple rhs and update the type of a numeric literal.
:param node: a single meta_model node
:type node: ast_node
:return: no value returned, the type is updated in-place
:rtype: void
"""
assert node.get_scope() is not None, "Run symboltable creator."
# if variable is also set in this rhs, the var type overrides the literal
if node.get_variable() is not None:
scope = node.get_scope()
var_name = node.get_variable().get_name()
variable_symbol_resolve = scope.resolve_to_symbol(var_name, SymbolKind.VARIABLE)
if not variable_symbol_resolve is None:
node.type = variable_symbol_resolve.get_type_symbol()
else:
node.type = scope.resolve_to_symbol(var_name, SymbolKind.TYPE)
node.type.referenced_object = node
return
if node.get_numeric_literal() is not None and isinstance(node.get_numeric_literal(), float):
node.type = PredefinedTypes.get_real_type()
node.type.referenced_object = node
return
elif node.get_numeric_literal() is not None and isinstance(node.get_numeric_literal(), int):
node.type = PredefinedTypes.get_integer_type()
node.type.referenced_object = node
return
示例8: visit_simple_expression
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def visit_simple_expression(self, node):
"""
Visits a single simple rhs containing an inf literal and updates its type.
:param node: a simple rhs
:type node: ast_simple_expression
"""
node.type = PredefinedTypes.get_real_type()
node.type.referenced_object = node
示例9: __register_random_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_random_function(cls):
"""
Registers the random method as used to generate a random real-typed value.
"""
symbol = FunctionSymbol(name=cls.RANDOM, param_types=list(),
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.RANDOM] = symbol
示例10: __register_emit_spike_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_emit_spike_function(cls):
"""
Registers the emit-spike function.
"""
symbol = FunctionSymbol(name=cls.EMIT_SPIKE, param_types=list(),
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.EMIT_SPIKE] = symbol
示例11: __register_euler_constant
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_euler_constant(cls):
"""
Adds the euler constant e.
"""
symbol = VariableSymbol(name='e', block_type=BlockType.STATE,
is_predefined=True, type_symbol=PredefinedTypes.get_real_type(),
variable_type=VariableType.VARIABLE)
cls.name2variable[cls.E_CONSTANT] = symbol
return
示例12: __register_cond_sum_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_cond_sum_function(cls):
"""
Registers the cond_sum function into scope.
"""
params = list()
params.append(PredefinedTypes.get_type('nS'))
params.append(PredefinedTypes.get_real_type())
symbol = FunctionSymbol(name=cls.COND_SUM, param_types=params,
return_type=PredefinedTypes.get_type('nS'),
element_reference=None, is_predefined=True)
cls.name2function[cls.COND_SUM] = symbol
示例13: __register_delta_function
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def __register_delta_function(cls):
"""
Registers the delta function.
"""
params = list()
params.append(PredefinedTypes.get_type('ms'))
params.append(PredefinedTypes.get_type('ms'))
symbol = FunctionSymbol(name=cls.DELTA, param_types=params,
return_type=PredefinedTypes.get_real_type(),
element_reference=None, is_predefined=True)
cls.name2function[cls.DELTA] = symbol
示例14: visit_ode_shape
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def visit_ode_shape(self, node):
"""
Private method: Used to visit a single ode-shape, create the corresponding symbol and update the scope.
:param node: a single ode-shape.
:type node: ast_ode_shape
"""
if node.get_variable().get_differential_order() == 0 and \
node.get_scope().resolve_to_symbol(node.get_variable().get_complete_name(),
SymbolKind.VARIABLE) is None:
symbol = VariableSymbol(element_reference=node, scope=node.get_scope(),
name=node.get_variable().get_name(),
block_type=BlockType.EQUATION,
declaring_expression=node.get_expression(),
is_predefined=False, is_function=False,
is_recordable=True,
type_symbol=PredefinedTypes.get_real_type(), variable_type=VariableType.SHAPE)
symbol.set_comment(node.get_comment())
node.get_scope().add_symbol(symbol)
node.get_variable().update_scope(node.get_scope())
node.get_expression().update_scope(node.get_scope())
示例15: visit_data_type
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_real_type [as 别名]
def visit_data_type(self, node):
"""
Visits a single data type meta_model node and updates, checks correctness and updates its type symbol.
This visitor can also be used to derive the original name of the unit.
:param node: a single datatype node.
:type node: ast_data_type
"""
if node.is_integer:
self.symbol = PredefinedTypes.get_integer_type()
node.set_type_symbol(self.symbol)
elif node.is_real:
self.symbol = PredefinedTypes.get_real_type()
node.set_type_symbol(self.symbol)
elif node.is_string:
self.symbol = PredefinedTypes.get_string_type()
node.set_type_symbol(self.symbol)
elif node.is_boolean:
self.symbol = PredefinedTypes.get_boolean_type()
node.set_type_symbol(self.symbol)
elif node.is_void:
self.symbol = PredefinedTypes.get_void_type()
node.set_type_symbol(self.symbol)