本文整理汇总了Python中pynestml.utils.logger.Logger.init_logger方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.init_logger方法的具体用法?Python Logger.init_logger怎么用?Python Logger.init_logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pynestml.utils.logger.Logger
的用法示例。
在下文中一共展示了Logger.init_logger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
def test(self):
# Todo: this test is not yet complete, @ptraeder complete it
Logger.init_logger(LoggingLevel.INFO)
model = ModelParser.parse_model(
os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__),
'resources', 'MagnitudeCompatibilityTest.nestml'))))
# Logger.setCurrentNeuron(model.getNeuronList()[0])
ExpressionTestVisitor().handle(model)
示例2: setUp
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
def setUp(self):
PredefinedUnits.register_units()
PredefinedTypes.register_types()
PredefinedFunctions.register_functions()
PredefinedVariables.register_variables()
SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0))
Logger.init_logger(LoggingLevel.INFO)
self.target_path = str(os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.join(
os.pardir, 'target'))))
示例3: test
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
def test(self):
Logger.init_logger(LoggingLevel.INFO)
model = ModelParser.parse_model(
os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__),
'resources', 'ExpressionTypeTest.nestml'))))
Logger.set_current_neuron(model.get_neuron_list()[0])
model.accept(ExpressionTestVisitor())
# ExpressionTestVisitor().handle(model)
Logger.set_current_neuron(None)
self.assertEqual(len(Logger.get_all_messages_of_level_and_or_neuron(model.get_neuron_list()[0],
LoggingLevel.ERROR)), 2)
示例4: parse_config
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
def parse_config(cls, args):
"""
Standard constructor. This method parses the
:param args: a set of arguments as handed over to the frontend
:type args: list(str)
"""
cls.argument_parser = argparse.ArgumentParser(
description='''NESTML is a domain specific language that supports the specification of neuron
models in a precise and concise syntax, based on the syntax of Python. Model
equations can either be given as a simple string of mathematical notation or
as an algorithm written in the built-in procedural language. The equations are
analyzed by NESTML to compute an exact solution if possible or use an
appropriate numeric solver otherwise.
Version ''' + str(pynestml.__version__), formatter_class=argparse.RawDescriptionHelpFormatter)
cls.argument_parser.add_argument(qualifier_input_path_arg, metavar='PATH', type=str, nargs='+', help=help_input_path, required=True)
cls.argument_parser.add_argument(qualifier_target_path_arg, metavar='PATH', type=str, nargs='?', help=help_target_path)
cls.argument_parser.add_argument(qualifier_target_arg, metavar='NEST, none', type=str, nargs='?', help=help_target, default='NEST')
cls.argument_parser.add_argument(qualifier_logging_level_arg, metavar='[INFO, WARNING/S, ERROR/S, NO]', type=str,help=help_logging)
cls.argument_parser.add_argument(qualifier_module_name_arg, metavar='NAME', type=str, help=help_module)
cls.argument_parser.add_argument(qualifier_store_log_arg, action='store_true', help=help_log)
cls.argument_parser.add_argument(qualifier_suffix_arg, metavar='SUFFIX', type=str, help=help_suffix, default='')
cls.argument_parser.add_argument(qualifier_dev_arg, action='store_true', help=help_dev)
parsed_args = cls.argument_parser.parse_args(args)
# get the source path
cls.handle_source_path(parsed_args.input_path[0])
# initialize the logger
if parsed_args.logging_level is not None:
cls.logging_level = parsed_args.logging_level
Logger.init_logger(Logger.string_to_level(parsed_args.logging_level))
else:
cls.logging_level = "ERROR"
Logger.init_logger(Logger.string_to_level("ERROR"))
# now update the target
cls.handle_target(parsed_args.target)
# now update the target path
cls.handle_target_path(parsed_args.target_path)
# now adjust the name of the module, if it is a single file, then it is called just module
if parsed_args.module_name is not None:
assert parsed_args.module_name.endswith('module'), "Module name (\"" + parsed_args.module_name + "\") should end with \"module\""
cls.module_name = parsed_args.module_name
elif os.path.isfile(parsed_args.input_path[0]):
cls.module_name = 'nestmlmodule'
elif os.path.isdir(parsed_args.input_path[0]):
cls.module_name = os.path.basename(os.path.normpath(parsed_args.input_path[0]))
else:
cls.module_name = 'nestmlmodule'
cls.store_log = parsed_args.store_log
cls.suffix = parsed_args.suffix
cls.is_debug = parsed_args.dev
return
示例5: NestMLPrinterTest
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
from pynestml.symbol_table.symbol_table import SymbolTable
from pynestml.symbols.predefined_functions import PredefinedFunctions
from pynestml.symbols.predefined_types import PredefinedTypes
from pynestml.symbols.predefined_units import PredefinedUnits
from pynestml.symbols.predefined_variables import PredefinedVariables
from pynestml.utils.ast_nestml_printer import ASTNestMLPrinter
from pynestml.utils.logger import LoggingLevel, Logger
from pynestml.utils.model_parser import ModelParser
# setups the infrastructure
PredefinedUnits.register_units()
PredefinedTypes.register_types()
PredefinedFunctions.register_functions()
PredefinedVariables.register_variables()
SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0))
Logger.init_logger(LoggingLevel.INFO)
class NestMLPrinterTest(unittest.TestCase):
"""
Tests if the NestML printer works as intended.
"""
def test_block_with_variables_with_comments(self):
block = '\n' \
'/* pre1\n' \
'* pre2\n' \
'*/\n' \
'state: # in\n' \
'end\n' \
'/* post1\n' \
示例6: CommentTest
# 需要导入模块: from pynestml.utils.logger import Logger [as 别名]
# 或者: from pynestml.utils.logger.Logger import init_logger [as 别名]
from pynestml.generated.PyNestMLParser import PyNestMLParser
from pynestml.symbol_table.symbol_table import SymbolTable
from pynestml.symbols.predefined_functions import PredefinedFunctions
from pynestml.symbols.predefined_types import PredefinedTypes
from pynestml.symbols.predefined_units import PredefinedUnits
from pynestml.symbols.predefined_variables import PredefinedVariables
from pynestml.utils.logger import LoggingLevel, Logger
from pynestml.visitors.ast_builder_visitor import ASTBuilderVisitor
# setups the infrastructure
PredefinedUnits.register_units()
PredefinedTypes.register_types()
PredefinedFunctions.register_functions()
PredefinedVariables.register_variables()
SymbolTable.initialize_symbol_table(ASTSourceLocation(start_line=0, start_column=0, end_line=0, end_column=0))
Logger.init_logger(LoggingLevel.ERROR)
class CommentTest(unittest.TestCase):
def test(self):
# print('Start creating AST for ' + filename + ' ...'),
input_file = FileStream(
os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), 'resources')),
'CommentTest.nestml'))
lexer = PyNestMLLexer(input_file)
# create a token stream
stream = CommonTokenStream(lexer)
stream.fill()
# parse the file
parser = PyNestMLParser(stream)
# process the comments