repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
robotpy/pyfrc
lib/pyfrc/sim/field/user_renderer.py
UserRenderer.draw_text
def draw_text( self, text, pt, color="#000000", fontSize=10, robot_coordinates=False, scale=(1, 1), **kwargs ): """ :param text: Text to render :param pt: A tuple of (x,y) in field units (which are measured in feet) ...
python
def draw_text( self, text, pt, color="#000000", fontSize=10, robot_coordinates=False, scale=(1, 1), **kwargs ): """ :param text: Text to render :param pt: A tuple of (x,y) in field units (which are measured in feet) ...
[ "def", "draw_text", "(", "self", ",", "text", ",", "pt", ",", "color", "=", "\"#000000\"", ",", "fontSize", "=", "10", ",", "robot_coordinates", "=", "False", ",", "scale", "=", "(", "1", ",", "1", ")", ",", "*", "*", "kwargs", ")", ":", "x", ","...
:param text: Text to render :param pt: A tuple of (x,y) in field units (which are measured in feet) :param color: The color of the text, expressed as a 6-digit hex color :param robot_coordinates: If True, the pt will be adjusted such that the poi...
[ ":", "param", "text", ":", "Text", "to", "render", ":", "param", "pt", ":", "A", "tuple", "of", "(", "x", "y", ")", "in", "field", "units", "(", "which", "are", "measured", "in", "feet", ")", ":", "param", "color", ":", "The", "color", "of", "the...
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/field/user_renderer.py#L146-L187
openstack/monasca-common
monasca_common/kafka_lib/partitioner/hashed.py
murmur2
def murmur2(key): """Pure-python Murmur2 implementation. Based on java client, see org.apache.kafka.common.utils.Utils.murmur2 Args: key: if not a bytes type, encoded using default encoding Returns: MurmurHash2 of key bytearray """ # Convert key to bytes or bytearray if isinstanc...
python
def murmur2(key): """Pure-python Murmur2 implementation. Based on java client, see org.apache.kafka.common.utils.Utils.murmur2 Args: key: if not a bytes type, encoded using default encoding Returns: MurmurHash2 of key bytearray """ # Convert key to bytes or bytearray if isinstanc...
[ "def", "murmur2", "(", "key", ")", ":", "# Convert key to bytes or bytearray", "if", "isinstance", "(", "key", ",", "bytearray", ")", "or", "(", "six", ".", "PY3", "and", "isinstance", "(", "key", ",", "bytes", ")", ")", ":", "data", "=", "key", "else", ...
Pure-python Murmur2 implementation. Based on java client, see org.apache.kafka.common.utils.Utils.murmur2 Args: key: if not a bytes type, encoded using default encoding Returns: MurmurHash2 of key bytearray
[ "Pure", "-", "python", "Murmur2", "implementation", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/partitioner/hashed.py#L54-L122
openstack/monasca-common
monasca_common/policy/policy_engine.py
init
def init(policy_file=None, rules=None, default_rule=None, use_conf=True): """Init an Enforcer class. :param policy_file: Custom policy file to use, if none is specified, `CONF.policy_file` will be used. :param rules: Default dictionary / Rules to use. It will be ...
python
def init(policy_file=None, rules=None, default_rule=None, use_conf=True): """Init an Enforcer class. :param policy_file: Custom policy file to use, if none is specified, `CONF.policy_file` will be used. :param rules: Default dictionary / Rules to use. It will be ...
[ "def", "init", "(", "policy_file", "=", "None", ",", "rules", "=", "None", ",", "default_rule", "=", "None", ",", "use_conf", "=", "True", ")", ":", "global", "_ENFORCER", "global", "saved_file_rules", "if", "not", "_ENFORCER", ":", "_ENFORCER", "=", "poli...
Init an Enforcer class. :param policy_file: Custom policy file to use, if none is specified, `CONF.policy_file` will be used. :param rules: Default dictionary / Rules to use. It will be considered just in the first instantiation. :param default_rule:...
[ "Init", "an", "Enforcer", "class", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L52-L82
openstack/monasca-common
monasca_common/policy/policy_engine.py
_serialize_rules
def _serialize_rules(rules): """Serialize all the Rule object as string. New string is used to compare the rules list. """ result = [(rule_name, str(rule)) for rule_name, rule in rules.items()] return sorted(result, key=lambda rule: rule[0])
python
def _serialize_rules(rules): """Serialize all the Rule object as string. New string is used to compare the rules list. """ result = [(rule_name, str(rule)) for rule_name, rule in rules.items()] return sorted(result, key=lambda rule: rule[0])
[ "def", "_serialize_rules", "(", "rules", ")", ":", "result", "=", "[", "(", "rule_name", ",", "str", "(", "rule", ")", ")", "for", "rule_name", ",", "rule", "in", "rules", ".", "items", "(", ")", "]", "return", "sorted", "(", "result", ",", "key", ...
Serialize all the Rule object as string. New string is used to compare the rules list.
[ "Serialize", "all", "the", "Rule", "object", "as", "string", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L85-L91
openstack/monasca-common
monasca_common/policy/policy_engine.py
_warning_for_deprecated_user_based_rules
def _warning_for_deprecated_user_based_rules(rules): """Warning user based policy enforcement used in the rule but the rule doesn't support it. """ for rule in rules: # We will skip the warning for the resources which support user based # policy enforcement. if [resource for reso...
python
def _warning_for_deprecated_user_based_rules(rules): """Warning user based policy enforcement used in the rule but the rule doesn't support it. """ for rule in rules: # We will skip the warning for the resources which support user based # policy enforcement. if [resource for reso...
[ "def", "_warning_for_deprecated_user_based_rules", "(", "rules", ")", ":", "for", "rule", "in", "rules", ":", "# We will skip the warning for the resources which support user based", "# policy enforcement.", "if", "[", "resource", "for", "resource", "in", "USER_BASED_RESOURCES"...
Warning user based policy enforcement used in the rule but the rule doesn't support it.
[ "Warning", "user", "based", "policy", "enforcement", "used", "in", "the", "rule", "but", "the", "rule", "doesn", "t", "support", "it", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L94-L108
openstack/monasca-common
monasca_common/policy/policy_engine.py
authorize
def authorize(context, action, target, do_raise=True): """Verify that the action is valid on the target in this context. :param context: monasca project context :param action: String representing the action to be checked. This should be colon separated for clarity. :param target: Dic...
python
def authorize(context, action, target, do_raise=True): """Verify that the action is valid on the target in this context. :param context: monasca project context :param action: String representing the action to be checked. This should be colon separated for clarity. :param target: Dic...
[ "def", "authorize", "(", "context", ",", "action", ",", "target", ",", "do_raise", "=", "True", ")", ":", "init", "(", ")", "credentials", "=", "context", ".", "to_policy_values", "(", ")", "try", ":", "result", "=", "_ENFORCER", ".", "authorize", "(", ...
Verify that the action is valid on the target in this context. :param context: monasca project context :param action: String representing the action to be checked. This should be colon separated for clarity. :param target: Dictionary representing the object of the action for ...
[ "Verify", "that", "the", "action", "is", "valid", "on", "the", "target", "in", "this", "context", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L117-L151
openstack/monasca-common
monasca_common/policy/policy_engine.py
check_is_admin
def check_is_admin(context): """Check if roles contains 'admin' role according to policy settings.""" init() credentials = context.to_policy_values() target = credentials return _ENFORCER.authorize('admin_required', target, credentials)
python
def check_is_admin(context): """Check if roles contains 'admin' role according to policy settings.""" init() credentials = context.to_policy_values() target = credentials return _ENFORCER.authorize('admin_required', target, credentials)
[ "def", "check_is_admin", "(", "context", ")", ":", "init", "(", ")", "credentials", "=", "context", ".", "to_policy_values", "(", ")", "target", "=", "credentials", "return", "_ENFORCER", ".", "authorize", "(", "'admin_required'", ",", "target", ",", "credenti...
Check if roles contains 'admin' role according to policy settings.
[ "Check", "if", "roles", "contains", "admin", "role", "according", "to", "policy", "settings", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L154-L159
openstack/monasca-common
monasca_common/policy/policy_engine.py
set_rules
def set_rules(rules, overwrite=True, use_conf=False): # pragma: no cover """Set rules based on the provided dict of rules. Note: Used in tests only. :param rules: New rules to use. It should be an instance of dict :param overwrite: Whether to overwrite current rules or update them ...
python
def set_rules(rules, overwrite=True, use_conf=False): # pragma: no cover """Set rules based on the provided dict of rules. Note: Used in tests only. :param rules: New rules to use. It should be an instance of dict :param overwrite: Whether to overwrite current rules or update them ...
[ "def", "set_rules", "(", "rules", ",", "overwrite", "=", "True", ",", "use_conf", "=", "False", ")", ":", "# pragma: no cover", "init", "(", "use_conf", "=", "False", ")", "_ENFORCER", ".", "set_rules", "(", "rules", ",", "overwrite", ",", "use_conf", ")" ...
Set rules based on the provided dict of rules. Note: Used in tests only. :param rules: New rules to use. It should be an instance of dict :param overwrite: Whether to overwrite current rules or update them with the new rules. :param use_conf: Whether to reload rules from ...
[ "Set", "rules", "based", "on", "the", "provided", "dict", "of", "rules", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L162-L174
openstack/monasca-common
monasca_common/policy/policy_engine.py
verify_deprecated_policy
def verify_deprecated_policy(old_policy, new_policy, default_rule, context): """Check the rule of the deprecated policy action If the current rule of the deprecated policy action is set to a non-default value, then a warning message is logged stating that the new policy action should be used to dictate...
python
def verify_deprecated_policy(old_policy, new_policy, default_rule, context): """Check the rule of the deprecated policy action If the current rule of the deprecated policy action is set to a non-default value, then a warning message is logged stating that the new policy action should be used to dictate...
[ "def", "verify_deprecated_policy", "(", "old_policy", ",", "new_policy", ",", "default_rule", ",", "context", ")", ":", "if", "_ENFORCER", ":", "current_rule", "=", "str", "(", "_ENFORCER", ".", "rules", "[", "old_policy", "]", ")", "else", ":", "current_rule"...
Check the rule of the deprecated policy action If the current rule of the deprecated policy action is set to a non-default value, then a warning message is logged stating that the new policy action should be used to dictate permissions as the old policy action is being deprecated. :param old_polic...
[ "Check", "the", "rule", "of", "the", "deprecated", "policy", "action" ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/policy/policy_engine.py#L177-L206
partofthething/ace
ace/samples/wang04.py
build_sample_ace_problem_wang04
def build_sample_ace_problem_wang04(N=100): """Build sample problem from Wang 2004.""" x = [numpy.random.uniform(-1, 1, size=N) for _i in range(0, 5)] noise = numpy.random.standard_normal(N) y = numpy.log(4.0 + numpy.sin(4 * x[0]) + numpy.abs(x[1]) + x[2] ** 2 + x[3] ** 3 + x[...
python
def build_sample_ace_problem_wang04(N=100): """Build sample problem from Wang 2004.""" x = [numpy.random.uniform(-1, 1, size=N) for _i in range(0, 5)] noise = numpy.random.standard_normal(N) y = numpy.log(4.0 + numpy.sin(4 * x[0]) + numpy.abs(x[1]) + x[2] ** 2 + x[3] ** 3 + x[...
[ "def", "build_sample_ace_problem_wang04", "(", "N", "=", "100", ")", ":", "x", "=", "[", "numpy", ".", "random", ".", "uniform", "(", "-", "1", ",", "1", ",", "size", "=", "N", ")", "for", "_i", "in", "range", "(", "0", ",", "5", ")", "]", "noi...
Build sample problem from Wang 2004.
[ "Build", "sample", "problem", "from", "Wang", "2004", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/samples/wang04.py#L7-L14
partofthething/ace
ace/samples/wang04.py
run_wang04
def run_wang04(): """Run sample problem.""" x, y = build_sample_ace_problem_wang04(N=200) ace_solver = ace.ACESolver() ace_solver.specify_data_set(x, y) ace_solver.solve() try: ace.plot_transforms(ace_solver, 'ace_transforms_wang04.png') ace.plot_input(ace_solver, 'ace_input_wang...
python
def run_wang04(): """Run sample problem.""" x, y = build_sample_ace_problem_wang04(N=200) ace_solver = ace.ACESolver() ace_solver.specify_data_set(x, y) ace_solver.solve() try: ace.plot_transforms(ace_solver, 'ace_transforms_wang04.png') ace.plot_input(ace_solver, 'ace_input_wang...
[ "def", "run_wang04", "(", ")", ":", "x", ",", "y", "=", "build_sample_ace_problem_wang04", "(", "N", "=", "200", ")", "ace_solver", "=", "ace", ".", "ACESolver", "(", ")", "ace_solver", ".", "specify_data_set", "(", "x", ",", "y", ")", "ace_solver", ".",...
Run sample problem.
[ "Run", "sample", "problem", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/samples/wang04.py#L16-L28
robotpy/pyfrc
lib/pyfrc/sim/sim_manager.py
SimManager.add_robot
def add_robot(self, controller): """Add a robot controller""" # connect to the controller # -> this is to support module robots controller.on_mode_change(self._on_robot_mode_change) self.robots.append(controller)
python
def add_robot(self, controller): """Add a robot controller""" # connect to the controller # -> this is to support module robots controller.on_mode_change(self._on_robot_mode_change) self.robots.append(controller)
[ "def", "add_robot", "(", "self", ",", "controller", ")", ":", "# connect to the controller", "# -> this is to support module robots", "controller", ".", "on_mode_change", "(", "self", ".", "_on_robot_mode_change", ")", "self", ".", "robots", ".", "append", "(", "contr...
Add a robot controller
[ "Add", "a", "robot", "controller" ]
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/sim_manager.py#L42-L48
robotpy/pyfrc
lib/pyfrc/sim/sim_manager.py
SimManager.set_joystick
def set_joystick(self, x, y, n): """ Receives joystick values from the SnakeBoard x,y Coordinates n Robot number to give it to """ self.robots[n].set_joystick(x, y)
python
def set_joystick(self, x, y, n): """ Receives joystick values from the SnakeBoard x,y Coordinates n Robot number to give it to """ self.robots[n].set_joystick(x, y)
[ "def", "set_joystick", "(", "self", ",", "x", ",", "y", ",", "n", ")", ":", "self", ".", "robots", "[", "n", "]", ".", "set_joystick", "(", "x", ",", "y", ")" ]
Receives joystick values from the SnakeBoard x,y Coordinates n Robot number to give it to
[ "Receives", "joystick", "values", "from", "the", "SnakeBoard", "x", "y", "Coordinates", "n", "Robot", "number", "to", "give", "it", "to" ]
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/sim_manager.py#L74-L81
igorcoding/asynctnt
asynctnt/connection.py
Connection.disconnect
async def disconnect(self): """ Disconnect coroutine """ async with self._disconnect_lock: if self._state == ConnectionState.DISCONNECTED: return self._set_state(ConnectionState.DISCONNECTING) logger.info('%s Disconnecting...', s...
python
async def disconnect(self): """ Disconnect coroutine """ async with self._disconnect_lock: if self._state == ConnectionState.DISCONNECTED: return self._set_state(ConnectionState.DISCONNECTING) logger.info('%s Disconnecting...', s...
[ "async", "def", "disconnect", "(", "self", ")", ":", "async", "with", "self", ".", "_disconnect_lock", ":", "if", "self", ".", "_state", "==", "ConnectionState", ".", "DISCONNECTED", ":", "return", "self", ".", "_set_state", "(", "ConnectionState", ".", "DIS...
Disconnect coroutine
[ "Disconnect", "coroutine" ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L365-L399
igorcoding/asynctnt
asynctnt/connection.py
Connection.close
def close(self): """ Same as disconnect, but not a coroutine, i.e. it does not wait for disconnect to finish. """ if self._state == ConnectionState.DISCONNECTED: return self._set_state(ConnectionState.DISCONNECTING) logger.info('%s Disconnect...
python
def close(self): """ Same as disconnect, but not a coroutine, i.e. it does not wait for disconnect to finish. """ if self._state == ConnectionState.DISCONNECTED: return self._set_state(ConnectionState.DISCONNECTING) logger.info('%s Disconnect...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_state", "==", "ConnectionState", ".", "DISCONNECTED", ":", "return", "self", ".", "_set_state", "(", "ConnectionState", ".", "DISCONNECTING", ")", "logger", ".", "info", "(", "'%s Disconnecting...'", ...
Same as disconnect, but not a coroutine, i.e. it does not wait for disconnect to finish.
[ "Same", "as", "disconnect", "but", "not", "a", "coroutine", "i", ".", "e", ".", "it", "does", "not", "wait", "for", "disconnect", "to", "finish", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L401-L428
igorcoding/asynctnt
asynctnt/connection.py
Connection.call
def call(self, func_name, args=None, *, timeout=-1.0, push_subscribe=False) -> _MethodRet: """ Call request coroutine. It is a call with a new behaviour (return result of a Tarantool procedure is not wrapped into an extra tuple). If you're connecting to Tarantool...
python
def call(self, func_name, args=None, *, timeout=-1.0, push_subscribe=False) -> _MethodRet: """ Call request coroutine. It is a call with a new behaviour (return result of a Tarantool procedure is not wrapped into an extra tuple). If you're connecting to Tarantool...
[ "def", "call", "(", "self", ",", "func_name", ",", "args", "=", "None", ",", "*", ",", "timeout", "=", "-", "1.0", ",", "push_subscribe", "=", "False", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "call", "(", "func_name", ",", ...
Call request coroutine. It is a call with a new behaviour (return result of a Tarantool procedure is not wrapped into an extra tuple). If you're connecting to Tarantool with version < 1.7, then this call method acts like a call16 method Examples: .. code-blo...
[ "Call", "request", "coroutine", ".", "It", "is", "a", "call", "with", "a", "new", "behaviour", "(", "return", "result", "of", "a", "Tarantool", "procedure", "is", "not", "wrapped", "into", "an", "extra", "tuple", ")", ".", "If", "you", "re", "connecting"...
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L621-L652
igorcoding/asynctnt
asynctnt/connection.py
Connection.eval
def eval(self, expression, args=None, *, timeout=-1.0, push_subscribe=False) -> _MethodRet: """ Eval request coroutine. Examples: .. code-block:: pycon >>> await conn.eval('return 42') <Response sync=3 rowcount=1 data=[42]> ...
python
def eval(self, expression, args=None, *, timeout=-1.0, push_subscribe=False) -> _MethodRet: """ Eval request coroutine. Examples: .. code-block:: pycon >>> await conn.eval('return 42') <Response sync=3 rowcount=1 data=[42]> ...
[ "def", "eval", "(", "self", ",", "expression", ",", "args", "=", "None", ",", "*", ",", "timeout", "=", "-", "1.0", ",", "push_subscribe", "=", "False", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "eval", "(", "expression", ",", ...
Eval request coroutine. Examples: .. code-block:: pycon >>> await conn.eval('return 42') <Response sync=3 rowcount=1 data=[42]> >>> await conn.eval('return box.info.version') <Response sync=3 rowcount=1 data=['2.1.1-7-gd381a45b...
[ "Eval", "request", "coroutine", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L654-L679
igorcoding/asynctnt
asynctnt/connection.py
Connection.select
def select(self, space, key=None, **kwargs) -> _MethodRet: """ Select request coroutine. Examples: .. code-block:: pycon >>> await conn.select('tester') <Response sync=3 rowcount=2 data=[ <TarantoolTuple id=1 name='one'>,...
python
def select(self, space, key=None, **kwargs) -> _MethodRet: """ Select request coroutine. Examples: .. code-block:: pycon >>> await conn.select('tester') <Response sync=3 rowcount=2 data=[ <TarantoolTuple id=1 name='one'>,...
[ "def", "select", "(", "self", ",", "space", ",", "key", "=", "None", ",", "*", "*", "kwargs", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "select", "(", "space", ",", "key", ",", "*", "*", "kwargs", ")" ]
Select request coroutine. Examples: .. code-block:: pycon >>> await conn.select('tester') <Response sync=3 rowcount=2 data=[ <TarantoolTuple id=1 name='one'>, <TarantoolTuple id=2 name='two'> ]> ...
[ "Select", "request", "coroutine", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L681-L724
igorcoding/asynctnt
asynctnt/connection.py
Connection.insert
def insert(self, space, t, *, replace=False, timeout=-1) -> _MethodRet: """ Insert request coroutine. Examples: .. code-block:: pycon # Basic usage >>> await conn.insert('tester', [0, 'hello']) <Response sync=3 rowcount=1 dat...
python
def insert(self, space, t, *, replace=False, timeout=-1) -> _MethodRet: """ Insert request coroutine. Examples: .. code-block:: pycon # Basic usage >>> await conn.insert('tester', [0, 'hello']) <Response sync=3 rowcount=1 dat...
[ "def", "insert", "(", "self", ",", "space", ",", "t", ",", "*", ",", "replace", "=", "False", ",", "timeout", "=", "-", "1", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "insert", "(", "space", ",", "t", ",", "replace", "=", ...
Insert request coroutine. Examples: .. code-block:: pycon # Basic usage >>> await conn.insert('tester', [0, 'hello']) <Response sync=3 rowcount=1 data=[ <TarantoolTuple id=0 name='hello'> ]> #...
[ "Insert", "request", "coroutine", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L726-L758
igorcoding/asynctnt
asynctnt/connection.py
Connection.replace
def replace(self, space, t, *, timeout=-1.0) -> _MethodRet: """ Replace request coroutine. Same as insert, but replace. :param space: space id or space name. :param t: tuple to insert (list object) :param timeout: Request timeout :returns: :class:`as...
python
def replace(self, space, t, *, timeout=-1.0) -> _MethodRet: """ Replace request coroutine. Same as insert, but replace. :param space: space id or space name. :param t: tuple to insert (list object) :param timeout: Request timeout :returns: :class:`as...
[ "def", "replace", "(", "self", ",", "space", ",", "t", ",", "*", ",", "timeout", "=", "-", "1.0", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "replace", "(", "space", ",", "t", ",", "timeout", "=", "timeout", ")" ]
Replace request coroutine. Same as insert, but replace. :param space: space id or space name. :param t: tuple to insert (list object) :param timeout: Request timeout :returns: :class:`asynctnt.Response` instance
[ "Replace", "request", "coroutine", ".", "Same", "as", "insert", "but", "replace", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L760-L770
igorcoding/asynctnt
asynctnt/connection.py
Connection.delete
def delete(self, space, key, **kwargs) -> _MethodRet: """ Delete request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.delete('tester', [0]) <Response sync=3 rowco...
python
def delete(self, space, key, **kwargs) -> _MethodRet: """ Delete request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.delete('tester', [0]) <Response sync=3 rowco...
[ "def", "delete", "(", "self", ",", "space", ",", "key", ",", "*", "*", "kwargs", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "delete", "(", "space", ",", "key", ",", "*", "*", "kwargs", ")" ]
Delete request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.delete('tester', [0]) <Response sync=3 rowcount=1 data=[ <TarantoolTuple id=0 name='hello'> ...
[ "Delete", "request", "coroutine", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L772-L794
igorcoding/asynctnt
asynctnt/connection.py
Connection.update
def update(self, space, key, operations, **kwargs) -> _MethodRet: """ Update request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.update('tester', [0], [ ['=', 1, 'hi!'] ]) ...
python
def update(self, space, key, operations, **kwargs) -> _MethodRet: """ Update request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.update('tester', [0], [ ['=', 1, 'hi!'] ]) ...
[ "def", "update", "(", "self", ",", "space", ",", "key", ",", "operations", ",", "*", "*", "kwargs", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "update", "(", "space", ",", "key", ",", "operations", ",", "*", "*", "kwargs", ")"...
Update request coroutine. Examples: .. code-block:: pycon # Assuming tuple [0, 'hello'] is in space tester >>> await conn.update('tester', [0], [ ['=', 1, 'hi!'] ]) <Response sync=3 rowcount=1 data=[ <TarantoolTuple id=0 nam...
[ "Update", "request", "coroutine", "." ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L796-L832
igorcoding/asynctnt
asynctnt/connection.py
Connection.upsert
def upsert(self, space, t, operations, **kwargs) -> _MethodRet: """ Update request coroutine. Performs either insert or update (depending of either tuple exists or not) Examples: .. code-block:: pycon # upsert does not return anything ...
python
def upsert(self, space, t, operations, **kwargs) -> _MethodRet: """ Update request coroutine. Performs either insert or update (depending of either tuple exists or not) Examples: .. code-block:: pycon # upsert does not return anything ...
[ "def", "upsert", "(", "self", ",", "space", ",", "t", ",", "operations", ",", "*", "*", "kwargs", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "upsert", "(", "space", ",", "t", ",", "operations", ",", "*", "*", "kwargs", ")" ]
Update request coroutine. Performs either insert or update (depending of either tuple exists or not) Examples: .. code-block:: pycon # upsert does not return anything >>> await conn.upsert('tester', [0, 'hello'], ... ...
[ "Update", "request", "coroutine", ".", "Performs", "either", "insert", "or", "update", "(", "depending", "of", "either", "tuple", "exists", "or", "not", ")" ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L834-L862
igorcoding/asynctnt
asynctnt/connection.py
Connection.sql
def sql(self, query, args=None, *, parse_metadata=True, timeout=-1.0) -> _MethodRet: """ Executes an SQL statement (only for Tarantool > 2) Examples: .. code-block:: pycon >>> await conn.sql("select 1 as a, 2 as b") <Response syn...
python
def sql(self, query, args=None, *, parse_metadata=True, timeout=-1.0) -> _MethodRet: """ Executes an SQL statement (only for Tarantool > 2) Examples: .. code-block:: pycon >>> await conn.sql("select 1 as a, 2 as b") <Response syn...
[ "def", "sql", "(", "self", ",", "query", ",", "args", "=", "None", ",", "*", ",", "parse_metadata", "=", "True", ",", "timeout", "=", "-", "1.0", ")", "->", "_MethodRet", ":", "return", "self", ".", "_db", ".", "sql", "(", "query", ",", "args", "...
Executes an SQL statement (only for Tarantool > 2) Examples: .. code-block:: pycon >>> await conn.sql("select 1 as a, 2 as b") <Response sync=3 rowcount=1 data=[<TarantoolTuple A=1 B=2>]> >>> await conn.sql("select * from sql_space") ...
[ "Executes", "an", "SQL", "statement", "(", "only", "for", "Tarantool", ">", "2", ")" ]
train
https://github.com/igorcoding/asynctnt/blob/6a25833ed6ab4831aeefac596539171693f846fe/asynctnt/connection.py#L864-L899
partofthething/ace
ace/supersmoother.py
SuperSmoother.compute
def compute(self): """Run the SuperSmoother.""" self._compute_primary_smooths() self._smooth_the_residuals() self._select_best_smooth_at_each_point() self._enhance_bass() self._smooth_best_span_estimates() self._apply_best_spans_to_primaries() self._smooth...
python
def compute(self): """Run the SuperSmoother.""" self._compute_primary_smooths() self._smooth_the_residuals() self._select_best_smooth_at_each_point() self._enhance_bass() self._smooth_best_span_estimates() self._apply_best_spans_to_primaries() self._smooth...
[ "def", "compute", "(", "self", ")", ":", "self", ".", "_compute_primary_smooths", "(", ")", "self", ".", "_smooth_the_residuals", "(", ")", "self", ".", "_select_best_smooth_at_each_point", "(", ")", "self", ".", "_enhance_bass", "(", ")", "self", ".", "_smoot...
Run the SuperSmoother.
[ "Run", "the", "SuperSmoother", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L53-L62
partofthething/ace
ace/supersmoother.py
SuperSmoother._compute_primary_smooths
def _compute_primary_smooths(self): """Compute fixed-span smooths with all of the default spans.""" for span in DEFAULT_SPANS: smooth = smoother.perform_smooth(self.x, self.y, span) self._primary_smooths.append(smooth)
python
def _compute_primary_smooths(self): """Compute fixed-span smooths with all of the default spans.""" for span in DEFAULT_SPANS: smooth = smoother.perform_smooth(self.x, self.y, span) self._primary_smooths.append(smooth)
[ "def", "_compute_primary_smooths", "(", "self", ")", ":", "for", "span", "in", "DEFAULT_SPANS", ":", "smooth", "=", "smoother", ".", "perform_smooth", "(", "self", ".", "x", ",", "self", ".", "y", ",", "span", ")", "self", ".", "_primary_smooths", ".", "...
Compute fixed-span smooths with all of the default spans.
[ "Compute", "fixed", "-", "span", "smooths", "with", "all", "of", "the", "default", "spans", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L64-L68
partofthething/ace
ace/supersmoother.py
SuperSmoother._smooth_the_residuals
def _smooth_the_residuals(self): """ Apply the MID_SPAN to the residuals of the primary smooths. "For stability reasons, it turns out to be a little better to smooth |r_{i}(J)| against xi" - [1] """ for primary_smooth in self._primary_smooths: smooth = smooth...
python
def _smooth_the_residuals(self): """ Apply the MID_SPAN to the residuals of the primary smooths. "For stability reasons, it turns out to be a little better to smooth |r_{i}(J)| against xi" - [1] """ for primary_smooth in self._primary_smooths: smooth = smooth...
[ "def", "_smooth_the_residuals", "(", "self", ")", ":", "for", "primary_smooth", "in", "self", ".", "_primary_smooths", ":", "smooth", "=", "smoother", ".", "perform_smooth", "(", "self", ".", "x", ",", "primary_smooth", ".", "cross_validated_residual", ",", "MID...
Apply the MID_SPAN to the residuals of the primary smooths. "For stability reasons, it turns out to be a little better to smooth |r_{i}(J)| against xi" - [1]
[ "Apply", "the", "MID_SPAN", "to", "the", "residuals", "of", "the", "primary", "smooths", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L70-L81
partofthething/ace
ace/supersmoother.py
SuperSmoother._select_best_smooth_at_each_point
def _select_best_smooth_at_each_point(self): """ Solve Eq (10) to find the best span for each observation. Stores index so we can easily grab the best residual smooth, primary smooth, etc. """ for residuals_i in zip(*self._residual_smooths): index_of_best_span = resi...
python
def _select_best_smooth_at_each_point(self): """ Solve Eq (10) to find the best span for each observation. Stores index so we can easily grab the best residual smooth, primary smooth, etc. """ for residuals_i in zip(*self._residual_smooths): index_of_best_span = resi...
[ "def", "_select_best_smooth_at_each_point", "(", "self", ")", ":", "for", "residuals_i", "in", "zip", "(", "*", "self", ".", "_residual_smooths", ")", ":", "index_of_best_span", "=", "residuals_i", ".", "index", "(", "min", "(", "residuals_i", ")", ")", "self"...
Solve Eq (10) to find the best span for each observation. Stores index so we can easily grab the best residual smooth, primary smooth, etc.
[ "Solve", "Eq", "(", "10", ")", "to", "find", "the", "best", "span", "for", "each", "observation", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L83-L91
partofthething/ace
ace/supersmoother.py
SuperSmoother._enhance_bass
def _enhance_bass(self): """Update best span choices with bass enhancement as requested by user (Eq. 11).""" if not self._bass_enhancement: # like in supsmu, skip if alpha=0 return bass_span = DEFAULT_SPANS[BASS_INDEX] enhanced_spans = [] for i, best_span_...
python
def _enhance_bass(self): """Update best span choices with bass enhancement as requested by user (Eq. 11).""" if not self._bass_enhancement: # like in supsmu, skip if alpha=0 return bass_span = DEFAULT_SPANS[BASS_INDEX] enhanced_spans = [] for i, best_span_...
[ "def", "_enhance_bass", "(", "self", ")", ":", "if", "not", "self", ".", "_bass_enhancement", ":", "# like in supsmu, skip if alpha=0", "return", "bass_span", "=", "DEFAULT_SPANS", "[", "BASS_INDEX", "]", "enhanced_spans", "=", "[", "]", "for", "i", ",", "best_s...
Update best span choices with bass enhancement as requested by user (Eq. 11).
[ "Update", "best", "span", "choices", "with", "bass", "enhancement", "as", "requested", "by", "user", "(", "Eq", ".", "11", ")", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L93-L111
partofthething/ace
ace/supersmoother.py
SuperSmoother._smooth_best_span_estimates
def _smooth_best_span_estimates(self): """Apply a MID_SPAN smooth to the best span estimates at each observation.""" self._smoothed_best_spans = smoother.perform_smooth(self.x, self._best_span_at_each_point, ...
python
def _smooth_best_span_estimates(self): """Apply a MID_SPAN smooth to the best span estimates at each observation.""" self._smoothed_best_spans = smoother.perform_smooth(self.x, self._best_span_at_each_point, ...
[ "def", "_smooth_best_span_estimates", "(", "self", ")", ":", "self", ".", "_smoothed_best_spans", "=", "smoother", ".", "perform_smooth", "(", "self", ".", "x", ",", "self", ".", "_best_span_at_each_point", ",", "MID_SPAN", ")" ]
Apply a MID_SPAN smooth to the best span estimates at each observation.
[ "Apply", "a", "MID_SPAN", "smooth", "to", "the", "best", "span", "estimates", "at", "each", "observation", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L113-L117
partofthething/ace
ace/supersmoother.py
SuperSmoother._apply_best_spans_to_primaries
def _apply_best_spans_to_primaries(self): """ Apply best spans. Given the best span, interpolate to compute the best smoothed value at each observation. """ self.smooth_result = [] for xi, best_span in enumerate(self._smoothed_best_spans.smooth_result): ...
python
def _apply_best_spans_to_primaries(self): """ Apply best spans. Given the best span, interpolate to compute the best smoothed value at each observation. """ self.smooth_result = [] for xi, best_span in enumerate(self._smoothed_best_spans.smooth_result): ...
[ "def", "_apply_best_spans_to_primaries", "(", "self", ")", ":", "self", ".", "smooth_result", "=", "[", "]", "for", "xi", ",", "best_span", "in", "enumerate", "(", "self", ".", "_smoothed_best_spans", ".", "smooth_result", ")", ":", "primary_values", "=", "[",...
Apply best spans. Given the best span, interpolate to compute the best smoothed value at each observation.
[ "Apply", "best", "spans", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L119-L131
partofthething/ace
ace/supersmoother.py
SuperSmoother._smooth_interpolated_smooth
def _smooth_interpolated_smooth(self): """ Smooth interpolated results with tweeter span. A final step of the supersmoother is to smooth the interpolated values with the tweeter span. This is done in Breiman's supsmu.f but is not explicitly discussed in the publication. This ste...
python
def _smooth_interpolated_smooth(self): """ Smooth interpolated results with tweeter span. A final step of the supersmoother is to smooth the interpolated values with the tweeter span. This is done in Breiman's supsmu.f but is not explicitly discussed in the publication. This ste...
[ "def", "_smooth_interpolated_smooth", "(", "self", ")", ":", "smoothed_results", "=", "smoother", ".", "perform_smooth", "(", "self", ".", "x", ",", "self", ".", "smooth_result", ",", "TWEETER_SPAN", ")", "self", ".", "smooth_result", "=", "smoothed_results", "....
Smooth interpolated results with tweeter span. A final step of the supersmoother is to smooth the interpolated values with the tweeter span. This is done in Breiman's supsmu.f but is not explicitly discussed in the publication. This step is necessary to match the FORTRAN version perfect...
[ "Smooth", "interpolated", "results", "with", "tweeter", "span", "." ]
train
https://github.com/partofthething/ace/blob/1593a49f3c2e845514323e9c36ee253fe77bac3c/ace/supersmoother.py#L133-L145
openstack/monasca-common
monasca_common/kafka_lib/consumer/multiprocess.py
_mp_consume
def _mp_consume(client, group, topic, queue, size, events, **consumer_options): """ A child process worker which consumes messages based on the notifications given by the controller process NOTE: Ideally, this should have been a method inside the Consumer class. However, multiprocessing module has ...
python
def _mp_consume(client, group, topic, queue, size, events, **consumer_options): """ A child process worker which consumes messages based on the notifications given by the controller process NOTE: Ideally, this should have been a method inside the Consumer class. However, multiprocessing module has ...
[ "def", "_mp_consume", "(", "client", ",", "group", ",", "topic", ",", "queue", ",", "size", ",", "events", ",", "*", "*", "consumer_options", ")", ":", "# Initial interval for retries in seconds.", "interval", "=", "1", "while", "not", "events", ".", "exit", ...
A child process worker which consumes messages based on the notifications given by the controller process NOTE: Ideally, this should have been a method inside the Consumer class. However, multiprocessing module has issues in windows. The functionality breaks unless this function is kept outside of a cl...
[ "A", "child", "process", "worker", "which", "consumes", "messages", "based", "on", "the", "notifications", "given", "by", "the", "controller", "process" ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/consumer/multiprocess.py#L40-L112
robotpy/pyfrc
lib/pyfrc/sim/field/elements.py
DrawableElement.move
def move(self, v): """v is a tuple of x/y coordinates to move object""" # rotate movement vector according to the angle of the object vx, vy = v vx, vy = ( vx * math.cos(self.angle) - vy * math.sin(self.angle), vx * math.sin(self.angle) + vy * math.cos(self.angle...
python
def move(self, v): """v is a tuple of x/y coordinates to move object""" # rotate movement vector according to the angle of the object vx, vy = v vx, vy = ( vx * math.cos(self.angle) - vy * math.sin(self.angle), vx * math.sin(self.angle) + vy * math.cos(self.angle...
[ "def", "move", "(", "self", ",", "v", ")", ":", "# rotate movement vector according to the angle of the object", "vx", ",", "vy", "=", "v", "vx", ",", "vy", "=", "(", "vx", "*", "math", ".", "cos", "(", "self", ".", "angle", ")", "-", "vy", "*", "math"...
v is a tuple of x/y coordinates to move object
[ "v", "is", "a", "tuple", "of", "x", "/", "y", "coordinates", "to", "move", "object" ]
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/field/elements.py#L36-L53
robotpy/pyfrc
lib/pyfrc/sim/field/elements.py
DrawableElement.rotate
def rotate(self, angle): """ This works. Rotates the object about its center. Angle is specified in radians """ self.angle = (self.angle + angle) % (math.pi * 2.0) # precalculate these parameters c = math.cos(angle) s = math.sin(angl...
python
def rotate(self, angle): """ This works. Rotates the object about its center. Angle is specified in radians """ self.angle = (self.angle + angle) % (math.pi * 2.0) # precalculate these parameters c = math.cos(angle) s = math.sin(angl...
[ "def", "rotate", "(", "self", ",", "angle", ")", ":", "self", ".", "angle", "=", "(", "self", ".", "angle", "+", "angle", ")", "%", "(", "math", ".", "pi", "*", "2.0", ")", "# precalculate these parameters", "c", "=", "math", ".", "cos", "(", "angl...
This works. Rotates the object about its center. Angle is specified in radians
[ "This", "works", ".", "Rotates", "the", "object", "about", "its", "center", ".", "Angle", "is", "specified", "in", "radians" ]
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/field/elements.py#L55-L79
openstack/monasca-common
monasca_common/confluent_kafka/producer.py
KafkaProducer.delivery_report
def delivery_report(err, msg): """ Callback called once for each produced message to indicate the final delivery result. Triggered by poll() or flush(). :param confluent_kafka.KafkaError err: Information about any error that occurred whilst producing the message. :param ...
python
def delivery_report(err, msg): """ Callback called once for each produced message to indicate the final delivery result. Triggered by poll() or flush(). :param confluent_kafka.KafkaError err: Information about any error that occurred whilst producing the message. :param ...
[ "def", "delivery_report", "(", "err", ",", "msg", ")", ":", "if", "err", "is", "not", "None", ":", "log", ".", "exception", "(", "u'Message delivery failed: {}'", ".", "format", "(", "err", ")", ")", "raise", "confluent_kafka", ".", "KafkaException", "(", ...
Callback called once for each produced message to indicate the final delivery result. Triggered by poll() or flush(). :param confluent_kafka.KafkaError err: Information about any error that occurred whilst producing the message. :param confluent_kafka.Message msg: Information about the ...
[ "Callback", "called", "once", "for", "each", "produced", "message", "to", "indicate", "the", "final", "delivery", "result", ".", "Triggered", "by", "poll", "()", "or", "flush", "()", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/confluent_kafka/producer.py#L37-L55
openstack/monasca-common
monasca_common/confluent_kafka/producer.py
KafkaProducer.publish
def publish(self, topic, messages, key=None, timeout=2): """ Publish messages to the topic. :param str topic: Topic to produce messages to. :param list(str) messages: List of message payloads. :param str key: Message key. :param float timeout: Maximum time to block in s...
python
def publish(self, topic, messages, key=None, timeout=2): """ Publish messages to the topic. :param str topic: Topic to produce messages to. :param list(str) messages: List of message payloads. :param str key: Message key. :param float timeout: Maximum time to block in s...
[ "def", "publish", "(", "self", ",", "topic", ",", "messages", ",", "key", "=", "None", ",", "timeout", "=", "2", ")", ":", "if", "not", "isinstance", "(", "messages", ",", "list", ")", ":", "messages", "=", "[", "messages", "]", "try", ":", "for", ...
Publish messages to the topic. :param str topic: Topic to produce messages to. :param list(str) messages: List of message payloads. :param str key: Message key. :param float timeout: Maximum time to block in seconds. :returns: Number of messages still in queue. :rtype i...
[ "Publish", "messages", "to", "the", "topic", "." ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/confluent_kafka/producer.py#L57-L84
robotpy/pyfrc
lib/pyfrc/sim/sim_time.py
FakeRealTime.increment_time_by
def increment_time_by(self, secs): """This is called when wpilib.Timer.delay() occurs""" self.slept = [True] * 3 was_paused = False with self.lock: self._increment_tm(secs) while self.paused and secs > 0: if self.pause_secs is not None: ...
python
def increment_time_by(self, secs): """This is called when wpilib.Timer.delay() occurs""" self.slept = [True] * 3 was_paused = False with self.lock: self._increment_tm(secs) while self.paused and secs > 0: if self.pause_secs is not None: ...
[ "def", "increment_time_by", "(", "self", ",", "secs", ")", ":", "self", ".", "slept", "=", "[", "True", "]", "*", "3", "was_paused", "=", "False", "with", "self", ".", "lock", ":", "self", ".", "_increment_tm", "(", "secs", ")", "while", "self", ".",...
This is called when wpilib.Timer.delay() occurs
[ "This", "is", "called", "when", "wpilib", ".", "Timer", ".", "delay", "()", "occurs" ]
train
https://github.com/robotpy/pyfrc/blob/7672ea3f17c8d4b702a9f18a7372d95feee7e37d/lib/pyfrc/sim/sim_time.py#L62-L93
openstack/monasca-common
monasca_common/kafka_lib/producer/base.py
_send_upstream
def _send_upstream(queue, client, codec, batch_time, batch_size, req_acks, ack_timeout, retry_options, stop_event, log_messages_on_error=ASYNC_LOG_MESSAGES_ON_ERROR, stop_timeout=ASYNC_STOP_TIMEOUT_SECS, codec_compresslevel=None): """Privat...
python
def _send_upstream(queue, client, codec, batch_time, batch_size, req_acks, ack_timeout, retry_options, stop_event, log_messages_on_error=ASYNC_LOG_MESSAGES_ON_ERROR, stop_timeout=ASYNC_STOP_TIMEOUT_SECS, codec_compresslevel=None): """Privat...
[ "def", "_send_upstream", "(", "queue", ",", "client", ",", "codec", ",", "batch_time", ",", "batch_size", ",", "req_acks", ",", "ack_timeout", ",", "retry_options", ",", "stop_event", ",", "log_messages_on_error", "=", "ASYNC_LOG_MESSAGES_ON_ERROR", ",", "stop_timeo...
Private method to manage producing messages asynchronously Listens on the queue for a specified number of messages or until a specified timeout and then sends messages to the brokers in grouped requests (one per broker). Messages placed on the queue should be tuples that conform to this format: ...
[ "Private", "method", "to", "manage", "producing", "messages", "asynchronously" ]
train
https://github.com/openstack/monasca-common/blob/61e2e00454734e2881611abec8df0d85bf7655ac/monasca_common/kafka_lib/producer/base.py#L59-L233
nephila/djangocms-page-sitemap
djangocms_page_sitemap/utils.py
get_cache_key
def get_cache_key(page): """ Create the cache key for the current page and language """ try: site_id = page.node.site_id except AttributeError: site_id = page.site_id return _get_cache_key('page_sitemap', page, 'default', site_id)
python
def get_cache_key(page): """ Create the cache key for the current page and language """ try: site_id = page.node.site_id except AttributeError: site_id = page.site_id return _get_cache_key('page_sitemap', page, 'default', site_id)
[ "def", "get_cache_key", "(", "page", ")", ":", "try", ":", "site_id", "=", "page", ".", "node", ".", "site_id", "except", "AttributeError", ":", "site_id", "=", "page", ".", "site_id", "return", "_get_cache_key", "(", "'page_sitemap'", ",", "page", ",", "'...
Create the cache key for the current page and language
[ "Create", "the", "cache", "key", "for", "the", "current", "page", "and", "language" ]
train
https://github.com/nephila/djangocms-page-sitemap/blob/0d89365e5513471b603c99c60dba6d1101f19d53/djangocms_page_sitemap/utils.py#L7-L15
StagPython/StagPy
stagpy/misc.py
out_name
def out_name(stem, timestep=None): """Return StagPy out file name. Args: stem (str): short description of file content. timestep (int): timestep if relevant. Returns: str: the output file name. Other Parameters: conf.core.outname (str): the generic name stem, defaults ...
python
def out_name(stem, timestep=None): """Return StagPy out file name. Args: stem (str): short description of file content. timestep (int): timestep if relevant. Returns: str: the output file name. Other Parameters: conf.core.outname (str): the generic name stem, defaults ...
[ "def", "out_name", "(", "stem", ",", "timestep", "=", "None", ")", ":", "if", "timestep", "is", "not", "None", ":", "stem", "=", "(", "stem", "+", "INT_FMT", ")", ".", "format", "(", "timestep", ")", "return", "conf", ".", "core", ".", "outname", "...
Return StagPy out file name. Args: stem (str): short description of file content. timestep (int): timestep if relevant. Returns: str: the output file name. Other Parameters: conf.core.outname (str): the generic name stem, defaults to ``'stagpy'``.
[ "Return", "StagPy", "out", "file", "name", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L15-L31
StagPython/StagPy
stagpy/misc.py
saveplot
def saveplot(fig, *name_args, close=True, **name_kwargs): """Save matplotlib figure. You need to provide :data:`stem` as a positional or keyword argument (see :func:`out_name`). Args: fig (:class:`matplotlib.figure.Figure`): matplotlib figure. close (bool): whether to close the figure....
python
def saveplot(fig, *name_args, close=True, **name_kwargs): """Save matplotlib figure. You need to provide :data:`stem` as a positional or keyword argument (see :func:`out_name`). Args: fig (:class:`matplotlib.figure.Figure`): matplotlib figure. close (bool): whether to close the figure....
[ "def", "saveplot", "(", "fig", ",", "*", "name_args", ",", "close", "=", "True", ",", "*", "*", "name_kwargs", ")", ":", "oname", "=", "out_name", "(", "*", "name_args", ",", "*", "*", "name_kwargs", ")", "fig", ".", "savefig", "(", "'{}.{}'", ".", ...
Save matplotlib figure. You need to provide :data:`stem` as a positional or keyword argument (see :func:`out_name`). Args: fig (:class:`matplotlib.figure.Figure`): matplotlib figure. close (bool): whether to close the figure. name_args: positional arguments passed on to :func:`out_...
[ "Save", "matplotlib", "figure", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L34-L50
StagPython/StagPy
stagpy/misc.py
baredoc
def baredoc(obj): """Return the first line of the docstring of an object. Trailing periods and spaces as well as leading spaces are removed from the output. Args: obj: any Python object. Returns: str: the first line of the docstring of obj. """ doc = getdoc(obj) if not ...
python
def baredoc(obj): """Return the first line of the docstring of an object. Trailing periods and spaces as well as leading spaces are removed from the output. Args: obj: any Python object. Returns: str: the first line of the docstring of obj. """ doc = getdoc(obj) if not ...
[ "def", "baredoc", "(", "obj", ")", ":", "doc", "=", "getdoc", "(", "obj", ")", "if", "not", "doc", ":", "return", "''", "doc", "=", "doc", ".", "splitlines", "(", ")", "[", "0", "]", "return", "doc", ".", "rstrip", "(", "' .'", ")", ".", "lstri...
Return the first line of the docstring of an object. Trailing periods and spaces as well as leading spaces are removed from the output. Args: obj: any Python object. Returns: str: the first line of the docstring of obj.
[ "Return", "the", "first", "line", "of", "the", "docstring", "of", "an", "object", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L53-L68
StagPython/StagPy
stagpy/misc.py
fmttime
def fmttime(tin): """Return LaTeX expression with time in scientific notation. Args: tin (float): the time. Returns: str: the LaTeX expression. """ aaa, bbb = '{:.2e}'.format(tin).split('e') bbb = int(bbb) return r'$t={} \times 10^{{{}}}$'.format(aaa, bbb)
python
def fmttime(tin): """Return LaTeX expression with time in scientific notation. Args: tin (float): the time. Returns: str: the LaTeX expression. """ aaa, bbb = '{:.2e}'.format(tin).split('e') bbb = int(bbb) return r'$t={} \times 10^{{{}}}$'.format(aaa, bbb)
[ "def", "fmttime", "(", "tin", ")", ":", "aaa", ",", "bbb", "=", "'{:.2e}'", ".", "format", "(", "tin", ")", ".", "split", "(", "'e'", ")", "bbb", "=", "int", "(", "bbb", ")", "return", "r'$t={} \\times 10^{{{}}}$'", ".", "format", "(", "aaa", ",", ...
Return LaTeX expression with time in scientific notation. Args: tin (float): the time. Returns: str: the LaTeX expression.
[ "Return", "LaTeX", "expression", "with", "time", "in", "scientific", "notation", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L71-L81
StagPython/StagPy
stagpy/misc.py
list_of_vars
def list_of_vars(arg_plot): """Construct list of variables per plot. Args: arg_plot (str): string with variable names separated with ``_`` (figures), ``.`` (subplots) and ``,`` (same subplot). Returns: three nested lists of str - variables on the same subplot; -...
python
def list_of_vars(arg_plot): """Construct list of variables per plot. Args: arg_plot (str): string with variable names separated with ``_`` (figures), ``.`` (subplots) and ``,`` (same subplot). Returns: three nested lists of str - variables on the same subplot; -...
[ "def", "list_of_vars", "(", "arg_plot", ")", ":", "lovs", "=", "[", "[", "[", "var", "for", "var", "in", "svars", ".", "split", "(", "','", ")", "if", "var", "]", "for", "svars", "in", "pvars", ".", "split", "(", "'.'", ")", "if", "svars", "]", ...
Construct list of variables per plot. Args: arg_plot (str): string with variable names separated with ``_`` (figures), ``.`` (subplots) and ``,`` (same subplot). Returns: three nested lists of str - variables on the same subplot; - subplots on the same figure; ...
[ "Construct", "list", "of", "variables", "per", "plot", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L84-L101
StagPython/StagPy
stagpy/misc.py
set_of_vars
def set_of_vars(lovs): """Build set of variables from list. Args: lovs: nested lists of variables such as the one produced by :func:`list_of_vars`. Returns: set of str: flattened set of all the variables present in the nested lists. """ return set(var for pvars i...
python
def set_of_vars(lovs): """Build set of variables from list. Args: lovs: nested lists of variables such as the one produced by :func:`list_of_vars`. Returns: set of str: flattened set of all the variables present in the nested lists. """ return set(var for pvars i...
[ "def", "set_of_vars", "(", "lovs", ")", ":", "return", "set", "(", "var", "for", "pvars", "in", "lovs", "for", "svars", "in", "pvars", "for", "var", "in", "svars", ")" ]
Build set of variables from list. Args: lovs: nested lists of variables such as the one produced by :func:`list_of_vars`. Returns: set of str: flattened set of all the variables present in the nested lists.
[ "Build", "set", "of", "variables", "from", "list", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L104-L114
StagPython/StagPy
stagpy/misc.py
get_rbounds
def get_rbounds(step): """Radial or vertical position of boundaries. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of floats: radial or vertical positions of boundaries of the domain. """ if step.geom is not None:...
python
def get_rbounds(step): """Radial or vertical position of boundaries. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of floats: radial or vertical positions of boundaries of the domain. """ if step.geom is not None:...
[ "def", "get_rbounds", "(", "step", ")", ":", "if", "step", ".", "geom", "is", "not", "None", ":", "rcmb", "=", "step", ".", "geom", ".", "rcmb", "else", ":", "rcmb", "=", "step", ".", "sdat", ".", "par", "[", "'geometry'", "]", "[", "'r_cmb'", "]...
Radial or vertical position of boundaries. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of floats: radial or vertical positions of boundaries of the domain.
[ "Radial", "or", "vertical", "position", "of", "boundaries", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L117-L134
StagPython/StagPy
stagpy/misc.py
InchoateFiles.fnames
def fnames(self, names): """Ensure constant size of fnames""" names = list(names[:len(self._fnames)]) self._fnames = names + self._fnames[len(names):]
python
def fnames(self, names): """Ensure constant size of fnames""" names = list(names[:len(self._fnames)]) self._fnames = names + self._fnames[len(names):]
[ "def", "fnames", "(", "self", ",", "names", ")", ":", "names", "=", "list", "(", "names", "[", ":", "len", "(", "self", ".", "_fnames", ")", "]", ")", "self", ".", "_fnames", "=", "names", "+", "self", ".", "_fnames", "[", "len", "(", "names", ...
Ensure constant size of fnames
[ "Ensure", "constant", "size", "of", "fnames" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/misc.py#L191-L194
StagPython/StagPy
stagpy/time_series.py
_plot_time_list
def _plot_time_list(sdat, lovs, tseries, metas, times=None): """Plot requested profiles""" if times is None: times = {} for vfig in lovs: fig, axes = plt.subplots(nrows=len(vfig), sharex=True, figsize=(12, 2 * len(vfig))) axes = [axes] if len(vfig) ==...
python
def _plot_time_list(sdat, lovs, tseries, metas, times=None): """Plot requested profiles""" if times is None: times = {} for vfig in lovs: fig, axes = plt.subplots(nrows=len(vfig), sharex=True, figsize=(12, 2 * len(vfig))) axes = [axes] if len(vfig) ==...
[ "def", "_plot_time_list", "(", "sdat", ",", "lovs", ",", "tseries", ",", "metas", ",", "times", "=", "None", ")", ":", "if", "times", "is", "None", ":", "times", "=", "{", "}", "for", "vfig", "in", "lovs", ":", "fig", ",", "axes", "=", "plt", "."...
Plot requested profiles
[ "Plot", "requested", "profiles" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L11-L52
StagPython/StagPy
stagpy/time_series.py
get_time_series
def get_time_series(sdat, var, tstart, tend): """Extract or compute and rescale a time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. var (str): time series name, a key of :data:`stagpy.phyvars.TIME` or :data:`stagpy.phyvars.TIME_EXTRA`. ...
python
def get_time_series(sdat, var, tstart, tend): """Extract or compute and rescale a time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. var (str): time series name, a key of :data:`stagpy.phyvars.TIME` or :data:`stagpy.phyvars.TIME_EXTRA`. ...
[ "def", "get_time_series", "(", "sdat", ",", "var", ",", "tstart", ",", "tend", ")", ":", "tseries", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "if", "var", "in", "tseries", ".", "columns", ":", "series", "=", "tseries", "[", ...
Extract or compute and rescale a time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. var (str): time series name, a key of :data:`stagpy.phyvars.TIME` or :data:`stagpy.phyvars.TIME_EXTRA`. tstart (float): starting time of desired series. Set ...
[ "Extract", "or", "compute", "and", "rescale", "a", "time", "series", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L55-L93
StagPython/StagPy
stagpy/time_series.py
plot_time_series
def plot_time_series(sdat, lovs): """Plot requested time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of series names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: ...
python
def plot_time_series(sdat, lovs): """Plot requested time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of series names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: ...
[ "def", "plot_time_series", "(", "sdat", ",", "lovs", ")", ":", "sovs", "=", "misc", ".", "set_of_vars", "(", "lovs", ")", "tseries", "=", "{", "}", "times", "=", "{", "}", "metas", "=", "{", "}", "for", "tvar", "in", "sovs", ":", "series", ",", "...
Plot requested time series. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of series names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: conf.time.tstart: the starting time...
[ "Plot", "requested", "time", "series", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L96-L122
StagPython/StagPy
stagpy/time_series.py
compstat
def compstat(sdat, tstart=None, tend=None): """Compute statistics from series output by StagYY. Create a file 'statistics.dat' containing the mean and standard deviation of each series on the requested time span. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. ...
python
def compstat(sdat, tstart=None, tend=None): """Compute statistics from series output by StagYY. Create a file 'statistics.dat' containing the mean and standard deviation of each series on the requested time span. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. ...
[ "def", "compstat", "(", "sdat", ",", "tstart", "=", "None", ",", "tend", "=", "None", ")", ":", "data", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "time", "=", "data", "[", "'t'", "]", ".", "values", "delta_time", "=", "t...
Compute statistics from series output by StagYY. Create a file 'statistics.dat' containing the mean and standard deviation of each series on the requested time span. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): starting time. Set to None to st...
[ "Compute", "statistics", "from", "series", "output", "by", "StagYY", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L125-L150
StagPython/StagPy
stagpy/time_series.py
cmd
def cmd(): """Implementation of time subcommand. Other Parameters: conf.time conf.core """ sdat = StagyyData(conf.core.path) if sdat.tseries is None: return if conf.time.fraction is not None: if not 0 < conf.time.fraction <= 1: raise InvalidTimeFract...
python
def cmd(): """Implementation of time subcommand. Other Parameters: conf.time conf.core """ sdat = StagyyData(conf.core.path) if sdat.tseries is None: return if conf.time.fraction is not None: if not 0 < conf.time.fraction <= 1: raise InvalidTimeFract...
[ "def", "cmd", "(", ")", ":", "sdat", "=", "StagyyData", "(", "conf", ".", "core", ".", "path", ")", "if", "sdat", ".", "tseries", "is", "None", ":", "return", "if", "conf", ".", "time", ".", "fraction", "is", "not", "None", ":", "if", "not", "0",...
Implementation of time subcommand. Other Parameters: conf.time conf.core
[ "Implementation", "of", "time", "subcommand", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/time_series.py#L153-L178
StagPython/StagPy
stagpy/commands.py
info_cmd
def info_cmd(): """Print basic information about StagYY run.""" sdat = stagyydata.StagyyData(conf.core.path) lsnap = sdat.snaps.last lstep = sdat.steps.last print('StagYY run in {}'.format(sdat.path)) if lsnap.geom.threed: dimension = '{} x {} x {}'.format(lsnap.geom.nxtot, ...
python
def info_cmd(): """Print basic information about StagYY run.""" sdat = stagyydata.StagyyData(conf.core.path) lsnap = sdat.snaps.last lstep = sdat.steps.last print('StagYY run in {}'.format(sdat.path)) if lsnap.geom.threed: dimension = '{} x {} x {}'.format(lsnap.geom.nxtot, ...
[ "def", "info_cmd", "(", ")", ":", "sdat", "=", "stagyydata", ".", "StagyyData", "(", "conf", ".", "core", ".", "path", ")", "lsnap", "=", "sdat", ".", "snaps", ".", "last", "lstep", "=", "sdat", ".", "steps", ".", "last", "print", "(", "'StagYY run i...
Print basic information about StagYY run.
[ "Print", "basic", "information", "about", "StagYY", "run", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L17-L48
StagPython/StagPy
stagpy/commands.py
_pretty_print
def _pretty_print(key_val, sep=': ', min_col_width=39, text_width=None): """Print a iterable of key/values Args: key_val (list of (str, str)): the pairs of section names and text. sep (str): separator between section names and text. min_col_width (int): minimal acceptable column width ...
python
def _pretty_print(key_val, sep=': ', min_col_width=39, text_width=None): """Print a iterable of key/values Args: key_val (list of (str, str)): the pairs of section names and text. sep (str): separator between section names and text. min_col_width (int): minimal acceptable column width ...
[ "def", "_pretty_print", "(", "key_val", ",", "sep", "=", "': '", ",", "min_col_width", "=", "39", ",", "text_width", "=", "None", ")", ":", "if", "text_width", "is", "None", ":", "text_width", "=", "get_terminal_size", "(", ")", ".", "columns", "if", "te...
Print a iterable of key/values Args: key_val (list of (str, str)): the pairs of section names and text. sep (str): separator between section names and text. min_col_width (int): minimal acceptable column width text_width (int): text width to use. If set to None, will try to infer ...
[ "Print", "a", "iterable", "of", "key", "/", "values" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L51-L90
StagPython/StagPy
stagpy/commands.py
_layout
def _layout(dict_vars, dict_vars_extra): """Print nicely [(var, description)] from phyvars""" desc = [(v, m.description) for v, m in dict_vars.items()] desc.extend((v, baredoc(m.description)) for v, m in dict_vars_extra.items()) _pretty_print(desc, min_col_width=26)
python
def _layout(dict_vars, dict_vars_extra): """Print nicely [(var, description)] from phyvars""" desc = [(v, m.description) for v, m in dict_vars.items()] desc.extend((v, baredoc(m.description)) for v, m in dict_vars_extra.items()) _pretty_print(desc, min_col_width=26)
[ "def", "_layout", "(", "dict_vars", ",", "dict_vars_extra", ")", ":", "desc", "=", "[", "(", "v", ",", "m", ".", "description", ")", "for", "v", ",", "m", "in", "dict_vars", ".", "items", "(", ")", "]", "desc", ".", "extend", "(", "(", "v", ",", ...
Print nicely [(var, description)] from phyvars
[ "Print", "nicely", "[", "(", "var", "description", ")", "]", "from", "phyvars" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L93-L98
StagPython/StagPy
stagpy/commands.py
var_cmd
def var_cmd(): """Print a list of available variables. See :mod:`stagpy.phyvars` where the lists of variables organized by command are defined. """ print_all = not any(val for _, val in conf.var.opt_vals_()) if print_all or conf.var.field: print('field:') _layout(phyvars.FIELD, ...
python
def var_cmd(): """Print a list of available variables. See :mod:`stagpy.phyvars` where the lists of variables organized by command are defined. """ print_all = not any(val for _, val in conf.var.opt_vals_()) if print_all or conf.var.field: print('field:') _layout(phyvars.FIELD, ...
[ "def", "var_cmd", "(", ")", ":", "print_all", "=", "not", "any", "(", "val", "for", "_", ",", "val", "in", "conf", ".", "var", ".", "opt_vals_", "(", ")", ")", "if", "print_all", "or", "conf", ".", "var", ".", "field", ":", "print", "(", "'field:...
Print a list of available variables. See :mod:`stagpy.phyvars` where the lists of variables organized by command are defined.
[ "Print", "a", "list", "of", "available", "variables", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L101-L126
StagPython/StagPy
stagpy/commands.py
report_parsing_problems
def report_parsing_problems(parsing_out): """Output message about potential parsing problems.""" _, empty, faulty = parsing_out if CONFIG_FILE in empty or CONFIG_FILE in faulty: print('Unable to read global config file', CONFIG_FILE, file=sys.stderr) print('Please run stagpy co...
python
def report_parsing_problems(parsing_out): """Output message about potential parsing problems.""" _, empty, faulty = parsing_out if CONFIG_FILE in empty or CONFIG_FILE in faulty: print('Unable to read global config file', CONFIG_FILE, file=sys.stderr) print('Please run stagpy co...
[ "def", "report_parsing_problems", "(", "parsing_out", ")", ":", "_", ",", "empty", ",", "faulty", "=", "parsing_out", "if", "CONFIG_FILE", "in", "empty", "or", "CONFIG_FILE", "in", "faulty", ":", "print", "(", "'Unable to read global config file'", ",", "CONFIG_FI...
Output message about potential parsing problems.
[ "Output", "message", "about", "potential", "parsing", "problems", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L137-L149
StagPython/StagPy
stagpy/commands.py
config_pp
def config_pp(subs): """Pretty print of configuration options. Args: subs (iterable of str): iterable with the list of conf sections to print. """ print('(c|f): available only as CLI argument/in the config file', end='\n\n') for sub in subs: hlp_lst = [] ...
python
def config_pp(subs): """Pretty print of configuration options. Args: subs (iterable of str): iterable with the list of conf sections to print. """ print('(c|f): available only as CLI argument/in the config file', end='\n\n') for sub in subs: hlp_lst = [] ...
[ "def", "config_pp", "(", "subs", ")", ":", "print", "(", "'(c|f): available only as CLI argument/in the config file'", ",", "end", "=", "'\\n\\n'", ")", "for", "sub", "in", "subs", ":", "hlp_lst", "=", "[", "]", "for", "opt", ",", "meta", "in", "conf", "[", ...
Pretty print of configuration options. Args: subs (iterable of str): iterable with the list of conf sections to print.
[ "Pretty", "print", "of", "configuration", "options", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L152-L171
StagPython/StagPy
stagpy/commands.py
config_cmd
def config_cmd(): """Configuration handling. Other Parameters: conf.config """ if not (conf.common.config or conf.config.create or conf.config.create_local or conf.config.update or conf.config.edit): config_pp(conf.sections_()) loam.tools.config_cmd_handler(c...
python
def config_cmd(): """Configuration handling. Other Parameters: conf.config """ if not (conf.common.config or conf.config.create or conf.config.create_local or conf.config.update or conf.config.edit): config_pp(conf.sections_()) loam.tools.config_cmd_handler(c...
[ "def", "config_cmd", "(", ")", ":", "if", "not", "(", "conf", ".", "common", ".", "config", "or", "conf", ".", "config", ".", "create", "or", "conf", ".", "config", ".", "create_local", "or", "conf", ".", "config", ".", "update", "or", "conf", ".", ...
Configuration handling. Other Parameters: conf.config
[ "Configuration", "handling", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/commands.py#L174-L184
StagPython/StagPy
stagpy/rprof.py
_plot_rprof_list
def _plot_rprof_list(sdat, lovs, rprofs, metas, stepstr, rads=None): """Plot requested profiles""" if rads is None: rads = {} for vfig in lovs: fig, axes = plt.subplots(ncols=len(vfig), sharey=True) axes = [axes] if len(vfig) == 1 else axes fname = 'rprof_' for iplt, ...
python
def _plot_rprof_list(sdat, lovs, rprofs, metas, stepstr, rads=None): """Plot requested profiles""" if rads is None: rads = {} for vfig in lovs: fig, axes = plt.subplots(ncols=len(vfig), sharey=True) axes = [axes] if len(vfig) == 1 else axes fname = 'rprof_' for iplt, ...
[ "def", "_plot_rprof_list", "(", "sdat", ",", "lovs", ",", "rprofs", ",", "metas", ",", "stepstr", ",", "rads", "=", "None", ")", ":", "if", "rads", "is", "None", ":", "rads", "=", "{", "}", "for", "vfig", "in", "lovs", ":", "fig", ",", "axes", "=...
Plot requested profiles
[ "Plot", "requested", "profiles" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L10-L51
StagPython/StagPy
stagpy/rprof.py
get_rprof
def get_rprof(step, var): """Extract or compute and rescale requested radial profile. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): radial profile name, a key of :data:`stagpy.phyvars.RPROF` or :data:`stagpy.phyvars.RPROF_EXT...
python
def get_rprof(step, var): """Extract or compute and rescale requested radial profile. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): radial profile name, a key of :data:`stagpy.phyvars.RPROF` or :data:`stagpy.phyvars.RPROF_EXT...
[ "def", "get_rprof", "(", "step", ",", "var", ")", ":", "if", "var", "in", "step", ".", "rprof", ".", "columns", ":", "rprof", "=", "step", ".", "rprof", "[", "var", "]", "rad", "=", "None", "if", "var", "in", "phyvars", ".", "RPROF", ":", "meta",...
Extract or compute and rescale requested radial profile. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): radial profile name, a key of :data:`stagpy.phyvars.RPROF` or :data:`stagpy.phyvars.RPROF_EXTRA`. Returns: tuple o...
[ "Extract", "or", "compute", "and", "rescale", "requested", "radial", "profile", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L54-L88
StagPython/StagPy
stagpy/rprof.py
plot_grid
def plot_grid(step): """Plot cell position and thickness. The figure is call grid_N.pdf where N is replace by the step index. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. """ rad = get_rprof(step, 'r')[0] drad = get_rprof(step, 'dr')[0] ...
python
def plot_grid(step): """Plot cell position and thickness. The figure is call grid_N.pdf where N is replace by the step index. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. """ rad = get_rprof(step, 'r')[0] drad = get_rprof(step, 'dr')[0] ...
[ "def", "plot_grid", "(", "step", ")", ":", "rad", "=", "get_rprof", "(", "step", ",", "'r'", ")", "[", "0", "]", "drad", "=", "get_rprof", "(", "step", ",", "'dr'", ")", "[", "0", "]", "_", ",", "unit", "=", "step", ".", "sdat", ".", "scale", ...
Plot cell position and thickness. The figure is call grid_N.pdf where N is replace by the step index. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance.
[ "Plot", "cell", "position", "and", "thickness", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L91-L112
StagPython/StagPy
stagpy/rprof.py
plot_average
def plot_average(sdat, lovs): """Plot time averaged profiles. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: ...
python
def plot_average(sdat, lovs): """Plot time averaged profiles. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: ...
[ "def", "plot_average", "(", "sdat", ",", "lovs", ")", ":", "steps_iter", "=", "iter", "(", "sdat", ".", "walk", ".", "filter", "(", "rprof", "=", "True", ")", ")", "try", ":", "step", "=", "next", "(", "steps_iter", ")", "except", "StopIteration", ":...
Plot time averaged profiles. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: conf.core.snapshots: the slice of...
[ "Plot", "time", "averaged", "profiles", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L115-L162
StagPython/StagPy
stagpy/rprof.py
plot_every_step
def plot_every_step(sdat, lovs): """Plot profiles at each time step. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameter...
python
def plot_every_step(sdat, lovs): """Plot profiles at each time step. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameter...
[ "def", "plot_every_step", "(", "sdat", ",", "lovs", ")", ":", "sovs", "=", "misc", ".", "set_of_vars", "(", "lovs", ")", "for", "step", "in", "sdat", ".", "walk", ".", "filter", "(", "rprof", "=", "True", ")", ":", "rprofs", "=", "{", "}", "rads", ...
Plot profiles at each time step. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. lovs (nested list of str): nested list of profile names such as the one produced by :func:`stagpy.misc.list_of_vars`. Other Parameters: conf.core.snapshots: the slic...
[ "Plot", "profiles", "at", "each", "time", "step", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L165-L196
StagPython/StagPy
stagpy/rprof.py
cmd
def cmd(): """Implementation of rprof subcommand. Other Parameters: conf.rprof conf.core """ sdat = StagyyData(conf.core.path) if sdat.rprof is None: return if conf.rprof.grid: for step in sdat.walk.filter(rprof=True): plot_grid(step) lovs = mis...
python
def cmd(): """Implementation of rprof subcommand. Other Parameters: conf.rprof conf.core """ sdat = StagyyData(conf.core.path) if sdat.rprof is None: return if conf.rprof.grid: for step in sdat.walk.filter(rprof=True): plot_grid(step) lovs = mis...
[ "def", "cmd", "(", ")", ":", "sdat", "=", "StagyyData", "(", "conf", ".", "core", ".", "path", ")", "if", "sdat", ".", "rprof", "is", "None", ":", "return", "if", "conf", ".", "rprof", ".", "grid", ":", "for", "step", "in", "sdat", ".", "walk", ...
Implementation of rprof subcommand. Other Parameters: conf.rprof conf.core
[ "Implementation", "of", "rprof", "subcommand", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/rprof.py#L199-L221
StagPython/StagPy
stagpy/__main__.py
main
def main(): """StagPy entry point""" if not DEBUG: signal.signal(signal.SIGINT, sigint_handler) warnings.simplefilter('ignore') args = importlib.import_module('stagpy.args') error = importlib.import_module('stagpy.error') try: args.parse_args()() except error.StagpyError ...
python
def main(): """StagPy entry point""" if not DEBUG: signal.signal(signal.SIGINT, sigint_handler) warnings.simplefilter('ignore') args = importlib.import_module('stagpy.args') error = importlib.import_module('stagpy.error') try: args.parse_args()() except error.StagpyError ...
[ "def", "main", "(", ")", ":", "if", "not", "DEBUG", ":", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "sigint_handler", ")", "warnings", ".", "simplefilter", "(", "'ignore'", ")", "args", "=", "importlib", ".", "import_module", "(", "'stag...
StagPy entry point
[ "StagPy", "entry", "point" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/__main__.py#L11-L29
StagPython/StagPy
stagpy/parfile.py
_enrich_with_par
def _enrich_with_par(par_nml, par_file): """Enrich a par namelist with the content of a file.""" par_new = f90nml.read(str(par_file)) for section, content in par_new.items(): if section not in par_nml: par_nml[section] = {} for par, value in content.items(): try: ...
python
def _enrich_with_par(par_nml, par_file): """Enrich a par namelist with the content of a file.""" par_new = f90nml.read(str(par_file)) for section, content in par_new.items(): if section not in par_nml: par_nml[section] = {} for par, value in content.items(): try: ...
[ "def", "_enrich_with_par", "(", "par_nml", ",", "par_file", ")", ":", "par_new", "=", "f90nml", ".", "read", "(", "str", "(", "par_file", ")", ")", "for", "section", ",", "content", "in", "par_new", ".", "items", "(", ")", ":", "if", "section", "not", ...
Enrich a par namelist with the content of a file.
[ "Enrich", "a", "par", "namelist", "with", "the", "content", "of", "a", "file", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/parfile.py#L623-L634
StagPython/StagPy
stagpy/parfile.py
readpar
def readpar(par_file, root): """Read StagYY par file. The namelist is populated in chronological order with: - :data:`PAR_DEFAULT`, an internal dictionary defining defaults; - :data:`PAR_DFLT_FILE`, the global configuration par file; - ``par_name_defaultparameters`` if it is defined in ``par_file`...
python
def readpar(par_file, root): """Read StagYY par file. The namelist is populated in chronological order with: - :data:`PAR_DEFAULT`, an internal dictionary defining defaults; - :data:`PAR_DFLT_FILE`, the global configuration par file; - ``par_name_defaultparameters`` if it is defined in ``par_file`...
[ "def", "readpar", "(", "par_file", ",", "root", ")", ":", "par_nml", "=", "deepcopy", "(", "PAR_DEFAULT", ")", "if", "PAR_DFLT_FILE", ".", "is_file", "(", ")", ":", "_enrich_with_par", "(", "par_nml", ",", "PAR_DFLT_FILE", ")", "else", ":", "PAR_DFLT_FILE", ...
Read StagYY par file. The namelist is populated in chronological order with: - :data:`PAR_DEFAULT`, an internal dictionary defining defaults; - :data:`PAR_DFLT_FILE`, the global configuration par file; - ``par_name_defaultparameters`` if it is defined in ``par_file``; - ``par_file`` itself; - ...
[ "Read", "StagYY", "par", "file", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/parfile.py#L637-L685
StagPython/StagPy
stagpy/field.py
get_meshes_fld
def get_meshes_fld(step, var): """Return scalar field along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): scalar field name. Returns: tuple of :class:`numpy.ar...
python
def get_meshes_fld(step, var): """Return scalar field along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): scalar field name. Returns: tuple of :class:`numpy.ar...
[ "def", "get_meshes_fld", "(", "step", ",", "var", ")", ":", "fld", "=", "step", ".", "fields", "[", "var", "]", "if", "step", ".", "geom", ".", "twod_xz", ":", "xmesh", ",", "ymesh", "=", "step", ".", "geom", ".", "x_mesh", "[", ":", ",", "0", ...
Return scalar field along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): scalar field name. Returns: tuple of :class:`numpy.array`: xmesh, ymesh, fld 2D...
[ "Return", "scalar", "field", "along", "with", "coordinates", "meshes", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L27-L51
StagPython/StagPy
stagpy/field.py
get_meshes_vec
def get_meshes_vec(step, var): """Return vector field components along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): vector field name. Returns: tuple of :clas...
python
def get_meshes_vec(step, var): """Return vector field components along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): vector field name. Returns: tuple of :clas...
[ "def", "get_meshes_vec", "(", "step", ",", "var", ")", ":", "if", "step", ".", "geom", ".", "twod_xz", ":", "xmesh", ",", "ymesh", "=", "step", ".", "geom", ".", "x_mesh", "[", ":", ",", "0", ",", ":", "]", ",", "step", ".", "geom", ".", "z_mes...
Return vector field components along with coordinates meshes. Only works properly in 2D geometry. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): vector field name. Returns: tuple of :class:`numpy.array`: xmesh, ymesh, fldx, f...
[ "Return", "vector", "field", "components", "along", "with", "coordinates", "meshes", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L54-L83
StagPython/StagPy
stagpy/field.py
set_of_vars
def set_of_vars(arg_plot): """Build set of needed field variables. Each var is a tuple, first component is a scalar field, second component is either: - a scalar field, isocontours are added to the plot. - a vector field (e.g. 'v' for the (v1,v2,v3) vector), arrows are added to the plot. ...
python
def set_of_vars(arg_plot): """Build set of needed field variables. Each var is a tuple, first component is a scalar field, second component is either: - a scalar field, isocontours are added to the plot. - a vector field (e.g. 'v' for the (v1,v2,v3) vector), arrows are added to the plot. ...
[ "def", "set_of_vars", "(", "arg_plot", ")", ":", "sovs", "=", "set", "(", "tuple", "(", "(", "var", "+", "'+'", ")", ".", "split", "(", "'+'", ")", "[", ":", "2", "]", ")", "for", "var", "in", "arg_plot", ".", "split", "(", "','", ")", ")", "...
Build set of needed field variables. Each var is a tuple, first component is a scalar field, second component is either: - a scalar field, isocontours are added to the plot. - a vector field (e.g. 'v' for the (v1,v2,v3) vector), arrows are added to the plot. Args: arg_plot (str): st...
[ "Build", "set", "of", "needed", "field", "variables", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L86-L105
StagPython/StagPy
stagpy/field.py
plot_scalar
def plot_scalar(step, var, field=None, axis=None, set_cbar=True, **extra): """Plot scalar field. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): the scalar field name. field (:class:`numpy.array`): if not None, it is plotted instea...
python
def plot_scalar(step, var, field=None, axis=None, set_cbar=True, **extra): """Plot scalar field. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): the scalar field name. field (:class:`numpy.array`): if not None, it is plotted instea...
[ "def", "plot_scalar", "(", "step", ",", "var", ",", "field", "=", "None", ",", "axis", "=", "None", ",", "set_cbar", "=", "True", ",", "*", "*", "extra", ")", ":", "if", "var", "in", "phyvars", ".", "FIELD", ":", "meta", "=", "phyvars", ".", "FIE...
Plot scalar field. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): the scalar field name. field (:class:`numpy.array`): if not None, it is plotted instead of step.fields[var]. This is useful to plot a masked or rescaled ...
[ "Plot", "scalar", "field", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L108-L196
StagPython/StagPy
stagpy/field.py
plot_iso
def plot_iso(axis, step, var): """Plot isocontours of scalar field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the isocontours should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData ...
python
def plot_iso(axis, step, var): """Plot isocontours of scalar field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the isocontours should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData ...
[ "def", "plot_iso", "(", "axis", ",", "step", ",", "var", ")", ":", "xmesh", ",", "ymesh", ",", "fld", "=", "get_meshes_fld", "(", "step", ",", "var", ")", "if", "conf", ".", "field", ".", "shift", ":", "fld", "=", "np", ".", "roll", "(", "fld", ...
Plot isocontours of scalar field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the isocontours should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): ...
[ "Plot", "isocontours", "of", "scalar", "field", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L199-L213
StagPython/StagPy
stagpy/field.py
plot_vec
def plot_vec(axis, step, var): """Plot vector field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the vector field should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData insta...
python
def plot_vec(axis, step, var): """Plot vector field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the vector field should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData insta...
[ "def", "plot_vec", "(", "axis", ",", "step", ",", "var", ")", ":", "xmesh", ",", "ymesh", ",", "vec1", ",", "vec2", "=", "get_meshes_vec", "(", "step", ",", "var", ")", "dipz", "=", "step", ".", "geom", ".", "nztot", "//", "10", "if", "conf", "."...
Plot vector field. Args: axis (:class:`matplotlib.axes.Axes`): the axis handler of an existing matplotlib figure where the vector field should be plotted. step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. var (str): the vector fie...
[ "Plot", "vector", "field", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L216-L239
StagPython/StagPy
stagpy/field.py
cmd
def cmd(): """Implementation of field subcommand. Other Parameters: conf.field conf.core """ sdat = StagyyData(conf.core.path) sovs = set_of_vars(conf.field.plot) minmax = {} if conf.plot.cminmax: conf.plot.vmin = None conf.plot.vmax = None for step i...
python
def cmd(): """Implementation of field subcommand. Other Parameters: conf.field conf.core """ sdat = StagyyData(conf.core.path) sovs = set_of_vars(conf.field.plot) minmax = {} if conf.plot.cminmax: conf.plot.vmin = None conf.plot.vmax = None for step i...
[ "def", "cmd", "(", ")", ":", "sdat", "=", "StagyyData", "(", "conf", ".", "core", ".", "path", ")", "sovs", "=", "set_of_vars", "(", "conf", ".", "field", ".", "plot", ")", "minmax", "=", "{", "}", "if", "conf", ".", "plot", ".", "cminmax", ":", ...
Implementation of field subcommand. Other Parameters: conf.field conf.core
[ "Implementation", "of", "field", "subcommand", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/field.py#L242-L283
StagPython/StagPy
stagpy/args.py
_sub
def _sub(cmd, *sections): """Build Subcmd instance.""" cmd_func = cmd if isfunction(cmd) else cmd.cmd return Subcmd(baredoc(cmd), *sections, func=cmd_func)
python
def _sub(cmd, *sections): """Build Subcmd instance.""" cmd_func = cmd if isfunction(cmd) else cmd.cmd return Subcmd(baredoc(cmd), *sections, func=cmd_func)
[ "def", "_sub", "(", "cmd", ",", "*", "sections", ")", ":", "cmd_func", "=", "cmd", "if", "isfunction", "(", "cmd", ")", "else", "cmd", ".", "cmd", "return", "Subcmd", "(", "baredoc", "(", "cmd", ")", ",", "*", "sections", ",", "func", "=", "cmd_fun...
Build Subcmd instance.
[ "Build", "Subcmd", "instance", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/args.py#L15-L18
StagPython/StagPy
stagpy/args.py
_steps_to_slices
def _steps_to_slices(): """parse timesteps and snapshots arguments and return slices""" if not (conf.core.timesteps or conf.core.snapshots): # default to the last snap conf.core.timesteps = None conf.core.snapshots = slice(-1, None, None) return elif conf.core.snapshots: ...
python
def _steps_to_slices(): """parse timesteps and snapshots arguments and return slices""" if not (conf.core.timesteps or conf.core.snapshots): # default to the last snap conf.core.timesteps = None conf.core.snapshots = slice(-1, None, None) return elif conf.core.snapshots: ...
[ "def", "_steps_to_slices", "(", ")", ":", "if", "not", "(", "conf", ".", "core", ".", "timesteps", "or", "conf", ".", "core", ".", "snapshots", ")", ":", "# default to the last snap", "conf", ".", "core", ".", "timesteps", "=", "None", "conf", ".", "core...
parse timesteps and snapshots arguments and return slices
[ "parse", "timesteps", "and", "snapshots", "arguments", "and", "return", "slices" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/args.py#L35-L62
StagPython/StagPy
stagpy/args.py
parse_args
def parse_args(arglist=None): """Parse cmd line arguments. Update :attr:`stagpy.conf` accordingly. Args: arglist (list of str): the list of cmd line arguments. If set to None, the arguments are taken from :attr:`sys.argv`. Returns: function: the function implementing the s...
python
def parse_args(arglist=None): """Parse cmd line arguments. Update :attr:`stagpy.conf` accordingly. Args: arglist (list of str): the list of cmd line arguments. If set to None, the arguments are taken from :attr:`sys.argv`. Returns: function: the function implementing the s...
[ "def", "parse_args", "(", "arglist", "=", "None", ")", ":", "climan", "=", "CLIManager", "(", "conf", ",", "*", "*", "SUB_CMDS", ")", "create_complete_files", "(", "climan", ",", "CONFIG_DIR", ",", "'stagpy'", ",", "'stagpy-git'", ",", "zsh_sourceable", "=",...
Parse cmd line arguments. Update :attr:`stagpy.conf` accordingly. Args: arglist (list of str): the list of cmd line arguments. If set to None, the arguments are taken from :attr:`sys.argv`. Returns: function: the function implementing the sub command to be executed.
[ "Parse", "cmd", "line", "arguments", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/args.py#L65-L103
StagPython/StagPy
stagpy/plates.py
detect_plates_vzcheck
def detect_plates_vzcheck(step, seuil_memz): """detect plates and check with vz and plate size""" v_z = step.fields['v3'][0, :, :, 0] v_x = step.fields['v2'][0, :, :, 0] tcell = step.fields['T'][0, :, :, 0] n_z = step.geom.nztot nphi = step.geom.nptot # -1? should be OK, ghost not included ...
python
def detect_plates_vzcheck(step, seuil_memz): """detect plates and check with vz and plate size""" v_z = step.fields['v3'][0, :, :, 0] v_x = step.fields['v2'][0, :, :, 0] tcell = step.fields['T'][0, :, :, 0] n_z = step.geom.nztot nphi = step.geom.nptot # -1? should be OK, ghost not included ...
[ "def", "detect_plates_vzcheck", "(", "step", ",", "seuil_memz", ")", ":", "v_z", "=", "step", ".", "fields", "[", "'v3'", "]", "[", "0", ",", ":", ",", ":", ",", "0", "]", "v_x", "=", "step", ".", "fields", "[", "'v2'", "]", "[", "0", ",", ":",...
detect plates and check with vz and plate size
[ "detect", "plates", "and", "check", "with", "vz", "and", "plate", "size" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L13-L84
StagPython/StagPy
stagpy/plates.py
detect_plates
def detect_plates(step, vrms_surface, fids, time): """detect plates using derivative of horizontal velocity""" vphi = step.fields['v2'][0, :, :, 0] ph_coord = step.geom.p_coord if step.sdat.par['boundaries']['air_layer']: dsa = step.sdat.par['boundaries']['air_thickness'] # we are a bit...
python
def detect_plates(step, vrms_surface, fids, time): """detect plates using derivative of horizontal velocity""" vphi = step.fields['v2'][0, :, :, 0] ph_coord = step.geom.p_coord if step.sdat.par['boundaries']['air_layer']: dsa = step.sdat.par['boundaries']['air_thickness'] # we are a bit...
[ "def", "detect_plates", "(", "step", ",", "vrms_surface", ",", "fids", ",", "time", ")", ":", "vphi", "=", "step", ".", "fields", "[", "'v2'", "]", "[", "0", ",", ":", ",", ":", ",", "0", "]", "ph_coord", "=", "step", ".", "geom", ".", "p_coord",...
detect plates using derivative of horizontal velocity
[ "detect", "plates", "using", "derivative", "of", "horizontal", "velocity" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L87-L165
StagPython/StagPy
stagpy/plates.py
plot_plate_limits
def plot_plate_limits(axis, ridges, trenches, ymin, ymax): """plot lines designating ridges and trenches""" for trench in trenches: axis.axvline( x=trench, ymin=ymin, ymax=ymax, color='red', ls='dashed', alpha=0.4) for ridge in ridges: axis.axvline( x=ridg...
python
def plot_plate_limits(axis, ridges, trenches, ymin, ymax): """plot lines designating ridges and trenches""" for trench in trenches: axis.axvline( x=trench, ymin=ymin, ymax=ymax, color='red', ls='dashed', alpha=0.4) for ridge in ridges: axis.axvline( x=ridg...
[ "def", "plot_plate_limits", "(", "axis", ",", "ridges", ",", "trenches", ",", "ymin", ",", "ymax", ")", ":", "for", "trench", "in", "trenches", ":", "axis", ".", "axvline", "(", "x", "=", "trench", ",", "ymin", "=", "ymin", ",", "ymax", "=", "ymax", ...
plot lines designating ridges and trenches
[ "plot", "lines", "designating", "ridges", "and", "trenches" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L168-L179
StagPython/StagPy
stagpy/plates.py
plot_plate_limits_field
def plot_plate_limits_field(axis, rcmb, ridges, trenches): """plot arrows designating ridges and trenches in 2D field plots""" for trench in trenches: xxd = (rcmb + 1.02) * np.cos(trench) # arrow begin yyd = (rcmb + 1.02) * np.sin(trench) # arrow begin xxt = (rcmb + 1.35) * np.cos(tren...
python
def plot_plate_limits_field(axis, rcmb, ridges, trenches): """plot arrows designating ridges and trenches in 2D field plots""" for trench in trenches: xxd = (rcmb + 1.02) * np.cos(trench) # arrow begin yyd = (rcmb + 1.02) * np.sin(trench) # arrow begin xxt = (rcmb + 1.35) * np.cos(tren...
[ "def", "plot_plate_limits_field", "(", "axis", ",", "rcmb", ",", "ridges", ",", "trenches", ")", ":", "for", "trench", "in", "trenches", ":", "xxd", "=", "(", "rcmb", "+", "1.02", ")", "*", "np", ".", "cos", "(", "trench", ")", "# arrow begin", "yyd", ...
plot arrows designating ridges and trenches in 2D field plots
[ "plot", "arrows", "designating", "ridges", "and", "trenches", "in", "2D", "field", "plots" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L182-L197
StagPython/StagPy
stagpy/plates.py
plot_plates
def plot_plates(step, time, vrms_surface, trench, ridge, agetrench, topo, fids): """handle ploting stuff""" vphi = step.fields['v2'][0, :, :, 0] tempfld = step.fields['T'][0, :, :, 0] concfld = step.fields['c'][0, :, :, 0] timestep = step.isnap if step.sdat.par['boundaries']['ai...
python
def plot_plates(step, time, vrms_surface, trench, ridge, agetrench, topo, fids): """handle ploting stuff""" vphi = step.fields['v2'][0, :, :, 0] tempfld = step.fields['T'][0, :, :, 0] concfld = step.fields['c'][0, :, :, 0] timestep = step.isnap if step.sdat.par['boundaries']['ai...
[ "def", "plot_plates", "(", "step", ",", "time", ",", "vrms_surface", ",", "trench", ",", "ridge", ",", "agetrench", ",", "topo", ",", "fids", ")", ":", "vphi", "=", "step", ".", "fields", "[", "'v2'", "]", "[", "0", ",", ":", ",", ":", ",", "0", ...
handle ploting stuff
[ "handle", "ploting", "stuff" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L200-L475
StagPython/StagPy
stagpy/plates.py
io_surface
def io_surface(timestep, time, fid, fld): """Output for surface files""" fid.write("{} {}".format(timestep, time)) fid.writelines(["%10.2e" % item for item in fld[:]]) fid.writelines(["\n"])
python
def io_surface(timestep, time, fid, fld): """Output for surface files""" fid.write("{} {}".format(timestep, time)) fid.writelines(["%10.2e" % item for item in fld[:]]) fid.writelines(["\n"])
[ "def", "io_surface", "(", "timestep", ",", "time", ",", "fid", ",", "fld", ")", ":", "fid", ".", "write", "(", "\"{} {}\"", ".", "format", "(", "timestep", ",", "time", ")", ")", "fid", ".", "writelines", "(", "[", "\"%10.2e\"", "%", "item", "for", ...
Output for surface files
[ "Output", "for", "surface", "files" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L478-L482
StagPython/StagPy
stagpy/plates.py
lithospheric_stress
def lithospheric_stress(step, trench, ridge, time): """calculate stress in the lithosphere""" timestep = step.isnap base_lith = step.geom.rcmb + 1 - 0.105 stressfld = step.fields['sII'][0, :, :, 0] stressfld = np.ma.masked_where(step.geom.r_mesh[0] < base_lith, stressfld) # stress integration ...
python
def lithospheric_stress(step, trench, ridge, time): """calculate stress in the lithosphere""" timestep = step.isnap base_lith = step.geom.rcmb + 1 - 0.105 stressfld = step.fields['sII'][0, :, :, 0] stressfld = np.ma.masked_where(step.geom.r_mesh[0] < base_lith, stressfld) # stress integration ...
[ "def", "lithospheric_stress", "(", "step", ",", "trench", ",", "ridge", ",", "time", ")", ":", "timestep", "=", "step", ".", "isnap", "base_lith", "=", "step", ".", "geom", ".", "rcmb", "+", "1", "-", "0.105", "stressfld", "=", "step", ".", "fields", ...
calculate stress in the lithosphere
[ "calculate", "stress", "in", "the", "lithosphere" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L485-L574
StagPython/StagPy
stagpy/plates.py
set_of_vars
def set_of_vars(arg_plot): """Build set of needed variables. Args: arg_plot (str): string with variable names separated with ``,``. Returns: set of str: set of variables. """ return set(var for var in arg_plot.split(',') if var in phyvars.PLATES)
python
def set_of_vars(arg_plot): """Build set of needed variables. Args: arg_plot (str): string with variable names separated with ``,``. Returns: set of str: set of variables. """ return set(var for var in arg_plot.split(',') if var in phyvars.PLATES)
[ "def", "set_of_vars", "(", "arg_plot", ")", ":", "return", "set", "(", "var", "for", "var", "in", "arg_plot", ".", "split", "(", "','", ")", "if", "var", "in", "phyvars", ".", "PLATES", ")" ]
Build set of needed variables. Args: arg_plot (str): string with variable names separated with ``,``. Returns: set of str: set of variables.
[ "Build", "set", "of", "needed", "variables", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L577-L585
StagPython/StagPy
stagpy/plates.py
main_plates
def main_plates(sdat): """Plot several plates information.""" # calculating averaged horizontal surface velocity # needed for redimensionalisation ilast = sdat.rprof.index.levels[0][-1] rlast = sdat.rprof.loc[ilast] nprof = 0 uprof_averaged = rlast.loc[:, 'vhrms'] * 0 for step in sdat.wa...
python
def main_plates(sdat): """Plot several plates information.""" # calculating averaged horizontal surface velocity # needed for redimensionalisation ilast = sdat.rprof.index.levels[0][-1] rlast = sdat.rprof.loc[ilast] nprof = 0 uprof_averaged = rlast.loc[:, 'vhrms'] * 0 for step in sdat.wa...
[ "def", "main_plates", "(", "sdat", ")", ":", "# calculating averaged horizontal surface velocity", "# needed for redimensionalisation", "ilast", "=", "sdat", ".", "rprof", ".", "index", ".", "levels", "[", "0", "]", "[", "-", "1", "]", "rlast", "=", "sdat", ".",...
Plot several plates information.
[ "Plot", "several", "plates", "information", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L588-L763
StagPython/StagPy
stagpy/plates.py
cmd
def cmd(): """Implementation of plates subcommand. Other Parameters: conf.plates conf.scaling conf.plot conf.core """ sdat = StagyyData(conf.core.path) conf.plates.plot = set_of_vars(conf.plates.plot) if not conf.plates.vzcheck: conf.scaling.dimensional =...
python
def cmd(): """Implementation of plates subcommand. Other Parameters: conf.plates conf.scaling conf.plot conf.core """ sdat = StagyyData(conf.core.path) conf.plates.plot = set_of_vars(conf.plates.plot) if not conf.plates.vzcheck: conf.scaling.dimensional =...
[ "def", "cmd", "(", ")", ":", "sdat", "=", "StagyyData", "(", "conf", ".", "core", ".", "path", ")", "conf", ".", "plates", ".", "plot", "=", "set_of_vars", "(", "conf", ".", "plates", ".", "plot", ")", "if", "not", "conf", ".", "plates", ".", "vz...
Implementation of plates subcommand. Other Parameters: conf.plates conf.scaling conf.plot conf.core
[ "Implementation", "of", "plates", "subcommand", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/plates.py#L766-L833
StagPython/StagPy
stagpy/__init__.py
_check_config
def _check_config(): """Create config files as necessary.""" config.CONFIG_DIR.mkdir(parents=True, exist_ok=True) verfile = config.CONFIG_DIR / '.version' uptodate = verfile.is_file() and verfile.read_text() == __version__ if not uptodate: verfile.write_text(__version__) if not (uptodate...
python
def _check_config(): """Create config files as necessary.""" config.CONFIG_DIR.mkdir(parents=True, exist_ok=True) verfile = config.CONFIG_DIR / '.version' uptodate = verfile.is_file() and verfile.read_text() == __version__ if not uptodate: verfile.write_text(__version__) if not (uptodate...
[ "def", "_check_config", "(", ")", ":", "config", ".", "CONFIG_DIR", ".", "mkdir", "(", "parents", "=", "True", ",", "exist_ok", "=", "True", ")", "verfile", "=", "config", ".", "CONFIG_DIR", "/", "'.version'", "uptodate", "=", "verfile", ".", "is_file", ...
Create config files as necessary.
[ "Create", "config", "files", "as", "necessary", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/__init__.py#L48-L62
StagPython/StagPy
stagpy/__init__.py
load_mplstyle
def load_mplstyle(): """Try to load conf.plot.mplstyle matplotlib style.""" plt = importlib.import_module('matplotlib.pyplot') if conf.plot.mplstyle: for style in conf.plot.mplstyle.split(): stfile = config.CONFIG_DIR / (style + '.mplstyle') if stfile.is_file(): ...
python
def load_mplstyle(): """Try to load conf.plot.mplstyle matplotlib style.""" plt = importlib.import_module('matplotlib.pyplot') if conf.plot.mplstyle: for style in conf.plot.mplstyle.split(): stfile = config.CONFIG_DIR / (style + '.mplstyle') if stfile.is_file(): ...
[ "def", "load_mplstyle", "(", ")", ":", "plt", "=", "importlib", ".", "import_module", "(", "'matplotlib.pyplot'", ")", "if", "conf", ".", "plot", ".", "mplstyle", ":", "for", "style", "in", "conf", ".", "plot", ".", "mplstyle", ".", "split", "(", ")", ...
Try to load conf.plot.mplstyle matplotlib style.
[ "Try", "to", "load", "conf", ".", "plot", ".", "mplstyle", "matplotlib", "style", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/__init__.py#L65-L80
StagPython/StagPy
stagpy/processing.py
dtime
def dtime(sdat, tstart=None, tend=None): """Time increment dt. Compute dt as a function of time. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if ...
python
def dtime(sdat, tstart=None, tend=None): """Time increment dt. Compute dt as a function of time. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if ...
[ "def", "dtime", "(", "sdat", ",", "tstart", "=", "None", ",", "tend", "=", "None", ")", ":", "tseries", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "time", "=", "tseries", "[", "'t'", "]", ".", "values", "return", "time", ...
Time increment dt. Compute dt as a function of time. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if set to None. tend (float): time at which...
[ "Time", "increment", "dt", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L18-L34
StagPython/StagPy
stagpy/processing.py
dt_dt
def dt_dt(sdat, tstart=None, tend=None): """Derivative of temperature. Compute dT/dt as a function of time using an explicit Euler scheme. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the ...
python
def dt_dt(sdat, tstart=None, tend=None): """Derivative of temperature. Compute dT/dt as a function of time using an explicit Euler scheme. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the ...
[ "def", "dt_dt", "(", "sdat", ",", "tstart", "=", "None", ",", "tend", "=", "None", ")", ":", "tseries", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "time", "=", "tseries", "[", "'t'", "]", ".", "values", "temp", "=", "tser...
Derivative of temperature. Compute dT/dt as a function of time using an explicit Euler scheme. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if set to...
[ "Derivative", "of", "temperature", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L37-L56
StagPython/StagPy
stagpy/processing.py
ebalance
def ebalance(sdat, tstart=None, tend=None): """Energy balance. Compute Nu_t - Nu_b + V*dT/dt as a function of time using an explicit Euler scheme. This should be zero if energy is conserved. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): tim...
python
def ebalance(sdat, tstart=None, tend=None): """Energy balance. Compute Nu_t - Nu_b + V*dT/dt as a function of time using an explicit Euler scheme. This should be zero if energy is conserved. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): tim...
[ "def", "ebalance", "(", "sdat", ",", "tstart", "=", "None", ",", "tend", "=", "None", ")", ":", "tseries", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "rbot", ",", "rtop", "=", "misc", ".", "get_rbounds", "(", "sdat", ".", ...
Energy balance. Compute Nu_t - Nu_b + V*dT/dt as a function of time using an explicit Euler scheme. This should be zero if energy is conserved. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the ...
[ "Energy", "balance", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L59-L87
StagPython/StagPy
stagpy/processing.py
mobility
def mobility(sdat, tstart=None, tend=None): """Plates mobility. Compute the ratio vsurf / vrms. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if s...
python
def mobility(sdat, tstart=None, tend=None): """Plates mobility. Compute the ratio vsurf / vrms. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if s...
[ "def", "mobility", "(", "sdat", ",", "tstart", "=", "None", ",", "tend", "=", "None", ")", ":", "tseries", "=", "sdat", ".", "tseries_between", "(", "tstart", ",", "tend", ")", "steps", "=", "sdat", ".", "steps", "[", "tseries", ".", "index", "[", ...
Plates mobility. Compute the ratio vsurf / vrms. Args: sdat (:class:`~stagpy.stagyydata.StagyyData`): a StagyyData instance. tstart (float): time at which the computation should start. Use the beginning of the time series data if set to None. tend (float): time at which the...
[ "Plates", "mobility", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L90-L111
StagPython/StagPy
stagpy/processing.py
r_edges
def r_edges(step): """Cell border. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the position of the bottom and top walls of the cells. The two elements of the tuple are identical. """ rbo...
python
def r_edges(step): """Cell border. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the position of the bottom and top walls of the cells. The two elements of the tuple are identical. """ rbo...
[ "def", "r_edges", "(", "step", ")", ":", "rbot", ",", "rtop", "=", "misc", ".", "get_rbounds", "(", "step", ")", "centers", "=", "step", ".", "rprof", ".", "loc", "[", ":", ",", "'r'", "]", ".", "values", "+", "rbot", "# assume walls are mid-way betwee...
Cell border. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the position of the bottom and top walls of the cells. The two elements of the tuple are identical.
[ "Cell", "border", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L114-L131
StagPython/StagPy
stagpy/processing.py
_scale_prof
def _scale_prof(step, rprof, rad=None): """Scale profile to take sphericity into account""" rbot, rtop = misc.get_rbounds(step) if rbot == 0: # not spherical return rprof if rad is None: rad = step.rprof['r'].values + rbot return rprof * (2 * rad / (rtop + rbot))**2
python
def _scale_prof(step, rprof, rad=None): """Scale profile to take sphericity into account""" rbot, rtop = misc.get_rbounds(step) if rbot == 0: # not spherical return rprof if rad is None: rad = step.rprof['r'].values + rbot return rprof * (2 * rad / (rtop + rbot))**2
[ "def", "_scale_prof", "(", "step", ",", "rprof", ",", "rad", "=", "None", ")", ":", "rbot", ",", "rtop", "=", "misc", ".", "get_rbounds", "(", "step", ")", "if", "rbot", "==", "0", ":", "# not spherical", "return", "rprof", "if", "rad", "is", "None",...
Scale profile to take sphericity into account
[ "Scale", "profile", "to", "take", "sphericity", "into", "account" ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L148-L155
StagPython/StagPy
stagpy/processing.py
diff_prof
def diff_prof(step): """Diffusion. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at which it is evaluated. """ rbot, rtop = misc.get_rbounds(step) ...
python
def diff_prof(step): """Diffusion. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at which it is evaluated. """ rbot, rtop = misc.get_rbounds(step) ...
[ "def", "diff_prof", "(", "step", ")", ":", "rbot", ",", "rtop", "=", "misc", ".", "get_rbounds", "(", "step", ")", "rad", "=", "step", ".", "rprof", "[", "'r'", "]", ".", "values", "+", "rbot", "tprof", "=", "step", ".", "rprof", "[", "'Tmean'", ...
Diffusion. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at which it is evaluated.
[ "Diffusion", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L158-L177
StagPython/StagPy
stagpy/processing.py
diffs_prof
def diffs_prof(step): """Scaled diffusion. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at ...
python
def diffs_prof(step): """Scaled diffusion. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at ...
[ "def", "diffs_prof", "(", "step", ")", ":", "diff", ",", "rad", "=", "diff_prof", "(", "step", ")", "return", "_scale_prof", "(", "step", ",", "diff", ",", "rad", ")", ",", "rad" ]
Scaled diffusion. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the diffusion and the radial position at which it is evaluated.
[ "Scaled", "diffusion", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L180-L193
StagPython/StagPy
stagpy/processing.py
energy_prof
def energy_prof(step): """Energy flux. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the energy flux and the radial position at wh...
python
def energy_prof(step): """Energy flux. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the energy flux and the radial position at wh...
[ "def", "energy_prof", "(", "step", ")", ":", "diff", ",", "rad", "=", "diffs_prof", "(", "step", ")", "adv", ",", "_", "=", "advts_prof", "(", "step", ")", "return", "(", "diff", "+", "np", ".", "append", "(", "adv", ",", "0", ")", ")", ",", "r...
Energy flux. This computation takes sphericity into account if necessary. Args: step (:class:`~stagpy.stagyydata._Step`): a step of a StagyyData instance. Returns: tuple of :class:`numpy.array`: the energy flux and the radial position at which it is evaluated.
[ "Energy", "flux", "." ]
train
https://github.com/StagPython/StagPy/blob/18c4416cc4a1011db2fd736ee8b0ec29aa6e4fd4/stagpy/processing.py#L241-L255