partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
get_parser
Return appropriate parser for given type. :param typ: Type to get parser for. :return function: Parser
bananas/environment.py
def get_parser(typ): """ Return appropriate parser for given type. :param typ: Type to get parser for. :return function: Parser """ try: return { str: parse_str, bool: parse_bool, int: parse_int, tuple: parse_tuple, list: parse...
def get_parser(typ): """ Return appropriate parser for given type. :param typ: Type to get parser for. :return function: Parser """ try: return { str: parse_str, bool: parse_bool, int: parse_int, tuple: parse_tuple, list: parse...
[ "Return", "appropriate", "parser", "for", "given", "type", "." ]
5monkeys/django-bananas
python
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/environment.py#L87-L104
[ "def", "get_parser", "(", "typ", ")", ":", "try", ":", "return", "{", "str", ":", "parse_str", ",", "bool", ":", "parse_bool", ",", "int", ":", "parse_int", ",", "tuple", ":", "parse_tuple", ",", "list", ":", "parse_list", ",", "set", ":", "parse_set",...
cfd318c737f6c4580036c13d2acf32bca96654bf
test
get_settings
Get and parse prefixed django settings from env. TODO: Implement support for complex settings DATABASES = {} CACHES = {} INSTALLED_APPS -> EXCLUDE_APPS ? :return dict:
bananas/environment.py
def get_settings(): """ Get and parse prefixed django settings from env. TODO: Implement support for complex settings DATABASES = {} CACHES = {} INSTALLED_APPS -> EXCLUDE_APPS ? :return dict: """ settings = {} prefix = environ.get("DJANGO_SETTINGS_PREFIX", "DJANGO_"...
def get_settings(): """ Get and parse prefixed django settings from env. TODO: Implement support for complex settings DATABASES = {} CACHES = {} INSTALLED_APPS -> EXCLUDE_APPS ? :return dict: """ settings = {} prefix = environ.get("DJANGO_SETTINGS_PREFIX", "DJANGO_"...
[ "Get", "and", "parse", "prefixed", "django", "settings", "from", "env", "." ]
5monkeys/django-bananas
python
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/environment.py#L107-L144
[ "def", "get_settings", "(", ")", ":", "settings", "=", "{", "}", "prefix", "=", "environ", ".", "get", "(", "\"DJANGO_SETTINGS_PREFIX\"", ",", "\"DJANGO_\"", ")", "for", "key", ",", "value", "in", "environ", ".", "items", "(", ")", ":", "_", ",", "_", ...
cfd318c737f6c4580036c13d2acf32bca96654bf
test
ModelDict.from_model
Work-in-progress constructor, consuming fields and values from django model instance.
bananas/models.py
def from_model(cls, model, *fields, **named_fields): """ Work-in-progress constructor, consuming fields and values from django model instance. """ d = ModelDict() if not (fields or named_fields): # Default to all fields fields = [f.attname for f i...
def from_model(cls, model, *fields, **named_fields): """ Work-in-progress constructor, consuming fields and values from django model instance. """ d = ModelDict() if not (fields or named_fields): # Default to all fields fields = [f.attname for f i...
[ "Work", "-", "in", "-", "progress", "constructor", "consuming", "fields", "and", "values", "from", "django", "model", "instance", "." ]
5monkeys/django-bananas
python
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/models.py#L83-L125
[ "def", "from_model", "(", "cls", ",", "model", ",", "*", "fields", ",", "*", "*", "named_fields", ")", ":", "d", "=", "ModelDict", "(", ")", "if", "not", "(", "fields", "or", "named_fields", ")", ":", "# Default to all fields", "fields", "=", "[", "f",...
cfd318c737f6c4580036c13d2acf32bca96654bf
test
URLSecretField.y64_encode
Implementation of Y64 non-standard URL-safe base64 variant. See http://en.wikipedia.org/wiki/Base64#Variants_summary_table :return: base64-encoded result with substituted ``{"+", "/", "="} => {".", "_", "-"}``.
bananas/models.py
def y64_encode(s): """ Implementation of Y64 non-standard URL-safe base64 variant. See http://en.wikipedia.org/wiki/Base64#Variants_summary_table :return: base64-encoded result with substituted ``{"+", "/", "="} => {".", "_", "-"}``. """ first_pass = base64.urls...
def y64_encode(s): """ Implementation of Y64 non-standard URL-safe base64 variant. See http://en.wikipedia.org/wiki/Base64#Variants_summary_table :return: base64-encoded result with substituted ``{"+", "/", "="} => {".", "_", "-"}``. """ first_pass = base64.urls...
[ "Implementation", "of", "Y64", "non", "-", "standard", "URL", "-", "safe", "base64", "variant", "." ]
5monkeys/django-bananas
python
https://github.com/5monkeys/django-bananas/blob/cfd318c737f6c4580036c13d2acf32bca96654bf/bananas/models.py#L247-L257
[ "def", "y64_encode", "(", "s", ")", ":", "first_pass", "=", "base64", ".", "urlsafe_b64encode", "(", "s", ")", "return", "first_pass", ".", "translate", "(", "bytes", ".", "maketrans", "(", "b\"+/=\"", ",", "b\"._-\"", ")", ")" ]
cfd318c737f6c4580036c13d2acf32bca96654bf
test
create_field
Create a field by field info dict.
validator/fields.py
def create_field(field_info): """ Create a field by field info dict. """ field_type = field_info.get('type') if field_type not in FIELDS_NAME_MAP: raise ValueError(_('not support this field: {}').format(field_type)) field_class = FIELDS_NAME_MAP.get(field_type) params = dict(field_in...
def create_field(field_info): """ Create a field by field info dict. """ field_type = field_info.get('type') if field_type not in FIELDS_NAME_MAP: raise ValueError(_('not support this field: {}').format(field_type)) field_class = FIELDS_NAME_MAP.get(field_type) params = dict(field_in...
[ "Create", "a", "field", "by", "field", "info", "dict", "." ]
ausaki/python-validator
python
https://github.com/ausaki/python-validator/blob/a3e591b1eae6d7a70f894c203dbd7195f929baa8/validator/fields.py#L29-L39
[ "def", "create_field", "(", "field_info", ")", ":", "field_type", "=", "field_info", ".", "get", "(", "'type'", ")", "if", "field_type", "not", "in", "FIELDS_NAME_MAP", ":", "raise", "ValueError", "(", "_", "(", "'not support this field: {}'", ")", ".", "forma...
a3e591b1eae6d7a70f894c203dbd7195f929baa8
test
create_validator
create a Validator instance from data_struct_dict :param data_struct_dict: a dict describe validator's fields, like the dict `to_dict()` method returned. :param name: name of Validator class :return: Validator instance
validator/validator.py
def create_validator(data_struct_dict, name=None): """ create a Validator instance from data_struct_dict :param data_struct_dict: a dict describe validator's fields, like the dict `to_dict()` method returned. :param name: name of Validator class :return: Validator instance """ if name is...
def create_validator(data_struct_dict, name=None): """ create a Validator instance from data_struct_dict :param data_struct_dict: a dict describe validator's fields, like the dict `to_dict()` method returned. :param name: name of Validator class :return: Validator instance """ if name is...
[ "create", "a", "Validator", "instance", "from", "data_struct_dict" ]
ausaki/python-validator
python
https://github.com/ausaki/python-validator/blob/a3e591b1eae6d7a70f894c203dbd7195f929baa8/validator/validator.py#L138-L157
[ "def", "create_validator", "(", "data_struct_dict", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "'FromDictValidator'", "attrs", "=", "{", "}", "for", "field_name", ",", "field_info", "in", "six", ".", "iteritems", "(",...
a3e591b1eae6d7a70f894c203dbd7195f929baa8
test
cartesian_product
Generates a Cartesian product of the input parameter dictionary. For example: >>> print cartesian_product({'param1':[1,2,3], 'param2':[42.0, 52.5]}) {'param1':[1,1,2,2,3,3],'param2': [42.0,52.5,42.0,52.5,42.0,52.5]} :param parameter_dict: Dictionary containing parameter names as keys and ite...
pypet/utils/explore.py
def cartesian_product(parameter_dict, combined_parameters=()): """ Generates a Cartesian product of the input parameter dictionary. For example: >>> print cartesian_product({'param1':[1,2,3], 'param2':[42.0, 52.5]}) {'param1':[1,1,2,2,3,3],'param2': [42.0,52.5,42.0,52.5,42.0,52.5]} :param paramet...
def cartesian_product(parameter_dict, combined_parameters=()): """ Generates a Cartesian product of the input parameter dictionary. For example: >>> print cartesian_product({'param1':[1,2,3], 'param2':[42.0, 52.5]}) {'param1':[1,1,2,2,3,3],'param2': [42.0,52.5,42.0,52.5,42.0,52.5]} :param paramet...
[ "Generates", "a", "Cartesian", "product", "of", "the", "input", "parameter", "dictionary", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/explore.py#L9-L63
[ "def", "cartesian_product", "(", "parameter_dict", ",", "combined_parameters", "=", "(", ")", ")", ":", "if", "not", "combined_parameters", ":", "combined_parameters", "=", "list", "(", "parameter_dict", ")", "else", ":", "combined_parameters", "=", "list", "(", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
find_unique_points
Takes a list of explored parameters and finds unique parameter combinations. If parameter ranges are hashable operates in O(N), otherwise O(N**2). :param explored_parameters: List of **explored** parameters :return: List of tuples, first entry being the parameter values, second entry a ...
pypet/utils/explore.py
def find_unique_points(explored_parameters): """Takes a list of explored parameters and finds unique parameter combinations. If parameter ranges are hashable operates in O(N), otherwise O(N**2). :param explored_parameters: List of **explored** parameters :return: List of tuples, fir...
def find_unique_points(explored_parameters): """Takes a list of explored parameters and finds unique parameter combinations. If parameter ranges are hashable operates in O(N), otherwise O(N**2). :param explored_parameters: List of **explored** parameters :return: List of tuples, fir...
[ "Takes", "a", "list", "of", "explored", "parameters", "and", "finds", "unique", "parameter", "combinations", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/explore.py#L66-L108
[ "def", "find_unique_points", "(", "explored_parameters", ")", ":", "ranges", "=", "[", "param", ".", "f_get_range", "(", "copy", "=", "False", ")", "for", "param", "in", "explored_parameters", "]", "zipped_tuples", "=", "list", "(", "zip", "(", "*", "ranges"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_change_logging_kwargs
Helper function to turn the simple logging kwargs into a `log_config`.
pypet/pypetlogging.py
def _change_logging_kwargs(kwargs): """ Helper function to turn the simple logging kwargs into a `log_config`.""" log_levels = kwargs.pop('log_level', None) log_folder = kwargs.pop('log_folder', 'logs') logger_names = kwargs.pop('logger_names', '') if log_levels is None: log_levels = kwargs....
def _change_logging_kwargs(kwargs): """ Helper function to turn the simple logging kwargs into a `log_config`.""" log_levels = kwargs.pop('log_level', None) log_folder = kwargs.pop('log_folder', 'logs') logger_names = kwargs.pop('logger_names', '') if log_levels is None: log_levels = kwargs....
[ "Helper", "function", "to", "turn", "the", "simple", "logging", "kwargs", "into", "a", "log_config", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L105-L146
[ "def", "_change_logging_kwargs", "(", "kwargs", ")", ":", "log_levels", "=", "kwargs", ".", "pop", "(", "'log_level'", ",", "None", ")", "log_folder", "=", "kwargs", ".", "pop", "(", "'log_folder'", ",", "'logs'", ")", "logger_names", "=", "kwargs", ".", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
simple_logging_config
Decorator to allow a simple logging configuration. This encompasses giving a `log_folder`, `logger_names` as well as `log_levels`.
pypet/pypetlogging.py
def simple_logging_config(func): """Decorator to allow a simple logging configuration. This encompasses giving a `log_folder`, `logger_names` as well as `log_levels`. """ @functools.wraps(func) def new_func(self, *args, **kwargs): if use_simple_logging(kwargs): if 'log_config'...
def simple_logging_config(func): """Decorator to allow a simple logging configuration. This encompasses giving a `log_folder`, `logger_names` as well as `log_levels`. """ @functools.wraps(func) def new_func(self, *args, **kwargs): if use_simple_logging(kwargs): if 'log_config'...
[ "Decorator", "to", "allow", "a", "simple", "logging", "configuration", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L155-L174
[ "def", "simple_logging_config", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "use_simple_logging", "(", "kwargs", ")", ":", "if", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
try_make_dirs
Tries to make directories for a given `filename`. Ignores any error but notifies via stderr.
pypet/pypetlogging.py
def try_make_dirs(filename): """ Tries to make directories for a given `filename`. Ignores any error but notifies via stderr. """ try: dirname = os.path.dirname(os.path.normpath(filename)) racedirs(dirname) except Exception as exc: sys.stderr.write('ERROR during log config ...
def try_make_dirs(filename): """ Tries to make directories for a given `filename`. Ignores any error but notifies via stderr. """ try: dirname = os.path.dirname(os.path.normpath(filename)) racedirs(dirname) except Exception as exc: sys.stderr.write('ERROR during log config ...
[ "Tries", "to", "make", "directories", "for", "a", "given", "filename", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L177-L188
[ "def", "try_make_dirs", "(", "filename", ")", ":", "try", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "normpath", "(", "filename", ")", ")", "racedirs", "(", "dirname", ")", "except", "Exception", "as", "exc", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
get_strings
Returns all valid python strings inside a given argument string.
pypet/pypetlogging.py
def get_strings(args): """Returns all valid python strings inside a given argument string.""" string_list = [] for elem in ast.walk(ast.parse(args)): if isinstance(elem, ast.Str): string_list.append(elem.s) return string_list
def get_strings(args): """Returns all valid python strings inside a given argument string.""" string_list = [] for elem in ast.walk(ast.parse(args)): if isinstance(elem, ast.Str): string_list.append(elem.s) return string_list
[ "Returns", "all", "valid", "python", "strings", "inside", "a", "given", "argument", "string", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L191-L197
[ "def", "get_strings", "(", "args", ")", ":", "string_list", "=", "[", "]", "for", "elem", "in", "ast", ".", "walk", "(", "ast", ".", "parse", "(", "args", ")", ")", ":", "if", "isinstance", "(", "elem", ",", "ast", ".", "Str", ")", ":", "string_l...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
rename_log_file
Renames a given `filename` with valid wildcard placements. :const:`~pypet.pypetconstants.LOG_ENV` ($env) is replaces by the name of the trajectory`s environment. :const:`~pypet.pypetconstants.LOG_TRAJ` ($traj) is replaced by the name of the trajectory. :const:`~pypet.pypetconstants.LOG_RUN` ($run...
pypet/pypetlogging.py
def rename_log_file(filename, trajectory=None, env_name=None, traj_name=None, set_name=None, run_name=None, process_name=None, host_name=None): """ Renames a given `filename` with valid wildcard p...
def rename_log_file(filename, trajectory=None, env_name=None, traj_name=None, set_name=None, run_name=None, process_name=None, host_name=None): """ Renames a given `filename` with valid wildcard p...
[ "Renames", "a", "given", "filename", "with", "valid", "wildcard", "placements", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L200-L268
[ "def", "rename_log_file", "(", "filename", ",", "trajectory", "=", "None", ",", "env_name", "=", "None", ",", "traj_name", "=", "None", ",", "set_name", "=", "None", ",", "run_name", "=", "None", ",", "process_name", "=", "None", ",", "host_name", "=", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
HasLogger._set_logger
Adds a logger with a given `name`. If no name is given, name is constructed as `type(self).__name__`.
pypet/pypetlogging.py
def _set_logger(self, name=None): """Adds a logger with a given `name`. If no name is given, name is constructed as `type(self).__name__`. """ if name is None: cls = self.__class__ name = '%s.%s' % (cls.__module__, cls.__name__) self._logger = lo...
def _set_logger(self, name=None): """Adds a logger with a given `name`. If no name is given, name is constructed as `type(self).__name__`. """ if name is None: cls = self.__class__ name = '%s.%s' % (cls.__module__, cls.__name__) self._logger = lo...
[ "Adds", "a", "logger", "with", "a", "given", "name", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L311-L321
[ "def", "_set_logger", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "cls", "=", "self", ".", "__class__", "name", "=", "'%s.%s'", "%", "(", "cls", ".", "__module__", ",", "cls", ".", "__name__", ")", "self", ".",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager.extract_replacements
Extracts the wildcards and file replacements from the `trajectory`
pypet/pypetlogging.py
def extract_replacements(self, trajectory): """Extracts the wildcards and file replacements from the `trajectory`""" self.env_name = trajectory.v_environment_name self.traj_name = trajectory.v_name self.set_name = trajectory.f_wildcard('$set') self.run_name = trajectory.f_wildca...
def extract_replacements(self, trajectory): """Extracts the wildcards and file replacements from the `trajectory`""" self.env_name = trajectory.v_environment_name self.traj_name = trajectory.v_name self.set_name = trajectory.f_wildcard('$set') self.run_name = trajectory.f_wildca...
[ "Extracts", "the", "wildcards", "and", "file", "replacements", "from", "the", "trajectory" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L359-L364
[ "def", "extract_replacements", "(", "self", ",", "trajectory", ")", ":", "self", ".", "env_name", "=", "trajectory", ".", "v_environment_name", "self", ".", "traj_name", "=", "trajectory", ".", "v_name", "self", ".", "set_name", "=", "trajectory", ".", "f_wild...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager.show_progress
Displays a progressbar
pypet/pypetlogging.py
def show_progress(self, n, total_runs): """Displays a progressbar""" if self.report_progress: percentage, logger_name, log_level = self.report_progress if logger_name == 'print': logger = 'print' else: logger = logging.getLogger(logger_...
def show_progress(self, n, total_runs): """Displays a progressbar""" if self.report_progress: percentage, logger_name, log_level = self.report_progress if logger_name == 'print': logger = 'print' else: logger = logging.getLogger(logger_...
[ "Displays", "a", "progressbar" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L375-L393
[ "def", "show_progress", "(", "self", ",", "n", ",", "total_runs", ")", ":", "if", "self", ".", "report_progress", ":", "percentage", ",", "logger_name", ",", "log_level", "=", "self", ".", "report_progress", "if", "logger_name", "==", "'print'", ":", "logger...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._check_and_replace_parser_args
Searches for parser settings that define filenames. If such settings are found, they are renamed according to the wildcard rules. Moreover, it is also tried to create the corresponding folders. :param parser: A config parser :param section: A config section :param option: The ...
pypet/pypetlogging.py
def _check_and_replace_parser_args(parser, section, option, rename_func, make_dirs=True): """ Searches for parser settings that define filenames. If such settings are found, they are renamed according to the wildcard rules. Moreover, it is also tried to create the corresponding folders. ...
def _check_and_replace_parser_args(parser, section, option, rename_func, make_dirs=True): """ Searches for parser settings that define filenames. If such settings are found, they are renamed according to the wildcard rules. Moreover, it is also tried to create the corresponding folders. ...
[ "Searches", "for", "parser", "settings", "that", "define", "filenames", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L417-L445
[ "def", "_check_and_replace_parser_args", "(", "parser", ",", "section", ",", "option", ",", "rename_func", ",", "make_dirs", "=", "True", ")", ":", "args", "=", "parser", ".", "get", "(", "section", ",", "option", ",", "raw", "=", "True", ")", "strings", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._parser_to_string_io
Turns a ConfigParser into a StringIO stream.
pypet/pypetlogging.py
def _parser_to_string_io(parser): """Turns a ConfigParser into a StringIO stream.""" memory_file = StringIO() parser.write(memory_file) memory_file.flush() memory_file.seek(0) return memory_file
def _parser_to_string_io(parser): """Turns a ConfigParser into a StringIO stream.""" memory_file = StringIO() parser.write(memory_file) memory_file.flush() memory_file.seek(0) return memory_file
[ "Turns", "a", "ConfigParser", "into", "a", "StringIO", "stream", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L448-L454
[ "def", "_parser_to_string_io", "(", "parser", ")", ":", "memory_file", "=", "StringIO", "(", ")", "parser", ".", "write", "(", "memory_file", ")", "memory_file", ".", "flush", "(", ")", "memory_file", ".", "seek", "(", "0", ")", "return", "memory_file" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._find_multiproc_options
Searches for multiprocessing options within a ConfigParser. If such options are found, they are copied (without the `'multiproc_'` prefix) into a new parser.
pypet/pypetlogging.py
def _find_multiproc_options(parser): """ Searches for multiprocessing options within a ConfigParser. If such options are found, they are copied (without the `'multiproc_'` prefix) into a new parser. """ sections = parser.sections() if not any(section.startswith('multipr...
def _find_multiproc_options(parser): """ Searches for multiprocessing options within a ConfigParser. If such options are found, they are copied (without the `'multiproc_'` prefix) into a new parser. """ sections = parser.sections() if not any(section.startswith('multipr...
[ "Searches", "for", "multiprocessing", "options", "within", "a", "ConfigParser", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L457-L476
[ "def", "_find_multiproc_options", "(", "parser", ")", ":", "sections", "=", "parser", ".", "sections", "(", ")", "if", "not", "any", "(", "section", ".", "startswith", "(", "'multiproc_'", ")", "for", "section", "in", "sections", ")", ":", "return", "None"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._find_multiproc_dict
Searches for multiprocessing options in a given `dictionary`. If found they are copied (without the `'multiproc_'` prefix) into a new dictionary
pypet/pypetlogging.py
def _find_multiproc_dict(dictionary): """ Searches for multiprocessing options in a given `dictionary`. If found they are copied (without the `'multiproc_'` prefix) into a new dictionary """ if not any(key.startswith('multiproc_') for key in dictionary.keys()): retu...
def _find_multiproc_dict(dictionary): """ Searches for multiprocessing options in a given `dictionary`. If found they are copied (without the `'multiproc_'` prefix) into a new dictionary """ if not any(key.startswith('multiproc_') for key in dictionary.keys()): retu...
[ "Searches", "for", "multiprocessing", "options", "in", "a", "given", "dictionary", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L479-L496
[ "def", "_find_multiproc_dict", "(", "dictionary", ")", ":", "if", "not", "any", "(", "key", ".", "startswith", "(", "'multiproc_'", ")", "for", "key", "in", "dictionary", ".", "keys", "(", ")", ")", ":", "return", "None", "mp_dictionary", "=", "{", "}", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager.check_log_config
Checks and converts all settings if necessary passed to the Manager. Searches for multiprocessing options as well.
pypet/pypetlogging.py
def check_log_config(self): """ Checks and converts all settings if necessary passed to the Manager. Searches for multiprocessing options as well. """ if self.report_progress: if self.report_progress is True: self.report_progress = (5, 'pypet', logging.INFO)...
def check_log_config(self): """ Checks and converts all settings if necessary passed to the Manager. Searches for multiprocessing options as well. """ if self.report_progress: if self.report_progress is True: self.report_progress = (5, 'pypet', logging.INFO)...
[ "Checks", "and", "converts", "all", "settings", "if", "necessary", "passed", "to", "the", "Manager", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L498-L548
[ "def", "check_log_config", "(", "self", ")", ":", "if", "self", ".", "report_progress", ":", "if", "self", ".", "report_progress", "is", "True", ":", "self", ".", "report_progress", "=", "(", "5", ",", "'pypet'", ",", "logging", ".", "INFO", ")", "elif",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._handle_config_parsing
Checks for filenames within a config file and translates them. Moreover, directories for the files are created as well. :param log_config: Config file as a stream (like StringIO)
pypet/pypetlogging.py
def _handle_config_parsing(self, log_config): """ Checks for filenames within a config file and translates them. Moreover, directories for the files are created as well. :param log_config: Config file as a stream (like StringIO) """ parser = NoInterpolationParser() par...
def _handle_config_parsing(self, log_config): """ Checks for filenames within a config file and translates them. Moreover, directories for the files are created as well. :param log_config: Config file as a stream (like StringIO) """ parser = NoInterpolationParser() par...
[ "Checks", "for", "filenames", "within", "a", "config", "file", "and", "translates", "them", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L550-L574
[ "def", "_handle_config_parsing", "(", "self", ",", "log_config", ")", ":", "parser", "=", "NoInterpolationParser", "(", ")", "parser", ".", "readfp", "(", "log_config", ")", "rename_func", "=", "lambda", "string", ":", "rename_log_file", "(", "string", ",", "e...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager._handle_dict_config
Recursively walks and copies the `log_config` dict and searches for filenames. Translates filenames and creates directories if necessary.
pypet/pypetlogging.py
def _handle_dict_config(self, log_config): """Recursively walks and copies the `log_config` dict and searches for filenames. Translates filenames and creates directories if necessary. """ new_dict = dict() for key in log_config.keys(): if key == 'filename': ...
def _handle_dict_config(self, log_config): """Recursively walks and copies the `log_config` dict and searches for filenames. Translates filenames and creates directories if necessary. """ new_dict = dict() for key in log_config.keys(): if key == 'filename': ...
[ "Recursively", "walks", "and", "copies", "the", "log_config", "dict", "and", "searches", "for", "filenames", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L576-L598
[ "def", "_handle_dict_config", "(", "self", ",", "log_config", ")", ":", "new_dict", "=", "dict", "(", ")", "for", "key", "in", "log_config", ".", "keys", "(", ")", ":", "if", "key", "==", "'filename'", ":", "filename", "=", "log_config", "[", "key", "]...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager.make_logging_handlers_and_tools
Creates logging handlers and redirects stdout.
pypet/pypetlogging.py
def make_logging_handlers_and_tools(self, multiproc=False): """Creates logging handlers and redirects stdout.""" log_stdout = self.log_stdout if sys.stdout is self._stdout_to_logger: # If we already redirected stdout we don't neet to redo it again log_stdout = False ...
def make_logging_handlers_and_tools(self, multiproc=False): """Creates logging handlers and redirects stdout.""" log_stdout = self.log_stdout if sys.stdout is self._stdout_to_logger: # If we already redirected stdout we don't neet to redo it again log_stdout = False ...
[ "Creates", "logging", "handlers", "and", "redirects", "stdout", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L600-L629
[ "def", "make_logging_handlers_and_tools", "(", "self", ",", "multiproc", "=", "False", ")", ":", "log_stdout", "=", "self", ".", "log_stdout", "if", "sys", ".", "stdout", "is", "self", ".", "_stdout_to_logger", ":", "# If we already redirected stdout we don't neet to ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
LoggingManager.finalize
Finalizes the manager, closes and removes all handlers if desired.
pypet/pypetlogging.py
def finalize(self, remove_all_handlers=True): """Finalizes the manager, closes and removes all handlers if desired.""" for tool in self._tools: tool.finalize() self._tools = [] self._stdout_to_logger = None for config in (self._sp_config, self._mp_config): ...
def finalize(self, remove_all_handlers=True): """Finalizes the manager, closes and removes all handlers if desired.""" for tool in self._tools: tool.finalize() self._tools = [] self._stdout_to_logger = None for config in (self._sp_config, self._mp_config): ...
[ "Finalizes", "the", "manager", "closes", "and", "removes", "all", "handlers", "if", "desired", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L631-L643
[ "def", "finalize", "(", "self", ",", "remove_all_handlers", "=", "True", ")", ":", "for", "tool", "in", "self", ".", "_tools", ":", "tool", ".", "finalize", "(", ")", "self", ".", "_tools", "=", "[", "]", "self", ".", "_stdout_to_logger", "=", "None", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
StdoutToLogger.start
Starts redirection of `stdout`
pypet/pypetlogging.py
def start(self): """Starts redirection of `stdout`""" if sys.stdout is not self: self._original_steam = sys.stdout sys.stdout = self self._redirection = True if self._redirection: print('Established redirection of `stdout`.')
def start(self): """Starts redirection of `stdout`""" if sys.stdout is not self: self._original_steam = sys.stdout sys.stdout = self self._redirection = True if self._redirection: print('Established redirection of `stdout`.')
[ "Starts", "redirection", "of", "stdout" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L684-L691
[ "def", "start", "(", "self", ")", ":", "if", "sys", ".", "stdout", "is", "not", "self", ":", "self", ".", "_original_steam", "=", "sys", ".", "stdout", "sys", ".", "stdout", "=", "self", "self", ".", "_redirection", "=", "True", "if", "self", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
StdoutToLogger.write
Writes data from buffer to logger
pypet/pypetlogging.py
def write(self, buf): """Writes data from buffer to logger""" if not self._recursion: self._recursion = True try: for line in buf.rstrip().splitlines(): self._logger.log(self._log_level, line.rstrip()) finally: self....
def write(self, buf): """Writes data from buffer to logger""" if not self._recursion: self._recursion = True try: for line in buf.rstrip().splitlines(): self._logger.log(self._log_level, line.rstrip()) finally: self....
[ "Writes", "data", "from", "buffer", "to", "logger" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L693-L704
[ "def", "write", "(", "self", ",", "buf", ")", ":", "if", "not", "self", ".", "_recursion", ":", "self", ".", "_recursion", "=", "True", "try", ":", "for", "line", "in", "buf", ".", "rstrip", "(", ")", ".", "splitlines", "(", ")", ":", "self", "."...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
StdoutToLogger.finalize
Disables redirection
pypet/pypetlogging.py
def finalize(self): """Disables redirection""" if self._original_steam is not None and self._redirection: sys.stdout = self._original_steam print('Disabled redirection of `stdout`.') self._redirection = False self._original_steam = None
def finalize(self): """Disables redirection""" if self._original_steam is not None and self._redirection: sys.stdout = self._original_steam print('Disabled redirection of `stdout`.') self._redirection = False self._original_steam = None
[ "Disables", "redirection" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/pypetlogging.py#L710-L716
[ "def", "finalize", "(", "self", ")", ":", "if", "self", ".", "_original_steam", "is", "not", "None", "and", "self", ".", "_redirection", ":", "sys", ".", "stdout", "=", "self", ".", "_original_steam", "print", "(", "'Disabled redirection of `stdout`.'", ")", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
results_equal
Compares two result instances Checks full name and all data. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no result instances
pypet/utils/comparisons.py
def results_equal(a, b): """Compares two result instances Checks full name and all data. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no result instances """ if a.v_is_parameter and b.v_is_parameter: raise ValueError('Both inputs are no...
def results_equal(a, b): """Compares two result instances Checks full name and all data. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no result instances """ if a.v_is_parameter and b.v_is_parameter: raise ValueError('Both inputs are no...
[ "Compares", "two", "result", "instances" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/comparisons.py#L14-L50
[ "def", "results_equal", "(", "a", ",", "b", ")", ":", "if", "a", ".", "v_is_parameter", "and", "b", ".", "v_is_parameter", ":", "raise", "ValueError", "(", "'Both inputs are not results.'", ")", "if", "a", ".", "v_is_parameter", "or", "b", ".", "v_is_paramet...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
parameters_equal
Compares two parameter instances Checks full name, data, and ranges. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no parameter instances
pypet/utils/comparisons.py
def parameters_equal(a, b): """Compares two parameter instances Checks full name, data, and ranges. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no parameter instances """ if (not b.v_is_parameter and not a.v_is_parameter): ...
def parameters_equal(a, b): """Compares two parameter instances Checks full name, data, and ranges. Does not consider the comment. :return: True or False :raises: ValueError if both inputs are no parameter instances """ if (not b.v_is_parameter and not a.v_is_parameter): ...
[ "Compares", "two", "parameter", "instances" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/comparisons.py#L53-L99
[ "def", "parameters_equal", "(", "a", ",", "b", ")", ":", "if", "(", "not", "b", ".", "v_is_parameter", "and", "not", "a", ".", "v_is_parameter", ")", ":", "raise", "ValueError", "(", "'Both inputs are not parameters'", ")", "if", "(", "not", "b", ".", "v...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
get_all_attributes
Returns an attribute value dictionary much like `__dict__` but incorporates `__slots__`
pypet/utils/comparisons.py
def get_all_attributes(instance): """Returns an attribute value dictionary much like `__dict__` but incorporates `__slots__`""" try: result_dict = instance.__dict__.copy() except AttributeError: result_dict = {} if hasattr(instance, '__all_slots__'): all_slots = instance.__all_s...
def get_all_attributes(instance): """Returns an attribute value dictionary much like `__dict__` but incorporates `__slots__`""" try: result_dict = instance.__dict__.copy() except AttributeError: result_dict = {} if hasattr(instance, '__all_slots__'): all_slots = instance.__all_s...
[ "Returns", "an", "attribute", "value", "dictionary", "much", "like", "__dict__", "but", "incorporates", "__slots__" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/comparisons.py#L102-L120
[ "def", "get_all_attributes", "(", "instance", ")", ":", "try", ":", "result_dict", "=", "instance", ".", "__dict__", ".", "copy", "(", ")", "except", "AttributeError", ":", "result_dict", "=", "{", "}", "if", "hasattr", "(", "instance", ",", "'__all_slots__'...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
nested_equal
Compares two objects recursively by their elements. Also handles numpy arrays, pandas data and sparse matrices. First checks if the data falls into the above categories. If not, it is checked if a or b are some type of sequence or mapping and the contained elements are compared. If this is not the...
pypet/utils/comparisons.py
def nested_equal(a, b): """Compares two objects recursively by their elements. Also handles numpy arrays, pandas data and sparse matrices. First checks if the data falls into the above categories. If not, it is checked if a or b are some type of sequence or mapping and the contained elements are c...
def nested_equal(a, b): """Compares two objects recursively by their elements. Also handles numpy arrays, pandas data and sparse matrices. First checks if the data falls into the above categories. If not, it is checked if a or b are some type of sequence or mapping and the contained elements are c...
[ "Compares", "two", "objects", "recursively", "by", "their", "elements", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/comparisons.py#L123-L275
[ "def", "nested_equal", "(", "a", ",", "b", ")", ":", "if", "a", "is", "b", ":", "return", "True", "if", "a", "is", "None", "or", "b", "is", "None", ":", "return", "False", "a_sparse", "=", "spsp", ".", "isspmatrix", "(", "a", ")", "b_sparse", "="...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
manual_run
Can be used to decorate a function as a manual run function. This can be helpful if you want the run functionality without using an environment. :param turn_into_run: If the trajectory should become a `single run` with more specialized functionality during a single run. :param store_meta...
pypet/utils/decorators.py
def manual_run(turn_into_run=True, store_meta_data=True, clean_up=True): """Can be used to decorate a function as a manual run function. This can be helpful if you want the run functionality without using an environment. :param turn_into_run: If the trajectory should become a `single run` with mo...
def manual_run(turn_into_run=True, store_meta_data=True, clean_up=True): """Can be used to decorate a function as a manual run function. This can be helpful if you want the run functionality without using an environment. :param turn_into_run: If the trajectory should become a `single run` with mo...
[ "Can", "be", "used", "to", "decorate", "a", "function", "as", "a", "manual", "run", "function", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L11-L45
[ "def", "manual_run", "(", "turn_into_run", "=", "True", ",", "store_meta_data", "=", "True", ",", "clean_up", "=", "True", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "tra...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
deprecated
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. :param msg: Additional message added to the warning.
pypet/utils/decorators.py
def deprecated(msg=''): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. :param msg: Additional message added to the warning. """ def wrapper(func): @functools.wraps(func) de...
def deprecated(msg=''): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. :param msg: Additional message added to the warning. """ def wrapper(func): @functools.wraps(func) de...
[ "This", "is", "a", "decorator", "which", "can", "be", "used", "to", "mark", "functions", "as", "deprecated", ".", "It", "will", "result", "in", "a", "warning", "being", "emitted", "when", "the", "function", "is", "used", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L48-L72
[ "def", "deprecated", "(", "msg", "=", "''", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "warning_string", "=", "\"Call ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
copydoc
Decorator: Copy the docstring of `fromfunc` If the doc contains a line with the keyword `ABSTRACT`, like `ABSTRACT: Needs to be defined in subclass`, this line and the line after are removed.
pypet/utils/decorators.py
def copydoc(fromfunc, sep="\n"): """Decorator: Copy the docstring of `fromfunc` If the doc contains a line with the keyword `ABSTRACT`, like `ABSTRACT: Needs to be defined in subclass`, this line and the line after are removed. """ def _decorator(func): sourcedoc = fromfunc.__doc__ ...
def copydoc(fromfunc, sep="\n"): """Decorator: Copy the docstring of `fromfunc` If the doc contains a line with the keyword `ABSTRACT`, like `ABSTRACT: Needs to be defined in subclass`, this line and the line after are removed. """ def _decorator(func): sourcedoc = fromfunc.__doc__ ...
[ "Decorator", ":", "Copy", "the", "docstring", "of", "fromfunc" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L75-L102
[ "def", "copydoc", "(", "fromfunc", ",", "sep", "=", "\"\\n\"", ")", ":", "def", "_decorator", "(", "func", ")", ":", "sourcedoc", "=", "fromfunc", ".", "__doc__", "# Remove the ABSTRACT line:", "split_doc", "=", "sourcedoc", ".", "split", "(", "'\\n'", ")", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
kwargs_mutual_exclusive
If there exist mutually exclusive parameters checks for them and maps param2 to 1.
pypet/utils/decorators.py
def kwargs_mutual_exclusive(param1_name, param2_name, map2to1=None): """ If there exist mutually exclusive parameters checks for them and maps param2 to 1.""" def wrapper(func): @functools.wraps(func) def new_func(*args, **kwargs): if param2_name in kwargs: if param1_...
def kwargs_mutual_exclusive(param1_name, param2_name, map2to1=None): """ If there exist mutually exclusive parameters checks for them and maps param2 to 1.""" def wrapper(func): @functools.wraps(func) def new_func(*args, **kwargs): if param2_name in kwargs: if param1_...
[ "If", "there", "exist", "mutually", "exclusive", "parameters", "checks", "for", "them", "and", "maps", "param2", "to", "1", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L105-L125
[ "def", "kwargs_mutual_exclusive", "(", "param1_name", ",", "param2_name", ",", "map2to1", "=", "None", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ",", "*", "...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
kwargs_api_change
This is a decorator which can be used if a kwarg has changed its name over versions to also support the old argument name. Issues a warning if the old keyword argument is detected and converts call to new API. :param old_name: Old name of the keyword argument :param new_name: Ne...
pypet/utils/decorators.py
def kwargs_api_change(old_name, new_name=None): """This is a decorator which can be used if a kwarg has changed its name over versions to also support the old argument name. Issues a warning if the old keyword argument is detected and converts call to new API. :param old_name: Old name of...
def kwargs_api_change(old_name, new_name=None): """This is a decorator which can be used if a kwarg has changed its name over versions to also support the old argument name. Issues a warning if the old keyword argument is detected and converts call to new API. :param old_name: Old name of...
[ "This", "is", "a", "decorator", "which", "can", "be", "used", "if", "a", "kwarg", "has", "changed", "its", "name", "over", "versions", "to", "also", "support", "the", "old", "argument", "name", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L128-L167
[ "def", "kwargs_api_change", "(", "old_name", ",", "new_name", "=", "None", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
not_in_run
This is a decorator that signaling that a function is not available during a single run.
pypet/utils/decorators.py
def not_in_run(func): """This is a decorator that signaling that a function is not available during a single run. """ doc = func.__doc__ na_string = '''\nATTENTION: This function is not available during a single run!\n''' if doc is not None: func.__doc__ = '\n'.join([doc, na_string]) f...
def not_in_run(func): """This is a decorator that signaling that a function is not available during a single run. """ doc = func.__doc__ na_string = '''\nATTENTION: This function is not available during a single run!\n''' if doc is not None: func.__doc__ = '\n'.join([doc, na_string]) f...
[ "This", "is", "a", "decorator", "that", "signaling", "that", "a", "function", "is", "not", "available", "during", "a", "single", "run", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L170-L190
[ "def", "not_in_run", "(", "func", ")", ":", "doc", "=", "func", ".", "__doc__", "na_string", "=", "'''\\nATTENTION: This function is not available during a single run!\\n'''", "if", "doc", "is", "not", "None", ":", "func", ".", "__doc__", "=", "'\\n'", ".", "join"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
with_open_store
This is a decorator that signaling that a function is only available if the storage is open.
pypet/utils/decorators.py
def with_open_store(func): """This is a decorator that signaling that a function is only available if the storage is open. """ doc = func.__doc__ na_string = '''\nATTENTION: This function can only be used if the store is open!\n''' if doc is not None: func.__doc__ = '\n'.join([doc, na_stri...
def with_open_store(func): """This is a decorator that signaling that a function is only available if the storage is open. """ doc = func.__doc__ na_string = '''\nATTENTION: This function can only be used if the store is open!\n''' if doc is not None: func.__doc__ = '\n'.join([doc, na_stri...
[ "This", "is", "a", "decorator", "that", "signaling", "that", "a", "function", "is", "only", "available", "if", "the", "storage", "is", "open", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L193-L213
[ "def", "with_open_store", "(", "func", ")", ":", "doc", "=", "func", ".", "__doc__", "na_string", "=", "'''\\nATTENTION: This function can only be used if the store is open!\\n'''", "if", "doc", "is", "not", "None", ":", "func", ".", "__doc__", "=", "'\\n'", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
retry
This is a decorator that retries a function. Tries `n` times and catches a given tuple of `errors`. If the `n` retries are not enough, the error is reraised. If desired `waits` some seconds. Optionally takes a 'logger_name' of a given logger to print the caught error.
pypet/utils/decorators.py
def retry(n, errors, wait=0.0, logger_name=None): """This is a decorator that retries a function. Tries `n` times and catches a given tuple of `errors`. If the `n` retries are not enough, the error is reraised. If desired `waits` some seconds. Optionally takes a 'logger_name' of a given logger t...
def retry(n, errors, wait=0.0, logger_name=None): """This is a decorator that retries a function. Tries `n` times and catches a given tuple of `errors`. If the `n` retries are not enough, the error is reraised. If desired `waits` some seconds. Optionally takes a 'logger_name' of a given logger t...
[ "This", "is", "a", "decorator", "that", "retries", "a", "function", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L216-L260
[ "def", "retry", "(", "n", ",", "errors", ",", "wait", "=", "0.0", ",", "logger_name", "=", "None", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "new_func", "(", "*", "args", ",", "*",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_prfx_getattr_
Replacement of __getattr__
pypet/utils/decorators.py
def _prfx_getattr_(obj, item): """Replacement of __getattr__""" if item.startswith('f_') or item.startswith('v_'): return getattr(obj, item[2:]) raise AttributeError('`%s` object has no attribute `%s`' % (obj.__class__.__name__, item))
def _prfx_getattr_(obj, item): """Replacement of __getattr__""" if item.startswith('f_') or item.startswith('v_'): return getattr(obj, item[2:]) raise AttributeError('`%s` object has no attribute `%s`' % (obj.__class__.__name__, item))
[ "Replacement", "of", "__getattr__" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L263-L267
[ "def", "_prfx_getattr_", "(", "obj", ",", "item", ")", ":", "if", "item", ".", "startswith", "(", "'f_'", ")", "or", "item", ".", "startswith", "(", "'v_'", ")", ":", "return", "getattr", "(", "obj", ",", "item", "[", "2", ":", "]", ")", "raise", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_prfx_setattr_
Replacement of __setattr__
pypet/utils/decorators.py
def _prfx_setattr_(obj, item, value): """Replacement of __setattr__""" if item.startswith('v_'): return setattr(obj, item[2:], value) else: return super(obj.__class__, obj).__setattr__(item, value)
def _prfx_setattr_(obj, item, value): """Replacement of __setattr__""" if item.startswith('v_'): return setattr(obj, item[2:], value) else: return super(obj.__class__, obj).__setattr__(item, value)
[ "Replacement", "of", "__setattr__" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L270-L275
[ "def", "_prfx_setattr_", "(", "obj", ",", "item", ",", "value", ")", ":", "if", "item", ".", "startswith", "(", "'v_'", ")", ":", "return", "setattr", "(", "obj", ",", "item", "[", "2", ":", "]", ",", "value", ")", "else", ":", "return", "super", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
prefix_naming
Decorate that adds the prefix naming scheme
pypet/utils/decorators.py
def prefix_naming(cls): """Decorate that adds the prefix naming scheme""" if hasattr(cls, '__getattr__'): raise TypeError('__getattr__ already defined') cls.__getattr__ = _prfx_getattr_ cls.__setattr__ = _prfx_setattr_ return cls
def prefix_naming(cls): """Decorate that adds the prefix naming scheme""" if hasattr(cls, '__getattr__'): raise TypeError('__getattr__ already defined') cls.__getattr__ = _prfx_getattr_ cls.__setattr__ = _prfx_setattr_ return cls
[ "Decorate", "that", "adds", "the", "prefix", "naming", "scheme" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/decorators.py#L278-L284
[ "def", "prefix_naming", "(", "cls", ")", ":", "if", "hasattr", "(", "cls", ",", "'__getattr__'", ")", ":", "raise", "TypeError", "(", "'__getattr__ already defined'", ")", "cls", ".", "__getattr__", "=", "_prfx_getattr_", "cls", ".", "__setattr__", "=", "_prfx...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
add_params
Adds all necessary parameters to `traj`.
examples/example_23_brian2_network.py
def add_params(traj): """Adds all necessary parameters to `traj`.""" # We set the BrianParameter to be the standard parameter traj.v_standard_parameter=Brian2Parameter traj.v_fast_access=True # Add parameters we need for our network traj.f_add_parameter('Net.C',281*pF) traj.f_add_parameter...
def add_params(traj): """Adds all necessary parameters to `traj`.""" # We set the BrianParameter to be the standard parameter traj.v_standard_parameter=Brian2Parameter traj.v_fast_access=True # Add parameters we need for our network traj.f_add_parameter('Net.C',281*pF) traj.f_add_parameter...
[ "Adds", "all", "necessary", "parameters", "to", "traj", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_23_brian2_network.py#L14-L40
[ "def", "add_params", "(", "traj", ")", ":", "# We set the BrianParameter to be the standard parameter", "traj", ".", "v_standard_parameter", "=", "Brian2Parameter", "traj", ".", "v_fast_access", "=", "True", "# Add parameters we need for our network", "traj", ".", "f_add_para...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
run_net
Creates and runs BRIAN network based on the parameters in `traj`.
examples/example_23_brian2_network.py
def run_net(traj): """Creates and runs BRIAN network based on the parameters in `traj`.""" eqs=traj.eqs # Create a namespace dictionairy namespace = traj.Net.f_to_dict(short_names=True, fast_access=True) # Create the Neuron Group neuron=NeuronGroup(traj.N, model=eqs, threshold=traj.Vcut, reset...
def run_net(traj): """Creates and runs BRIAN network based on the parameters in `traj`.""" eqs=traj.eqs # Create a namespace dictionairy namespace = traj.Net.f_to_dict(short_names=True, fast_access=True) # Create the Neuron Group neuron=NeuronGroup(traj.N, model=eqs, threshold=traj.Vcut, reset...
[ "Creates", "and", "runs", "BRIAN", "network", "based", "on", "the", "parameters", "in", "traj", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_23_brian2_network.py#L43-L76
[ "def", "run_net", "(", "traj", ")", ":", "eqs", "=", "traj", ".", "eqs", "# Create a namespace dictionairy", "namespace", "=", "traj", ".", "Net", ".", "f_to_dict", "(", "short_names", "=", "True", ",", "fast_access", "=", "True", ")", "# Create the Neuron Gro...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
euler_scheme
Simulation function for Euler integration. :param traj: Container for parameters and results :param diff_func: The differential equation we want to integrate
examples/example_05_custom_parameter.py
def euler_scheme(traj, diff_func): """Simulation function for Euler integration. :param traj: Container for parameters and results :param diff_func: The differential equation we want to integrate """ steps = traj.steps initial_conditions = traj.initial_conditions dimens...
def euler_scheme(traj, diff_func): """Simulation function for Euler integration. :param traj: Container for parameters and results :param diff_func: The differential equation we want to integrate """ steps = traj.steps initial_conditions = traj.initial_conditions dimens...
[ "Simulation", "function", "for", "Euler", "integration", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_05_custom_parameter.py#L19-L52
[ "def", "euler_scheme", "(", "traj", ",", "diff_func", ")", ":", "steps", "=", "traj", ".", "steps", "initial_conditions", "=", "traj", ".", "initial_conditions", "dimension", "=", "len", "(", "initial_conditions", ")", "# This array will collect the results", "resul...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
add_parameters
Adds all necessary parameters to the `traj` container
examples/example_05_custom_parameter.py
def add_parameters(traj): """Adds all necessary parameters to the `traj` container""" traj.f_add_parameter('steps', 10000, comment='Number of time steps to simulate') traj.f_add_parameter('dt', 0.01, comment='Step size') # Here we want to add the initial conditions as an array parameter. We will simul...
def add_parameters(traj): """Adds all necessary parameters to the `traj` container""" traj.f_add_parameter('steps', 10000, comment='Number of time steps to simulate') traj.f_add_parameter('dt', 0.01, comment='Step size') # Here we want to add the initial conditions as an array parameter. We will simul...
[ "Adds", "all", "necessary", "parameters", "to", "the", "traj", "container" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_05_custom_parameter.py#L103-L123
[ "def", "add_parameters", "(", "traj", ")", ":", "traj", ".", "f_add_parameter", "(", "'steps'", ",", "10000", ",", "comment", "=", "'Number of time steps to simulate'", ")", "traj", ".", "f_add_parameter", "(", "'dt'", ",", "0.01", ",", "comment", "=", "'Step ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
diff_lorenz
The Lorenz attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param sigma: Constant attractor parameter :param beta: FConstant attractor parameter :param rho: Constant attractor parameter :return: 3d array of the Lorenz system evaluated at `va...
examples/example_05_custom_parameter.py
def diff_lorenz(value_array, sigma, beta, rho): """The Lorenz attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param sigma: Constant attractor parameter :param beta: FConstant attractor parameter :param rho: Constant attractor parameter ...
def diff_lorenz(value_array, sigma, beta, rho): """The Lorenz attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param sigma: Constant attractor parameter :param beta: FConstant attractor parameter :param rho: Constant attractor parameter ...
[ "The", "Lorenz", "attractor", "differential", "equation" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_05_custom_parameter.py#L128-L144
[ "def", "diff_lorenz", "(", "value_array", ",", "sigma", ",", "beta", ",", "rho", ")", ":", "diff_array", "=", "np", ".", "zeros", "(", "3", ")", "diff_array", "[", "0", "]", "=", "sigma", "*", "(", "value_array", "[", "1", "]", "-", "value_array", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_create_storage
Creates a service from a constructor and checks which kwargs are not used
pypet/utils/storagefactory.py
def _create_storage(storage_service, trajectory=None, **kwargs): """Creates a service from a constructor and checks which kwargs are not used""" kwargs_copy = kwargs.copy() kwargs_copy['trajectory'] = trajectory matching_kwargs = get_matching_kwargs(storage_service, kwargs_copy) storage_service = st...
def _create_storage(storage_service, trajectory=None, **kwargs): """Creates a service from a constructor and checks which kwargs are not used""" kwargs_copy = kwargs.copy() kwargs_copy['trajectory'] = trajectory matching_kwargs = get_matching_kwargs(storage_service, kwargs_copy) storage_service = st...
[ "Creates", "a", "service", "from", "a", "constructor", "and", "checks", "which", "kwargs", "are", "not", "used" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/storagefactory.py#L18-L25
[ "def", "_create_storage", "(", "storage_service", ",", "trajectory", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs_copy", "=", "kwargs", ".", "copy", "(", ")", "kwargs_copy", "[", "'trajectory'", "]", "=", "trajectory", "matching_kwargs", "=", "get...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
storage_factory
Creates a storage service, to be extended if new storage services are added :param storage_service: Storage Service instance of constructor or a string pointing to a file :param trajectory: A trajectory instance :param kwargs: Arguments passed to the storage service :retur...
pypet/utils/storagefactory.py
def storage_factory(storage_service, trajectory=None, **kwargs): """Creates a storage service, to be extended if new storage services are added :param storage_service: Storage Service instance of constructor or a string pointing to a file :param trajectory: A trajectory instance :pa...
def storage_factory(storage_service, trajectory=None, **kwargs): """Creates a storage service, to be extended if new storage services are added :param storage_service: Storage Service instance of constructor or a string pointing to a file :param trajectory: A trajectory instance :pa...
[ "Creates", "a", "storage", "service", "to", "be", "extended", "if", "new", "storage", "services", "are", "added" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/storagefactory.py#L28-L64
[ "def", "storage_factory", "(", "storage_service", ",", "trajectory", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'filename'", "in", "kwargs", "and", "storage_service", "is", "None", ":", "filename", "=", "kwargs", "[", "'filename'", "]", "_", ",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
multiply
Example of a sophisticated simulation that involves multiplying two values. :param traj: Trajectory containing the parameters in a particular combination, it also serves as a container for results.
examples/example_14_links.py
def multiply(traj): """Example of a sophisticated simulation that involves multiplying two values. :param traj: Trajectory containing the parameters in a particular combination, it also serves as a container for results. """ z=traj.mylink1*traj.mylink2 # And again we now can a...
def multiply(traj): """Example of a sophisticated simulation that involves multiplying two values. :param traj: Trajectory containing the parameters in a particular combination, it also serves as a container for results. """ z=traj.mylink1*traj.mylink2 # And again we now can a...
[ "Example", "of", "a", "sophisticated", "simulation", "that", "involves", "multiplying", "two", "values", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_14_links.py#L7-L19
[ "def", "multiply", "(", "traj", ")", ":", "z", "=", "traj", ".", "mylink1", "*", "traj", ".", "mylink2", "# And again we now can also use the different names", "# due to the creation of links", "traj", ".", "f_add_result", "(", "'runs.$.z'", ",", "z", ",", "comment"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
add_parameters
Adds all necessary parameters to the `traj` container. You can choose between two parameter sets. One for the Lorenz attractor and one for the Roessler attractor. The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for `traj.diff_name=='diff_roessler'`. You can use parameter preset...
examples/example_06_parameter_presetting.py
def add_parameters(traj): """Adds all necessary parameters to the `traj` container. You can choose between two parameter sets. One for the Lorenz attractor and one for the Roessler attractor. The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for `traj.diff_name=='diff_roessler'`....
def add_parameters(traj): """Adds all necessary parameters to the `traj` container. You can choose between two parameter sets. One for the Lorenz attractor and one for the Roessler attractor. The former is chosen for `traj.diff_name=='diff_lorenz'`, the latter for `traj.diff_name=='diff_roessler'`....
[ "Adds", "all", "necessary", "parameters", "to", "the", "traj", "container", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_06_parameter_presetting.py#L14-L50
[ "def", "add_parameters", "(", "traj", ")", ":", "traj", ".", "f_add_parameter", "(", "'steps'", ",", "10000", ",", "comment", "=", "'Number of time steps to simulate'", ")", "traj", ".", "f_add_parameter", "(", "'dt'", ",", "0.01", ",", "comment", "=", "'Step ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
diff_roessler
The Roessler attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param a: Constant attractor parameter :param c: Constant attractor parameter :return: 3d array of the Roessler system evaluated at `value_array`
examples/example_06_parameter_presetting.py
def diff_roessler(value_array, a, c): """The Roessler attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param a: Constant attractor parameter :param c: Constant attractor parameter :return: 3d array of the Roessler system evaluated at `value_...
def diff_roessler(value_array, a, c): """The Roessler attractor differential equation :param value_array: 3d array containing the x,y, and z component values. :param a: Constant attractor parameter :param c: Constant attractor parameter :return: 3d array of the Roessler system evaluated at `value_...
[ "The", "Roessler", "attractor", "differential", "equation" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_06_parameter_presetting.py#L56-L72
[ "def", "diff_roessler", "(", "value_array", ",", "a", ",", "c", ")", ":", "b", "=", "a", "diff_array", "=", "np", ".", "zeros", "(", "3", ")", "diff_array", "[", "0", "]", "=", "-", "value_array", "[", "1", "]", "-", "value_array", "[", "2", "]",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
compact_hdf5_file
Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/usersguide/utilities.html#ptrepackdescr) Currently only supported under Linux...
pypet/utils/hdf5compression.py
def compact_hdf5_file(filename, name=None, index=None, keep_backup=True): """Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/u...
def compact_hdf5_file(filename, name=None, index=None, keep_backup=True): """Can compress an HDF5 to reduce file size. The properties on how to compress the new file are taken from a given trajectory in the file. Simply calls ``ptrepack`` from the command line. (Se also https://pytables.github.io/u...
[ "Can", "compress", "an", "HDF5", "to", "reduce", "file", "size", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/utils/hdf5compression.py#L12-L86
[ "def", "compact_hdf5_file", "(", "filename", ",", "name", "=", "None", ",", "index", "=", "None", ",", "keep_backup", "=", "True", ")", ":", "if", "name", "is", "None", "and", "index", "is", "None", ":", "index", "=", "-", "1", "tmp_traj", "=", "load...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
_explored_parameters_in_group
Checks if one the parameters in `group_node` is explored. :param traj: Trajectory container :param group_node: Group node :return: `True` or `False`
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _explored_parameters_in_group(traj, group_node): """Checks if one the parameters in `group_node` is explored. :param traj: Trajectory container :param group_node: Group node :return: `True` or `False` """ explored = False for param in traj.f_get_explored_parameters(): if pa...
def _explored_parameters_in_group(traj, group_node): """Checks if one the parameters in `group_node` is explored. :param traj: Trajectory container :param group_node: Group node :return: `True` or `False` """ explored = False for param in traj.f_get_explored_parameters(): if pa...
[ "Checks", "if", "one", "the", "parameters", "in", "group_node", "is", "explored", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L16-L30
[ "def", "_explored_parameters_in_group", "(", "traj", ",", "group_node", ")", ":", "explored", "=", "False", "for", "param", "in", "traj", ".", "f_get_explored_parameters", "(", ")", ":", "if", "param", "in", "group_node", ":", "explored", "=", "True", "break",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNeuronGroup.add_parameters
Adds all neuron group parameters to `traj`.
examples/example_24_large_scale_brian2_simulation/clusternet.py
def add_parameters(traj): """Adds all neuron group parameters to `traj`.""" assert(isinstance(traj,Trajectory)) scale = traj.simulation.scale traj.v_standard_parameter = Brian2Parameter model_eqs = '''dV/dt= 1.0/tau_POST * (mu - V) + I_syn : 1 mu : 1 ...
def add_parameters(traj): """Adds all neuron group parameters to `traj`.""" assert(isinstance(traj,Trajectory)) scale = traj.simulation.scale traj.v_standard_parameter = Brian2Parameter model_eqs = '''dV/dt= 1.0/tau_POST * (mu - V) + I_syn : 1 mu : 1 ...
[ "Adds", "all", "neuron", "group", "parameters", "to", "traj", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L40-L86
[ "def", "add_parameters", "(", "traj", ")", ":", "assert", "(", "isinstance", "(", "traj", ",", "Trajectory", ")", ")", "scale", "=", "traj", ".", "simulation", ".", "scale", "traj", ".", "v_standard_parameter", "=", "Brian2Parameter", "model_eqs", "=", "'''d...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNeuronGroup._build_model_eqs
Computes model equations for the excitatory and inhibitory population. Equation objects are created by fusing `model.eqs` and `model.synaptic.eqs` and replacing `PRE` by `i` (for inhibitory) or `e` (for excitatory) depending on the type of population. :return: Dictionary with 'i' equat...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _build_model_eqs(traj): """Computes model equations for the excitatory and inhibitory population. Equation objects are created by fusing `model.eqs` and `model.synaptic.eqs` and replacing `PRE` by `i` (for inhibitory) or `e` (for excitatory) depending on the type of population. ...
def _build_model_eqs(traj): """Computes model equations for the excitatory and inhibitory population. Equation objects are created by fusing `model.eqs` and `model.synaptic.eqs` and replacing `PRE` by `i` (for inhibitory) or `e` (for excitatory) depending on the type of population. ...
[ "Computes", "model", "equations", "for", "the", "excitatory", "and", "inhibitory", "population", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L90-L127
[ "def", "_build_model_eqs", "(", "traj", ")", ":", "model_eqs", "=", "traj", ".", "model", ".", "eqs", "post_eqs", "=", "{", "}", "for", "name_post", "in", "[", "'i'", ",", "'e'", "]", ":", "variables_dict", "=", "{", "}", "new_model_eqs", "=", "model_e...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNeuronGroup.pre_build
Pre-builds the neuron groups. Pre-build is only performed if none of the relevant parameters is explored. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds: Inhibitory neuron group ...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def pre_build(self, traj, brian_list, network_dict): """Pre-builds the neuron groups. Pre-build is only performed if none of the relevant parameters is explored. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network construct...
def pre_build(self, traj, brian_list, network_dict): """Pre-builds the neuron groups. Pre-build is only performed if none of the relevant parameters is explored. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network construct...
[ "Pre", "-", "builds", "the", "neuron", "groups", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L129-L161
[ "def", "pre_build", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "self", ".", "_pre_build", "=", "not", "_explored_parameters_in_group", "(", "traj", ",", "traj", ".", "parameters", ".", "model", ")", "if", "self", ".", "_pre...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNeuronGroup.build
Builds the neuron groups. Build is only performed if neuron group was not pre-build before. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds: Inhibitory neuron group Excit...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def build(self, traj, brian_list, network_dict): """Builds the neuron groups. Build is only performed if neuron group was not pre-build before. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. A...
def build(self, traj, brian_list, network_dict): """Builds the neuron groups. Build is only performed if neuron group was not pre-build before. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. A...
[ "Builds", "the", "neuron", "groups", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L164-L194
[ "def", "build", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_pre_build'", ")", "or", "not", "self", ".", "_pre_build", ":", "self", ".", "_build_model", "(", "traj", ",", "bria...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNeuronGroup._build_model
Builds the neuron groups from `traj`. Adds the neuron groups to `brian_list` and `network_dict`.
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _build_model(self, traj, brian_list, network_dict): """Builds the neuron groups from `traj`. Adds the neuron groups to `brian_list` and `network_dict`. """ model = traj.parameters.model # Create the equations for both models eqs_dict = self._build_model_eqs(traj) ...
def _build_model(self, traj, brian_list, network_dict): """Builds the neuron groups from `traj`. Adds the neuron groups to `brian_list` and `network_dict`. """ model = traj.parameters.model # Create the equations for both models eqs_dict = self._build_model_eqs(traj) ...
[ "Builds", "the", "neuron", "groups", "from", "traj", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L197-L240
[ "def", "_build_model", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "model", "=", "traj", ".", "parameters", ".", "model", "# Create the equations for both models", "eqs_dict", "=", "self", ".", "_build_model_eqs", "(", "traj", ")"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNConnections.add_parameters
Adds all neuron group parameters to `traj`.
examples/example_24_large_scale_brian2_simulation/clusternet.py
def add_parameters(traj): """Adds all neuron group parameters to `traj`.""" assert(isinstance(traj,Trajectory)) traj.v_standard_parameter = Brian2Parameter scale = traj.simulation.scale traj.f_add_parameter('connections.R_ee', 1.0, comment='Scaling factor for clustering') ...
def add_parameters(traj): """Adds all neuron group parameters to `traj`.""" assert(isinstance(traj,Trajectory)) traj.v_standard_parameter = Brian2Parameter scale = traj.simulation.scale traj.f_add_parameter('connections.R_ee', 1.0, comment='Scaling factor for clustering') ...
[ "Adds", "all", "neuron", "group", "parameters", "to", "traj", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L255-L284
[ "def", "add_parameters", "(", "traj", ")", ":", "assert", "(", "isinstance", "(", "traj", ",", "Trajectory", ")", ")", "traj", ".", "v_standard_parameter", "=", "Brian2Parameter", "scale", "=", "traj", ".", "simulation", ".", "scale", "traj", ".", "f_add_par...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNConnections.pre_build
Pre-builds the connections. Pre-build is only performed if none of the relevant parameters is explored and the relevant neuron groups exist. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def pre_build(self, traj, brian_list, network_dict): """Pre-builds the connections. Pre-build is only performed if none of the relevant parameters is explored and the relevant neuron groups exist. :param traj: Trajectory container :param brian_list: List o...
def pre_build(self, traj, brian_list, network_dict): """Pre-builds the connections. Pre-build is only performed if none of the relevant parameters is explored and the relevant neuron groups exist. :param traj: Trajectory container :param brian_list: List o...
[ "Pre", "-", "builds", "the", "connections", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L287-L325
[ "def", "pre_build", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "self", ".", "_pre_build", "=", "not", "_explored_parameters_in_group", "(", "traj", ",", "traj", ".", "parameters", ".", "connections", ")", "self", ".", "_pre_b...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNConnections.build
Builds the connections. Build is only performed if connections have not been pre-build. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds: Connections, amount depends on clustering ...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def build(self, traj, brian_list, network_dict): """Builds the connections. Build is only performed if connections have not been pre-build. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds:...
def build(self, traj, brian_list, network_dict): """Builds the connections. Build is only performed if connections have not been pre-build. :param traj: Trajectory container :param brian_list: List of objects passed to BRIAN network constructor. Adds:...
[ "Builds", "the", "connections", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L328-L360
[ "def", "build", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_pre_build'", ")", "or", "not", "self", ".", "_pre_build", ":", "self", ".", "_build_connections", "(", "traj", ",", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNConnections._build_connections
Connects neuron groups `neurons_i` and `neurons_e`. Adds all connections to `brian_list` and adds a list of connections with the key 'connections' to the `network_dict`.
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _build_connections(self, traj, brian_list, network_dict): """Connects neuron groups `neurons_i` and `neurons_e`. Adds all connections to `brian_list` and adds a list of connections with the key 'connections' to the `network_dict`. """ connections = traj.connections ...
def _build_connections(self, traj, brian_list, network_dict): """Connects neuron groups `neurons_i` and `neurons_e`. Adds all connections to `brian_list` and adds a list of connections with the key 'connections' to the `network_dict`. """ connections = traj.connections ...
[ "Connects", "neuron", "groups", "neurons_i", "and", "neurons_e", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L363-L473
[ "def", "_build_connections", "(", "self", ",", "traj", ",", "brian_list", ",", "network_dict", ")", ":", "connections", "=", "traj", ".", "connections", "neurons_i", "=", "network_dict", "[", "'neurons_i'", "]", "neurons_e", "=", "network_dict", "[", "'neurons_e...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNNetworkRunner.add_parameters
Adds all necessary parameters to `traj` container.
examples/example_24_large_scale_brian2_simulation/clusternet.py
def add_parameters(self, traj): """Adds all necessary parameters to `traj` container.""" par= traj.f_add_parameter(Brian2Parameter,'simulation.durations.initial_run', 500*ms, comment='Initialisation run for more realistic ' 'measur...
def add_parameters(self, traj): """Adds all necessary parameters to `traj` container.""" par= traj.f_add_parameter(Brian2Parameter,'simulation.durations.initial_run', 500*ms, comment='Initialisation run for more realistic ' 'measur...
[ "Adds", "all", "necessary", "parameters", "to", "traj", "container", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L485-L495
[ "def", "add_parameters", "(", "self", ",", "traj", ")", ":", "par", "=", "traj", ".", "f_add_parameter", "(", "Brian2Parameter", ",", "'simulation.durations.initial_run'", ",", "500", "*", "ms", ",", "comment", "=", "'Initialisation run for more realistic '", "'meas...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNFanoFactorComputer._compute_fano_factor
Computes Fano Factor for one neuron. :param spike_res: Result containing the spiketimes of all neurons :param neuron_id: Index of neuron for which FF is computed :param time_window: Length of the consecutive time windows to compute the FF :param...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _compute_fano_factor(spike_res, neuron_id, time_window, start_time, end_time): """Computes Fano Factor for one neuron. :param spike_res: Result containing the spiketimes of all neurons :param neuron_id: Index of neuron for which FF is computed :param time...
def _compute_fano_factor(spike_res, neuron_id, time_window, start_time, end_time): """Computes Fano Factor for one neuron. :param spike_res: Result containing the spiketimes of all neurons :param neuron_id: Index of neuron for which FF is computed :param time...
[ "Computes", "Fano", "Factor", "for", "one", "neuron", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L508-L569
[ "def", "_compute_fano_factor", "(", "spike_res", ",", "neuron_id", ",", "time_window", ",", "start_time", ",", "end_time", ")", ":", "assert", "(", "end_time", ">=", "start_time", "+", "time_window", ")", "# Number of time bins", "bins", "=", "(", "end_time", "-...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNFanoFactorComputer._compute_mean_fano_factor
Computes average Fano Factor over many neurons. :param neuron_ids: List of neuron indices to average over :param spike_res: Result containing all the spikes :param time_window: Length of the consecutive time windows to compute the FF :param star...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _compute_mean_fano_factor( neuron_ids, spike_res, time_window, start_time, end_time): """Computes average Fano Factor over many neurons. :param neuron_ids: List of neuron indices to average over :param spike_res: Result containing all the spikes :param ti...
def _compute_mean_fano_factor( neuron_ids, spike_res, time_window, start_time, end_time): """Computes average Fano Factor over many neurons. :param neuron_ids: List of neuron indices to average over :param spike_res: Result containing all the spikes :param ti...
[ "Computes", "average", "Fano", "Factor", "over", "many", "neurons", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L572-L608
[ "def", "_compute_mean_fano_factor", "(", "neuron_ids", ",", "spike_res", ",", "time_window", ",", "start_time", ",", "end_time", ")", ":", "ffs", "=", "np", ".", "zeros", "(", "len", "(", "neuron_ids", ")", ")", "for", "idx", ",", "neuron_id", "in", "enume...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNFanoFactorComputer.analyse
Calculates average Fano Factor of a network. :param traj: Trajectory container Expects: `results.monitors.spikes_e`: Data from SpikeMonitor for excitatory neurons Adds: `results.statistics.mean_fano_factor`: Average Fano Factor :param ne...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def analyse(self, traj, network, current_subrun, subrun_list, network_dict): """Calculates average Fano Factor of a network. :param traj: Trajectory container Expects: `results.monitors.spikes_e`: Data from SpikeMonitor for excitatory neurons Adds: ...
def analyse(self, traj, network, current_subrun, subrun_list, network_dict): """Calculates average Fano Factor of a network. :param traj: Trajectory container Expects: `results.monitors.spikes_e`: Data from SpikeMonitor for excitatory neurons Adds: ...
[ "Calculates", "average", "Fano", "Factor", "of", "a", "network", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L610-L659
[ "def", "analyse", "(", "self", ",", "traj", ",", "network", ",", "current_subrun", ",", "subrun_list", ",", "network_dict", ")", ":", "#Check if we finished all subruns", "if", "len", "(", "subrun_list", ")", "==", "0", ":", "spikes_e", "=", "traj", ".", "re...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis.add_to_network
Adds monitors to the network if the measurement run is carried out. :param traj: Trajectory container :param network: The BRIAN network :param current_subrun: BrianParameter :param subrun_list: List of coming subrun_list :param network_dict: Dictionary of items ...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def add_to_network(self, traj, network, current_subrun, subrun_list, network_dict): """Adds monitors to the network if the measurement run is carried out. :param traj: Trajectory container :param network: The BRIAN network :param current_subrun: BrianParameter :param subrun_l...
def add_to_network(self, traj, network, current_subrun, subrun_list, network_dict): """Adds monitors to the network if the measurement run is carried out. :param traj: Trajectory container :param network: The BRIAN network :param current_subrun: BrianParameter :param subrun_l...
[ "Adds", "monitors", "to", "the", "network", "if", "the", "measurement", "run", "is", "carried", "out", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L675-L709
[ "def", "add_to_network", "(", "self", ",", "traj", ",", "network", ",", "current_subrun", ",", "subrun_list", ",", "network_dict", ")", ":", "if", "current_subrun", ".", "v_annotations", ".", "order", "==", "1", ":", "self", ".", "_add_monitors", "(", "traj"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis._add_monitors
Adds monitors to the network
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _add_monitors(self, traj, network, network_dict): """Adds monitors to the network""" neurons_e = network_dict['neurons_e'] monitor_list = [] # Spiketimes self.spike_monitor = SpikeMonitor(neurons_e) monitor_list.append(self.spike_monitor) # Membrane Poten...
def _add_monitors(self, traj, network, network_dict): """Adds monitors to the network""" neurons_e = network_dict['neurons_e'] monitor_list = [] # Spiketimes self.spike_monitor = SpikeMonitor(neurons_e) monitor_list.append(self.spike_monitor) # Membrane Poten...
[ "Adds", "monitors", "to", "the", "network" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L711-L740
[ "def", "_add_monitors", "(", "self", ",", "traj", ",", "network", ",", "network_dict", ")", ":", "neurons_e", "=", "network_dict", "[", "'neurons_e'", "]", "monitor_list", "=", "[", "]", "# Spiketimes", "self", ".", "spike_monitor", "=", "SpikeMonitor", "(", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis._make_folder
Makes a subfolder for plots. :return: Path name to print folder
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _make_folder(self, traj): """Makes a subfolder for plots. :return: Path name to print folder """ print_folder = os.path.join(traj.analysis.plot_folder, traj.v_name, traj.v_crun) print_folder = os.path.abspath(print_folder) if not ...
def _make_folder(self, traj): """Makes a subfolder for plots. :return: Path name to print folder """ print_folder = os.path.join(traj.analysis.plot_folder, traj.v_name, traj.v_crun) print_folder = os.path.abspath(print_folder) if not ...
[ "Makes", "a", "subfolder", "for", "plots", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L742-L754
[ "def", "_make_folder", "(", "self", ",", "traj", ")", ":", "print_folder", "=", "os", ".", "path", ".", "join", "(", "traj", ".", "analysis", ".", "plot_folder", ",", "traj", ".", "v_name", ",", "traj", ".", "v_crun", ")", "print_folder", "=", "os", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis._plot_result
Plots a state variable graph for several neurons into one figure
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _plot_result(self, traj, result_name): """Plots a state variable graph for several neurons into one figure""" result = traj.f_get(result_name) varname = result.record_variables[0] values = result[varname] times = result.t record = result.record for idx, celi...
def _plot_result(self, traj, result_name): """Plots a state variable graph for several neurons into one figure""" result = traj.f_get(result_name) varname = result.record_variables[0] values = result[varname] times = result.t record = result.record for idx, celi...
[ "Plots", "a", "state", "variable", "graph", "for", "several", "neurons", "into", "one", "figure" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L756-L773
[ "def", "_plot_result", "(", "self", ",", "traj", ",", "result_name", ")", ":", "result", "=", "traj", ".", "f_get", "(", "result_name", ")", "varname", "=", "result", ".", "record_variables", "[", "0", "]", "values", "=", "result", "[", "varname", "]", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis._print_graphs
Makes some plots and stores them into subfolders
examples/example_24_large_scale_brian2_simulation/clusternet.py
def _print_graphs(self, traj): """Makes some plots and stores them into subfolders""" print_folder = self._make_folder(traj) # If we use BRIAN's own raster_plot functionality we # need to sue the SpikeMonitor directly plt.figure() plt.scatter(self.spike_monitor.t, self.s...
def _print_graphs(self, traj): """Makes some plots and stores them into subfolders""" print_folder = self._make_folder(traj) # If we use BRIAN's own raster_plot functionality we # need to sue the SpikeMonitor directly plt.figure() plt.scatter(self.spike_monitor.t, self.s...
[ "Makes", "some", "plots", "and", "stores", "them", "into", "subfolders" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L775-L817
[ "def", "_print_graphs", "(", "self", ",", "traj", ")", ":", "print_folder", "=", "self", ".", "_make_folder", "(", "traj", ")", "# If we use BRIAN's own raster_plot functionality we", "# need to sue the SpikeMonitor directly", "plt", ".", "figure", "(", ")", "plt", "....
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
CNMonitorAnalysis.analyse
Extracts monitor data and plots. Data extraction is done if all subruns have been completed, i.e. `len(subrun_list)==0` First, extracts results from the monitors and stores them into `traj`. Next, uses the extracted data for plots. :param traj: Trajectory contain...
examples/example_24_large_scale_brian2_simulation/clusternet.py
def analyse(self, traj, network, current_subrun, subrun_list, network_dict): """Extracts monitor data and plots. Data extraction is done if all subruns have been completed, i.e. `len(subrun_list)==0` First, extracts results from the monitors and stores them into `traj`. Next, ...
def analyse(self, traj, network, current_subrun, subrun_list, network_dict): """Extracts monitor data and plots. Data extraction is done if all subruns have been completed, i.e. `len(subrun_list)==0` First, extracts results from the monitors and stores them into `traj`. Next, ...
[ "Extracts", "monitor", "data", "and", "plots", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_24_large_scale_brian2_simulation/clusternet.py#L820-L864
[ "def", "analyse", "(", "self", ",", "traj", ",", "network", ",", "current_subrun", ",", "subrun_list", ",", "network_dict", ")", ":", "if", "len", "(", "subrun_list", ")", "==", "0", ":", "traj", ".", "f_add_result", "(", "Brian2MonitorResult", ",", "'moni...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
get_batch
Function that parses the batch id from the command line arguments
examples/example_22_saga_python/the_task.py
def get_batch(): """Function that parses the batch id from the command line arguments""" optlist, args = getopt.getopt(sys.argv[1:], '', longopts='batch=') batch = 0 for o, a in optlist: if o == '--batch': batch = int(a) print('Found batch %d' % batch) return batch
def get_batch(): """Function that parses the batch id from the command line arguments""" optlist, args = getopt.getopt(sys.argv[1:], '', longopts='batch=') batch = 0 for o, a in optlist: if o == '--batch': batch = int(a) print('Found batch %d' % batch) return batch
[ "Function", "that", "parses", "the", "batch", "id", "from", "the", "command", "line", "arguments" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/the_task.py#L98-L107
[ "def", "get_batch", "(", ")", ":", "optlist", ",", "args", "=", "getopt", ".", "getopt", "(", "sys", ".", "argv", "[", "1", ":", "]", ",", "''", ",", "longopts", "=", "'batch='", ")", "batch", "=", "0", "for", "o", ",", "a", "in", "optlist", ":...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
explore_batch
Chooses exploration according to `batch`
examples/example_22_saga_python/the_task.py
def explore_batch(traj, batch): """Chooses exploration according to `batch`""" explore_dict = {} explore_dict['sigma'] = np.arange(10.0 * batch, 10.0*(batch+1), 1.0).tolist() # for batch = 0 explores sigma in [0.0, 1.0, 2.0, ..., 9.0], # for batch = 1 explores sigma in [10.0, 11.0, 12.0, ..., 19.0] ...
def explore_batch(traj, batch): """Chooses exploration according to `batch`""" explore_dict = {} explore_dict['sigma'] = np.arange(10.0 * batch, 10.0*(batch+1), 1.0).tolist() # for batch = 0 explores sigma in [0.0, 1.0, 2.0, ..., 9.0], # for batch = 1 explores sigma in [10.0, 11.0, 12.0, ..., 19.0] ...
[ "Chooses", "exploration", "according", "to", "batch" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/examples/example_22_saga_python/the_task.py#L110-L117
[ "def", "explore_batch", "(", "traj", ",", "batch", ")", ":", "explore_dict", "=", "{", "}", "explore_dict", "[", "'sigma'", "]", "=", "np", ".", "arange", "(", "10.0", "*", "batch", ",", "10.0", "*", "(", "batch", "+", "1", ")", ",", "1.0", ")", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NNTreeNode.vars
Alternative naming, you can use `node.vars.name` instead of `node.v_name`
pypet/naturalnaming.py
def vars(self): """Alternative naming, you can use `node.vars.name` instead of `node.v_name`""" if self._vars is None: self._vars = NNTreeNodeVars(self) return self._vars
def vars(self): """Alternative naming, you can use `node.vars.name` instead of `node.v_name`""" if self._vars is None: self._vars = NNTreeNodeVars(self) return self._vars
[ "Alternative", "naming", "you", "can", "use", "node", ".", "vars", ".", "name", "instead", "of", "node", ".", "v_name" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L203-L207
[ "def", "vars", "(", "self", ")", ":", "if", "self", ".", "_vars", "is", "None", ":", "self", ".", "_vars", "=", "NNTreeNodeVars", "(", "self", ")", "return", "self", ".", "_vars" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NNTreeNode.func
Alternative naming, you can use `node.func.name` instead of `node.f_func`
pypet/naturalnaming.py
def func(self): """Alternative naming, you can use `node.func.name` instead of `node.f_func`""" if self._func is None: self._func = NNTreeNodeFunc(self) return self._func
def func(self): """Alternative naming, you can use `node.func.name` instead of `node.f_func`""" if self._func is None: self._func = NNTreeNodeFunc(self) return self._func
[ "Alternative", "naming", "you", "can", "use", "node", ".", "func", ".", "name", "instead", "of", "node", ".", "f_func" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L210-L214
[ "def", "func", "(", "self", ")", ":", "if", "self", ".", "_func", "is", "None", ":", "self", ".", "_func", "=", "NNTreeNodeFunc", "(", "self", ")", "return", "self", ".", "_func" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NNTreeNode._rename
Renames the tree node
pypet/naturalnaming.py
def _rename(self, full_name): """Renames the tree node""" self._full_name = full_name if full_name: self._name = full_name.rsplit('.', 1)[-1]
def _rename(self, full_name): """Renames the tree node""" self._full_name = full_name if full_name: self._name = full_name.rsplit('.', 1)[-1]
[ "Renames", "the", "tree", "node" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L294-L298
[ "def", "_rename", "(", "self", ",", "full_name", ")", ":", "self", ".", "_full_name", "=", "full_name", "if", "full_name", ":", "self", ".", "_name", "=", "full_name", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", "-", "1", "]" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NNTreeNode._set_details
Sets some details for internal handling.
pypet/naturalnaming.py
def _set_details(self, depth, branch, run_branch): """Sets some details for internal handling.""" self._depth = depth self._branch = branch self._run_branch = run_branch
def _set_details(self, depth, branch, run_branch): """Sets some details for internal handling.""" self._depth = depth self._branch = branch self._run_branch = run_branch
[ "Sets", "some", "details", "for", "internal", "handling", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L300-L304
[ "def", "_set_details", "(", "self", ",", "depth", ",", "branch", ",", "run_branch", ")", ":", "self", ".", "_depth", "=", "depth", "self", ".", "_branch", "=", "branch", "self", ".", "_run_branch", "=", "run_branch" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._map_type_to_dict
Maps a an instance type representation string (e.g. 'RESULT') to the corresponding dictionary in root.
pypet/naturalnaming.py
def _map_type_to_dict(self, type_name): """ Maps a an instance type representation string (e.g. 'RESULT') to the corresponding dictionary in root. """ root = self._root_instance if type_name == RESULT: return root._results elif type_name == PARAMETER: ...
def _map_type_to_dict(self, type_name): """ Maps a an instance type representation string (e.g. 'RESULT') to the corresponding dictionary in root. """ root = self._root_instance if type_name == RESULT: return root._results elif type_name == PARAMETER: ...
[ "Maps", "a", "an", "instance", "type", "representation", "string", "(", "e", ".", "g", ".", "RESULT", ")", "to", "the", "corresponding", "dictionary", "in", "root", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L507-L525
[ "def", "_map_type_to_dict", "(", "self", ",", "type_name", ")", ":", "root", "=", "self", ".", "_root_instance", "if", "type_name", "==", "RESULT", ":", "return", "root", ".", "_results", "elif", "type_name", "==", "PARAMETER", ":", "return", "root", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._fetch_from_string
Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the top of this module. :param name: String name of item to store, l...
pypet/naturalnaming.py
def _fetch_from_string(self, store_load, name, args, kwargs): """Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the ...
def _fetch_from_string(self, store_load, name, args, kwargs): """Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the ...
[ "Method", "used", "by", "f_store", "/", "load", "/", "remove_items", "to", "find", "a", "corresponding", "item", "in", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L527-L552
[ "def", "_fetch_from_string", "(", "self", ",", "store_load", ",", "name", ",", "args", ",", "kwargs", ")", ":", "if", "not", "isinstance", "(", "name", ",", "str", ")", ":", "raise", "TypeError", "(", "'No string!'", ")", "node", "=", "self", ".", "_ro...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._fetch_from_node
Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove :param node: A group, parameter or result instance. :param args: Additional arguments passed to the storage service :param...
pypet/naturalnaming.py
def _fetch_from_node(self, store_load, node, args, kwargs): """Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove :param node: A group, parameter or result instance. :param ...
def _fetch_from_node(self, store_load, node, args, kwargs): """Method used by f_store/load/remove_items to find a corresponding item in the tree. :param store_load: String constant specifying if we want to store, load or remove :param node: A group, parameter or result instance. :param ...
[ "Method", "used", "by", "f_store", "/", "load", "/", "remove_items", "to", "find", "a", "corresponding", "item", "in", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L554-L570
[ "def", "_fetch_from_node", "(", "self", ",", "store_load", ",", "node", ",", "args", ",", "kwargs", ")", ":", "msg", "=", "self", ".", "_node_to_msg", "(", "store_load", ",", "node", ")", "return", "msg", ",", "node", ",", "args", ",", "kwargs" ]
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._fetch_from_tuple
Method used by f_store/load/remove_items to find a corresponding item in the tree. The input to the method should already be in the correct format, this method only checks for sanity. :param store_load: String constant specifying if we want to store, load or remove :param store_tuple:...
pypet/naturalnaming.py
def _fetch_from_tuple(self, store_load, store_tuple, args, kwargs): """ Method used by f_store/load/remove_items to find a corresponding item in the tree. The input to the method should already be in the correct format, this method only checks for sanity. :param store_load: String cons...
def _fetch_from_tuple(self, store_load, store_tuple, args, kwargs): """ Method used by f_store/load/remove_items to find a corresponding item in the tree. The input to the method should already be in the correct format, this method only checks for sanity. :param store_load: String cons...
[ "Method", "used", "by", "f_store", "/", "load", "/", "remove_items", "to", "find", "a", "corresponding", "item", "in", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L572-L613
[ "def", "_fetch_from_tuple", "(", "self", ",", "store_load", ",", "store_tuple", ",", "args", ",", "kwargs", ")", ":", "node", "=", "store_tuple", "[", "1", "]", "msg", "=", "store_tuple", "[", "0", "]", "if", "len", "(", "store_tuple", ")", ">", "2", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._node_to_msg
Maps a given node and a store_load constant to the message that is understood by the storage service.
pypet/naturalnaming.py
def _node_to_msg(store_load, node): """Maps a given node and a store_load constant to the message that is understood by the storage service. """ if node.v_is_leaf: if store_load == STORE: return pypetconstants.LEAF elif store_load == LOAD: ...
def _node_to_msg(store_load, node): """Maps a given node and a store_load constant to the message that is understood by the storage service. """ if node.v_is_leaf: if store_load == STORE: return pypetconstants.LEAF elif store_load == LOAD: ...
[ "Maps", "a", "given", "node", "and", "a", "store_load", "constant", "to", "the", "message", "that", "is", "understood", "by", "the", "storage", "service", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L616-L634
[ "def", "_node_to_msg", "(", "store_load", ",", "node", ")", ":", "if", "node", ".", "v_is_leaf", ":", "if", "store_load", "==", "STORE", ":", "return", "pypetconstants", ".", "LEAF", "elif", "store_load", "==", "LOAD", ":", "return", "pypetconstants", ".", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._fetch_items
Method used by f_store/load/remove_items to find corresponding items in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the top of this module. :param iterable: Iterable over ...
pypet/naturalnaming.py
def _fetch_items(self, store_load, iterable, args, kwargs): """ Method used by f_store/load/remove_items to find corresponding items in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the t...
def _fetch_items(self, store_load, iterable, args, kwargs): """ Method used by f_store/load/remove_items to find corresponding items in the tree. :param store_load: String constant specifying if we want to store, load or remove. The corresponding constants are defined at the t...
[ "Method", "used", "by", "f_store", "/", "load", "/", "remove_items", "to", "find", "corresponding", "items", "in", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L636-L708
[ "def", "_fetch_items", "(", "self", ",", "store_load", ",", "iterable", ",", "args", ",", "kwargs", ")", ":", "only_empties", "=", "kwargs", ".", "pop", "(", "'only_empties'", ",", "False", ")", "non_empties", "=", "kwargs", ".", "pop", "(", "'non_empties'...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._remove_subtree
Removes a subtree from the trajectory tree. Does not delete stuff from disk only from RAM. :param start_node: The parent node from where to start :param name: Name of child which will be deleted and recursively all nodes below the child :param predicate: Predicate that can...
pypet/naturalnaming.py
def _remove_subtree(self, start_node, name, predicate=None): """Removes a subtree from the trajectory tree. Does not delete stuff from disk only from RAM. :param start_node: The parent node from where to start :param name: Name of child which will be deleted and recursively all nodes b...
def _remove_subtree(self, start_node, name, predicate=None): """Removes a subtree from the trajectory tree. Does not delete stuff from disk only from RAM. :param start_node: The parent node from where to start :param name: Name of child which will be deleted and recursively all nodes b...
[ "Removes", "a", "subtree", "from", "the", "trajectory", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L710-L769
[ "def", "_remove_subtree", "(", "self", ",", "start_node", ",", "name", ",", "predicate", "=", "None", ")", ":", "def", "_delete_from_children", "(", "node", ",", "child_name", ")", ":", "del", "node", ".", "_children", "[", "child_name", "]", "if", "child_...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._delete_node
Deletes a single node from the tree. Removes all references to the node. Note that the 'parameters', 'results', 'derived_parameters', and 'config' groups hanging directly below root cannot be deleted. Also the root node itself cannot be deleted. (This would cause a tremendous wave of u...
pypet/naturalnaming.py
def _delete_node(self, node): """Deletes a single node from the tree. Removes all references to the node. Note that the 'parameters', 'results', 'derived_parameters', and 'config' groups hanging directly below root cannot be deleted. Also the root node itself cannot be deleted....
def _delete_node(self, node): """Deletes a single node from the tree. Removes all references to the node. Note that the 'parameters', 'results', 'derived_parameters', and 'config' groups hanging directly below root cannot be deleted. Also the root node itself cannot be deleted....
[ "Deletes", "a", "single", "node", "from", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L771-L838
[ "def", "_delete_node", "(", "self", ",", "node", ")", ":", "full_name", "=", "node", ".", "v_full_name", "root", "=", "self", ".", "_root_instance", "if", "full_name", "==", "''", ":", "# You cannot delete root", "return", "if", "node", ".", "v_is_leaf", ":"...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._remove_node_or_leaf
Removes a single node from the tree. Only from RAM not from hdf5 file! :param instance: The node to be deleted :param recursive: If group nodes with children should be deleted
pypet/naturalnaming.py
def _remove_node_or_leaf(self, instance, recursive=False): """Removes a single node from the tree. Only from RAM not from hdf5 file! :param instance: The node to be deleted :param recursive: If group nodes with children should be deleted """ full_name = instance.v_ful...
def _remove_node_or_leaf(self, instance, recursive=False): """Removes a single node from the tree. Only from RAM not from hdf5 file! :param instance: The node to be deleted :param recursive: If group nodes with children should be deleted """ full_name = instance.v_ful...
[ "Removes", "a", "single", "node", "from", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L856-L868
[ "def", "_remove_node_or_leaf", "(", "self", ",", "instance", ",", "recursive", "=", "False", ")", ":", "full_name", "=", "instance", ".", "v_full_name", "split_name", "=", "deque", "(", "full_name", ".", "split", "(", "'.'", ")", ")", "self", ".", "_remove...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._remove_along_branch
Removes a given node from the tree. Starts from a given node and walks recursively down the tree to the location of the node we want to remove. We need to walk from a start node in case we want to check on the way back whether we got empty group nodes due to deletion. :param a...
pypet/naturalnaming.py
def _remove_along_branch(self, actual_node, split_name, recursive=False): """Removes a given node from the tree. Starts from a given node and walks recursively down the tree to the location of the node we want to remove. We need to walk from a start node in case we want to check on the...
def _remove_along_branch(self, actual_node, split_name, recursive=False): """Removes a given node from the tree. Starts from a given node and walks recursively down the tree to the location of the node we want to remove. We need to walk from a start node in case we want to check on the...
[ "Removes", "a", "given", "node", "from", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L870-L924
[ "def", "_remove_along_branch", "(", "self", ",", "actual_node", ",", "split_name", ",", "recursive", "=", "False", ")", ":", "# If the names list is empty, we have reached the node we want to delete.", "if", "len", "(", "split_name", ")", "==", "0", ":", "if", "actual...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._translate_shortcut
Maps a given shortcut to corresponding name * 'run_X' or 'r_X' to 'run_XXXXXXXXX' * 'crun' to the current run name in case of a single run instance if trajectory is used via `v_crun` * 'par' 'parameters' * 'dpar' to 'derived_parameters' * 'res' to 'results' ...
pypet/naturalnaming.py
def _translate_shortcut(self, name): """Maps a given shortcut to corresponding name * 'run_X' or 'r_X' to 'run_XXXXXXXXX' * 'crun' to the current run name in case of a single run instance if trajectory is used via `v_crun` * 'par' 'parameters' * 'dpar' to 'derived_p...
def _translate_shortcut(self, name): """Maps a given shortcut to corresponding name * 'run_X' or 'r_X' to 'run_XXXXXXXXX' * 'crun' to the current run name in case of a single run instance if trajectory is used via `v_crun` * 'par' 'parameters' * 'dpar' to 'derived_p...
[ "Maps", "a", "given", "shortcut", "to", "corresponding", "name" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L926-L979
[ "def", "_translate_shortcut", "(", "self", ",", "name", ")", ":", "if", "isinstance", "(", "name", ",", "int", ")", ":", "return", "True", ",", "self", ".", "_root_instance", ".", "f_wildcard", "(", "'$'", ",", "name", ")", "if", "name", ".", "startswi...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._add_prefix
Adds the correct sub branch prefix to a given name. Usually the prefix is the full name of the parent node. In case items are added directly to the trajectory the prefixes are chosen according to the matching subbranch. For example, this could be 'parameters' for parameters or 'results.run_000...
pypet/naturalnaming.py
def _add_prefix(self, split_names, start_node, group_type_name): """Adds the correct sub branch prefix to a given name. Usually the prefix is the full name of the parent node. In case items are added directly to the trajectory the prefixes are chosen according to the matching subbranch. ...
def _add_prefix(self, split_names, start_node, group_type_name): """Adds the correct sub branch prefix to a given name. Usually the prefix is the full name of the parent node. In case items are added directly to the trajectory the prefixes are chosen according to the matching subbranch. ...
[ "Adds", "the", "correct", "sub", "branch", "prefix", "to", "a", "given", "name", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L981-L1071
[ "def", "_add_prefix", "(", "self", ",", "split_names", ",", "start_node", ",", "group_type_name", ")", ":", "root", "=", "self", ".", "_root_instance", "# If the start node of our insertion is root or one below root", "# we might need to add prefixes.", "# In case of derived pa...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._determine_types
Determines types for generic additions
pypet/naturalnaming.py
def _determine_types(start_node, first_name, add_leaf, add_link): """Determines types for generic additions""" if start_node.v_is_root: where = first_name else: where = start_node._branch if where in SUBTREE_MAPPING: type_tuple = SUBTREE_MAPPING[where...
def _determine_types(start_node, first_name, add_leaf, add_link): """Determines types for generic additions""" if start_node.v_is_root: where = first_name else: where = start_node._branch if where in SUBTREE_MAPPING: type_tuple = SUBTREE_MAPPING[where...
[ "Determines", "types", "for", "generic", "additions" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1074-L1091
[ "def", "_determine_types", "(", "start_node", ",", "first_name", ",", "add_leaf", ",", "add_link", ")", ":", "if", "start_node", ".", "v_is_root", ":", "where", "=", "first_name", "else", ":", "where", "=", "start_node", ".", "_branch", "if", "where", "in", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._add_generic
Adds a given item to the tree irrespective of the subtree. Infers the subtree from the arguments. :param start_node: The parental node the adding was initiated from :param type_name: The type of the new instance. Whether it is a parameter, parameter group, config, con...
pypet/naturalnaming.py
def _add_generic(self, start_node, type_name, group_type_name, args, kwargs, add_prefix=True, check_naming=True): """Adds a given item to the tree irrespective of the subtree. Infers the subtree from the arguments. :param start_node: The parental node the adding was initia...
def _add_generic(self, start_node, type_name, group_type_name, args, kwargs, add_prefix=True, check_naming=True): """Adds a given item to the tree irrespective of the subtree. Infers the subtree from the arguments. :param start_node: The parental node the adding was initia...
[ "Adds", "a", "given", "item", "to", "the", "tree", "irrespective", "of", "the", "subtree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1093-L1230
[ "def", "_add_generic", "(", "self", ",", "start_node", ",", "type_name", ",", "group_type_name", ",", "args", ",", "kwargs", ",", "add_prefix", "=", "True", ",", "check_naming", "=", "True", ")", ":", "args", "=", "list", "(", "args", ")", "create_new", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._replace_wildcards
Replaces the $ wildcards and returns True/False in case it was replaced
pypet/naturalnaming.py
def _replace_wildcards(self, name, run_idx=None): """Replaces the $ wildcards and returns True/False in case it was replaced""" if self._root_instance.f_is_wildcard(name): return True, self._root_instance.f_wildcard(name, run_idx) else: return False, name
def _replace_wildcards(self, name, run_idx=None): """Replaces the $ wildcards and returns True/False in case it was replaced""" if self._root_instance.f_is_wildcard(name): return True, self._root_instance.f_wildcard(name, run_idx) else: return False, name
[ "Replaces", "the", "$", "wildcards", "and", "returns", "True", "/", "False", "in", "case", "it", "was", "replaced" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1232-L1237
[ "def", "_replace_wildcards", "(", "self", ",", "name", ",", "run_idx", "=", "None", ")", ":", "if", "self", ".", "_root_instance", ".", "f_is_wildcard", "(", "name", ")", ":", "return", "True", ",", "self", ".", "_root_instance", ".", "f_wildcard", "(", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._add_to_tree
Adds a new item to the tree. The item can be an already given instance or it is created new. :param start_node: Parental node the adding of the item was initiated from. :param split_names: List of names of the new item :param type_name: Type of ...
pypet/naturalnaming.py
def _add_to_tree(self, start_node, split_names, type_name, group_type_name, instance, constructor, args, kwargs): """Adds a new item to the tree. The item can be an already given instance or it is created new. :param start_node: Parental node the adding of the...
def _add_to_tree(self, start_node, split_names, type_name, group_type_name, instance, constructor, args, kwargs): """Adds a new item to the tree. The item can be an already given instance or it is created new. :param start_node: Parental node the adding of the...
[ "Adds", "a", "new", "item", "to", "the", "tree", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1261-L1377
[ "def", "_add_to_tree", "(", "self", ",", "start_node", ",", "split_names", ",", "type_name", ",", "group_type_name", ",", "instance", ",", "constructor", ",", "args", ",", "kwargs", ")", ":", "# Then walk iteratively from the start node as specified by the new name and cr...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._create_link
Creates a link and checks if names are appropriate
pypet/naturalnaming.py
def _create_link(self, act_node, name, instance): """Creates a link and checks if names are appropriate """ act_node._links[name] = instance act_node._children[name] = instance full_name = instance.v_full_name if full_name not in self._root_instance._linked_by: ...
def _create_link(self, act_node, name, instance): """Creates a link and checks if names are appropriate """ act_node._links[name] = instance act_node._children[name] = instance full_name = instance.v_full_name if full_name not in self._root_instance._linked_by: ...
[ "Creates", "a", "link", "and", "checks", "if", "names", "are", "appropriate" ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1398-L1420
[ "def", "_create_link", "(", "self", ",", "act_node", ",", "name", ",", "instance", ")", ":", "act_node", ".", "_links", "[", "name", "]", "=", "instance", "act_node", ".", "_children", "[", "name", "]", "=", "instance", "full_name", "=", "instance", ".",...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._check_names
Checks if a list contains strings with invalid names. Returns a description of the name violations. If names are correct the empty string is returned. :param split_names: List of strings :param parent_node: The parental node from where to start (only applicable for node n...
pypet/naturalnaming.py
def _check_names(self, split_names, parent_node=None): """Checks if a list contains strings with invalid names. Returns a description of the name violations. If names are correct the empty string is returned. :param split_names: List of strings :param parent_node: ...
def _check_names(self, split_names, parent_node=None): """Checks if a list contains strings with invalid names. Returns a description of the name violations. If names are correct the empty string is returned. :param split_names: List of strings :param parent_node: ...
[ "Checks", "if", "a", "list", "contains", "strings", "with", "invalid", "names", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1422-L1482
[ "def", "_check_names", "(", "self", ",", "split_names", ",", "parent_node", "=", "None", ")", ":", "faulty_names", "=", "''", "if", "parent_node", "is", "not", "None", "and", "parent_node", ".", "v_is_root", "and", "split_names", "[", "0", "]", "==", "'ove...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._create_any_group
Generically creates a new group inferring from the `type_name`.
pypet/naturalnaming.py
def _create_any_group(self, parent_node, name, type_name, instance=None, constructor=None, args=None, kwargs=None): """Generically creates a new group inferring from the `type_name`.""" if args is None: args = [] if kwargs is None: kwargs = {} ...
def _create_any_group(self, parent_node, name, type_name, instance=None, constructor=None, args=None, kwargs=None): """Generically creates a new group inferring from the `type_name`.""" if args is None: args = [] if kwargs is None: kwargs = {} ...
[ "Generically", "creates", "a", "new", "group", "inferring", "from", "the", "type_name", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1484-L1561
[ "def", "_create_any_group", "(", "self", ",", "parent_node", ",", "name", ",", "type_name", ",", "instance", "=", "None", ",", "constructor", "=", "None", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "args", "is", "None", ":", ...
97ad3e80d46dbdea02deeb98ea41f05a19565826
test
NaturalNamingInterface._create_any_param_or_result
Generically creates a novel parameter or result instance inferring from the `type_name`. If the instance is already supplied it is NOT constructed new. :param parent_node: Parent trajectory node :param name: Name of the new result or parameter. Here the name no longe...
pypet/naturalnaming.py
def _create_any_param_or_result(self, parent_node, name, type_name, instance, constructor, args, kwargs): """Generically creates a novel parameter or result instance inferring from the `type_name`. If the instance is already supplied it is NOT constructed new. ...
def _create_any_param_or_result(self, parent_node, name, type_name, instance, constructor, args, kwargs): """Generically creates a novel parameter or result instance inferring from the `type_name`. If the instance is already supplied it is NOT constructed new. ...
[ "Generically", "creates", "a", "novel", "parameter", "or", "result", "instance", "inferring", "from", "the", "type_name", "." ]
SmokinCaterpillar/pypet
python
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/naturalnaming.py#L1563-L1643
[ "def", "_create_any_param_or_result", "(", "self", ",", "parent_node", ",", "name", ",", "type_name", ",", "instance", ",", "constructor", ",", "args", ",", "kwargs", ")", ":", "root", "=", "self", ".", "_root_instance", "full_name", "=", "self", ".", "_make...
97ad3e80d46dbdea02deeb98ea41f05a19565826