本文整理汇总了Python中pynestml.symbols.predefined_types.PredefinedTypes.get_types方法的典型用法代码示例。如果您正苦于以下问题:Python PredefinedTypes.get_types方法的具体用法?Python PredefinedTypes.get_types怎么用?Python PredefinedTypes.get_types使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynestml.symbols.predefined_types.PredefinedTypes
的用法示例。
在下文中一共展示了PredefinedTypes.get_types方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: visit_neuron
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_types [as 别名]
def visit_neuron(self, node):
"""
Private method: Used to visit a single neuron and create the corresponding global as well as local scopes.
:return: a single neuron.
:rtype: ast_neuron
"""
# set current processed neuron
Logger.set_current_neuron(node)
code, message = Messages.get_start_building_symbol_table()
Logger.log_message(neuron=node, code=code, error_position=node.get_source_position(),
message=message, log_level=LoggingLevel.INFO)
# before starting the work on the neuron, make everything which was implicit explicit
# but if we have a model without an equations block, just skip this step
if node.get_equations_blocks() is not None:
make_implicit_odes_explicit(node.get_equations_blocks())
scope = Scope(scope_type=ScopeType.GLOBAL, source_position=node.get_source_position())
node.update_scope(scope)
node.get_body().update_scope(scope)
# now first, we add all predefined elements to the scope
variables = PredefinedVariables.get_variables()
functions = PredefinedFunctions.get_function_symbols()
types = PredefinedTypes.get_types()
for symbol in variables.keys():
node.get_scope().add_symbol(variables[symbol])
for symbol in functions.keys():
node.get_scope().add_symbol(functions[symbol])
for symbol in types.keys():
node.get_scope().add_symbol(types[symbol])
示例2: __register_predefined_type_variables
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_types [as 别名]
def __register_predefined_type_variables(cls):
"""
Registers all predefined type variables, e.g., mV and integer.
"""
for name in PredefinedTypes.get_types().keys():
symbol = VariableSymbol(name=name, block_type=BlockType.PREDEFINED,
is_predefined=True,
type_symbol=PredefinedTypes.get_type(name),
variable_type=VariableType.TYPE)
cls.name2variable[name] = symbol
return
示例3: is_unit_variable
# 需要导入模块: from pynestml.symbols.predefined_types import PredefinedTypes [as 别名]
# 或者: from pynestml.symbols.predefined_types.PredefinedTypes import get_types [as 别名]
def is_unit_variable(self):
"""
Provided on-the-fly information whether this variable represents a unit-variable, e.g., nS.
Caution: It assumes that the symbol table has already been constructed.
:return: True if unit-variable, otherwise False.
:rtype: bool
"""
from pynestml.symbols.predefined_types import PredefinedTypes
if self.get_name() in PredefinedTypes.get_types():
return True
else:
return False