repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
pavlov99/jsonapi
jsonapi/django_utils.py
clear_app_cache
def clear_app_cache(app_name): """ Clear django cache for models. :param str ap_name: name of application to clear model cache """ loading_cache = django.db.models.loading.cache if django.VERSION[:2] < (1, 7): loading_cache.app_models[app_name].clear() else: loading_cache.all_...
python
def clear_app_cache(app_name): """ Clear django cache for models. :param str ap_name: name of application to clear model cache """ loading_cache = django.db.models.loading.cache if django.VERSION[:2] < (1, 7): loading_cache.app_models[app_name].clear() else: loading_cache.all_...
[ "def", "clear_app_cache", "(", "app_name", ")", ":", "loading_cache", "=", "django", ".", "db", ".", "models", ".", "loading", ".", "cache", "if", "django", ".", "VERSION", "[", ":", "2", "]", "<", "(", "1", ",", "7", ")", ":", "loading_cache", ".", ...
Clear django cache for models. :param str ap_name: name of application to clear model cache
[ "Clear", "django", "cache", "for", "models", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/django_utils.py#L55-L66
train
64,800
liamw9534/bt-manager
bt_manager/codecs.py
SBCCodec._init_sbc_config
def _init_sbc_config(self, config): """ Translator from namedtuple config representation to the sbc_t type. :param namedtuple config: See :py:class:`.SBCCodecConfig` :returns: """ if (config.channel_mode == SBCChannelMode.CHANNEL_MODE_MONO): self.conf...
python
def _init_sbc_config(self, config): """ Translator from namedtuple config representation to the sbc_t type. :param namedtuple config: See :py:class:`.SBCCodecConfig` :returns: """ if (config.channel_mode == SBCChannelMode.CHANNEL_MODE_MONO): self.conf...
[ "def", "_init_sbc_config", "(", "self", ",", "config", ")", ":", "if", "(", "config", ".", "channel_mode", "==", "SBCChannelMode", ".", "CHANNEL_MODE_MONO", ")", ":", "self", ".", "config", ".", "mode", "=", "self", ".", "codec", ".", "SBC_MODE_MONO", "eli...
Translator from namedtuple config representation to the sbc_t type. :param namedtuple config: See :py:class:`.SBCCodecConfig` :returns:
[ "Translator", "from", "namedtuple", "config", "representation", "to", "the", "sbc_t", "type", "." ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/codecs.py#L111-L157
train
64,801
liamw9534/bt-manager
bt_manager/codecs.py
SBCCodec.decode
def decode(self, fd, mtu, max_len=2560): """ Read the media transport descriptor, depay the RTP payload and decode the SBC frames into a byte array. The maximum number of bytes to be returned may be passed as an argument and all available bytes are returned to the caller...
python
def decode(self, fd, mtu, max_len=2560): """ Read the media transport descriptor, depay the RTP payload and decode the SBC frames into a byte array. The maximum number of bytes to be returned may be passed as an argument and all available bytes are returned to the caller...
[ "def", "decode", "(", "self", ",", "fd", ",", "mtu", ",", "max_len", "=", "2560", ")", ":", "output_buffer", "=", "ffi", ".", "new", "(", "'char[]'", ",", "max_len", ")", "sz", "=", "self", ".", "codec", ".", "rtp_sbc_decode_from_fd", "(", "self", "....
Read the media transport descriptor, depay the RTP payload and decode the SBC frames into a byte array. The maximum number of bytes to be returned may be passed as an argument and all available bytes are returned to the caller. :param int fd: Media transport file descriptor ...
[ "Read", "the", "media", "transport", "descriptor", "depay", "the", "RTP", "payload", "and", "decode", "the", "SBC", "frames", "into", "a", "byte", "array", ".", "The", "maximum", "number", "of", "bytes", "to", "be", "returned", "may", "be", "passed", "as",...
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/codecs.py#L183-L205
train
64,802
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec._transport_ready_handler
def _transport_ready_handler(self, fd, cb_condition): """ Wrapper for calling user callback routine to notify when transport data is ready to read """ if(self.user_cb): self.user_cb(self.user_arg) return True
python
def _transport_ready_handler(self, fd, cb_condition): """ Wrapper for calling user callback routine to notify when transport data is ready to read """ if(self.user_cb): self.user_cb(self.user_arg) return True
[ "def", "_transport_ready_handler", "(", "self", ",", "fd", ",", "cb_condition", ")", ":", "if", "(", "self", ".", "user_cb", ")", ":", "self", ".", "user_cb", "(", "self", ".", "user_arg", ")", "return", "True" ]
Wrapper for calling user callback routine to notify when transport data is ready to read
[ "Wrapper", "for", "calling", "user", "callback", "routine", "to", "notify", "when", "transport", "data", "is", "ready", "to", "read" ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L184-L191
train
64,803
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec.read_transport
def read_transport(self): """ Read data from media transport. The returned data payload is SBC decoded and has all RTP encapsulation removed. :return data: Payload data that has been decoded, with RTP encapsulation removed. :rtype: array{byte} """ ...
python
def read_transport(self): """ Read data from media transport. The returned data payload is SBC decoded and has all RTP encapsulation removed. :return data: Payload data that has been decoded, with RTP encapsulation removed. :rtype: array{byte} """ ...
[ "def", "read_transport", "(", "self", ")", ":", "if", "(", "'r'", "not", "in", "self", ".", "access_type", ")", ":", "raise", "BTIncompatibleTransportAccessType", "return", "self", ".", "codec", ".", "decode", "(", "self", ".", "fd", ",", "self", ".", "r...
Read data from media transport. The returned data payload is SBC decoded and has all RTP encapsulation removed. :return data: Payload data that has been decoded, with RTP encapsulation removed. :rtype: array{byte}
[ "Read", "data", "from", "media", "transport", ".", "The", "returned", "data", "payload", "is", "SBC", "decoded", "and", "has", "all", "RTP", "encapsulation", "removed", "." ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L238-L250
train
64,804
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec.write_transport
def write_transport(self, data): """ Write data to media transport. The data is encoded using the SBC codec and RTP encapsulated before being written to the transport file descriptor. :param array{byte} data: Payload data to encode, encapsulate and send. ...
python
def write_transport(self, data): """ Write data to media transport. The data is encoded using the SBC codec and RTP encapsulated before being written to the transport file descriptor. :param array{byte} data: Payload data to encode, encapsulate and send. ...
[ "def", "write_transport", "(", "self", ",", "data", ")", ":", "if", "(", "'w'", "not", "in", "self", ".", "access_type", ")", ":", "raise", "BTIncompatibleTransportAccessType", "return", "self", ".", "codec", ".", "encode", "(", "self", ".", "fd", ",", "...
Write data to media transport. The data is encoded using the SBC codec and RTP encapsulated before being written to the transport file descriptor. :param array{byte} data: Payload data to encode, encapsulate and send.
[ "Write", "data", "to", "media", "transport", ".", "The", "data", "is", "encoded", "using", "the", "SBC", "codec", "and", "RTP", "encapsulated", "before", "being", "written", "to", "the", "transport", "file", "descriptor", "." ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L252-L264
train
64,805
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec.close_transport
def close_transport(self): """ Forcibly close previously acquired media transport. .. note:: The user should first make sure any transport event handlers are unregistered first. """ if (self.path): self._release_media_transport(self.path, ...
python
def close_transport(self): """ Forcibly close previously acquired media transport. .. note:: The user should first make sure any transport event handlers are unregistered first. """ if (self.path): self._release_media_transport(self.path, ...
[ "def", "close_transport", "(", "self", ")", ":", "if", "(", "self", ".", "path", ")", ":", "self", ".", "_release_media_transport", "(", "self", ".", "path", ",", "self", ".", "access_type", ")", "self", ".", "path", "=", "None" ]
Forcibly close previously acquired media transport. .. note:: The user should first make sure any transport event handlers are unregistered first.
[ "Forcibly", "close", "previously", "acquired", "media", "transport", "." ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L266-L276
train
64,806
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec._acquire_media_transport
def _acquire_media_transport(self, path, access_type): """ Should be called by subclass when it is ready to acquire the media transport file descriptor """ transport = BTMediaTransport(path=path) (fd, read_mtu, write_mtu) = transport.acquire(access_type) self.fd =...
python
def _acquire_media_transport(self, path, access_type): """ Should be called by subclass when it is ready to acquire the media transport file descriptor """ transport = BTMediaTransport(path=path) (fd, read_mtu, write_mtu) = transport.acquire(access_type) self.fd =...
[ "def", "_acquire_media_transport", "(", "self", ",", "path", ",", "access_type", ")", ":", "transport", "=", "BTMediaTransport", "(", "path", "=", "path", ")", "(", "fd", ",", "read_mtu", ",", "write_mtu", ")", "=", "transport", ".", "acquire", "(", "acces...
Should be called by subclass when it is ready to acquire the media transport file descriptor
[ "Should", "be", "called", "by", "subclass", "when", "it", "is", "ready", "to", "acquire", "the", "media", "transport", "file", "descriptor" ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L285-L297
train
64,807
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec._release_media_transport
def _release_media_transport(self, path, access_type): """ Should be called by subclass when it is finished with the media transport file descriptor """ try: self._uninstall_transport_ready() os.close(self.fd) # Clean-up previously taken fd t...
python
def _release_media_transport(self, path, access_type): """ Should be called by subclass when it is finished with the media transport file descriptor """ try: self._uninstall_transport_ready() os.close(self.fd) # Clean-up previously taken fd t...
[ "def", "_release_media_transport", "(", "self", ",", "path", ",", "access_type", ")", ":", "try", ":", "self", ".", "_uninstall_transport_ready", "(", ")", "os", ".", "close", "(", "self", ".", "fd", ")", "# Clean-up previously taken fd", "transport", "=", "BT...
Should be called by subclass when it is finished with the media transport file descriptor
[ "Should", "be", "called", "by", "subclass", "when", "it", "is", "finished", "with", "the", "media", "transport", "file", "descriptor" ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L299-L310
train
64,808
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec._make_config
def _make_config(config): """Helper to turn SBC codec configuration params into a a2dp_sbc_t structure usable by bluez""" # The SBC config encoding is taken from a2dp_codecs.h, in particular, # the a2dp_sbc_t type is converted into a 4-byte array: # uint8_t channel_mode:4 ...
python
def _make_config(config): """Helper to turn SBC codec configuration params into a a2dp_sbc_t structure usable by bluez""" # The SBC config encoding is taken from a2dp_codecs.h, in particular, # the a2dp_sbc_t type is converted into a 4-byte array: # uint8_t channel_mode:4 ...
[ "def", "_make_config", "(", "config", ")", ":", "# The SBC config encoding is taken from a2dp_codecs.h, in particular,", "# the a2dp_sbc_t type is converted into a 4-byte array:", "# uint8_t channel_mode:4", "# uint8_t frequency:4", "# uint8_t allocation_method:2", "# uint8_t subbands:...
Helper to turn SBC codec configuration params into a a2dp_sbc_t structure usable by bluez
[ "Helper", "to", "turn", "SBC", "codec", "configuration", "params", "into", "a", "a2dp_sbc_t", "structure", "usable", "by", "bluez" ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L353-L371
train
64,809
liamw9534/bt-manager
bt_manager/audio.py
SBCAudioCodec._parse_config
def _parse_config(config): """Helper to turn a2dp_sbc_t structure into a more usable set of SBC codec configuration params""" frequency = config[0] >> 4 channel_mode = config[0] & 0xF allocation_method = config[1] & 0x03 subbands = (config[1] >> 2) & 0x03 block_le...
python
def _parse_config(config): """Helper to turn a2dp_sbc_t structure into a more usable set of SBC codec configuration params""" frequency = config[0] >> 4 channel_mode = config[0] & 0xF allocation_method = config[1] & 0x03 subbands = (config[1] >> 2) & 0x03 block_le...
[ "def", "_parse_config", "(", "config", ")", ":", "frequency", "=", "config", "[", "0", "]", ">>", "4", "channel_mode", "=", "config", "[", "0", "]", "&", "0xF", "allocation_method", "=", "config", "[", "1", "]", "&", "0x03", "subbands", "=", "(", "co...
Helper to turn a2dp_sbc_t structure into a more usable set of SBC codec configuration params
[ "Helper", "to", "turn", "a2dp_sbc_t", "structure", "into", "a", "more", "usable", "set", "of", "SBC", "codec", "configuration", "params" ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/audio.py#L374-L385
train
64,810
python-wink/python-wink
src/pywink/devices/lock.py
WinkLock.add_new_key
def add_new_key(self, code, name): """Add a new user key code.""" device_json = {"code": code, "name": name} return self.api_interface.create_lock_key(self, device_json)
python
def add_new_key(self, code, name): """Add a new user key code.""" device_json = {"code": code, "name": name} return self.api_interface.create_lock_key(self, device_json)
[ "def", "add_new_key", "(", "self", ",", "code", ",", "name", ")", ":", "device_json", "=", "{", "\"code\"", ":", "code", ",", "\"name\"", ":", "name", "}", "return", "self", ".", "api_interface", ".", "create_lock_key", "(", "self", ",", "device_json", "...
Add a new user key code.
[ "Add", "a", "new", "user", "key", "code", "." ]
cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da
https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/lock.py#L90-L93
train
64,811
liamw9534/bt-manager
bt_manager/adapter.py
BTAdapter.create_paired_device
def create_paired_device(self, dev_id, agent_path, capability, cb_notify_device, cb_notify_error): """ Creates a new object path for a remote device. This method will connect to the remote device and retrieve all SDP records and then initiate the pairing. ...
python
def create_paired_device(self, dev_id, agent_path, capability, cb_notify_device, cb_notify_error): """ Creates a new object path for a remote device. This method will connect to the remote device and retrieve all SDP records and then initiate the pairing. ...
[ "def", "create_paired_device", "(", "self", ",", "dev_id", ",", "agent_path", ",", "capability", ",", "cb_notify_device", ",", "cb_notify_error", ")", ":", "return", "self", ".", "_interface", ".", "CreatePairedDevice", "(", "dev_id", ",", "agent_path", ",", "ca...
Creates a new object path for a remote device. This method will connect to the remote device and retrieve all SDP records and then initiate the pairing. If a previously :py:meth:`create_device` was used successfully, this method will only initiate the pairing. Compared to :py:m...
[ "Creates", "a", "new", "object", "path", "for", "a", "remote", "device", ".", "This", "method", "will", "connect", "to", "the", "remote", "device", "and", "retrieve", "all", "SDP", "records", "and", "then", "initiate", "the", "pairing", "." ]
51be2919394ce8134c698359649bfad09eedf4ec
https://github.com/liamw9534/bt-manager/blob/51be2919394ce8134c698359649bfad09eedf4ec/bt_manager/adapter.py#L185-L226
train
64,812
xZise/flake8-string-format
flake8_string_format.py
TextVisitor._visit_body
def _visit_body(self, node): """ Traverse the body of the node manually. If the first node is an expression which contains a string or bytes it marks that as a docstring. """ if (node.body and isinstance(node.body[0], ast.Expr) and self.is_base_string(nod...
python
def _visit_body(self, node): """ Traverse the body of the node manually. If the first node is an expression which contains a string or bytes it marks that as a docstring. """ if (node.body and isinstance(node.body[0], ast.Expr) and self.is_base_string(nod...
[ "def", "_visit_body", "(", "self", ",", "node", ")", ":", "if", "(", "node", ".", "body", "and", "isinstance", "(", "node", ".", "body", "[", "0", "]", ",", "ast", ".", "Expr", ")", "and", "self", ".", "is_base_string", "(", "node", ".", "body", ...
Traverse the body of the node manually. If the first node is an expression which contains a string or bytes it marks that as a docstring.
[ "Traverse", "the", "body", "of", "the", "node", "manually", "." ]
5d1538d3c91e3e8e8a7761e1bf8c5725f85c9747
https://github.com/xZise/flake8-string-format/blob/5d1538d3c91e3e8e8a7761e1bf8c5725f85c9747/flake8_string_format.py#L148-L161
train
64,813
claymation/python-builtwith
builtwith.py
BuiltWith.lookup
def lookup(self, domain, get_last_full_query=True): """ Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag enabled, it also queries for the date of the last full BuiltWith scan. """ last_full_builtwith_scan_date = None ...
python
def lookup(self, domain, get_last_full_query=True): """ Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag enabled, it also queries for the date of the last full BuiltWith scan. """ last_full_builtwith_scan_date = None ...
[ "def", "lookup", "(", "self", ",", "domain", ",", "get_last_full_query", "=", "True", ")", ":", "last_full_builtwith_scan_date", "=", "None", "if", "self", ".", "api_version", "==", "7", "and", "isinstance", "(", "domain", ",", "list", ")", ":", "domain", ...
Lookup BuiltWith results for the given domain. If API version 2 is used and the get_last_full_query flag enabled, it also queries for the date of the last full BuiltWith scan.
[ "Lookup", "BuiltWith", "results", "for", "the", "given", "domain", ".", "If", "API", "version", "2", "is", "used", "and", "the", "get_last_full_query", "flag", "enabled", "it", "also", "queries", "for", "the", "date", "of", "the", "last", "full", "BuiltWith"...
c7af08dd90586b5c0442c8c1ebce0009361bc91c
https://github.com/claymation/python-builtwith/blob/c7af08dd90586b5c0442c8c1ebce0009361bc91c/builtwith.py#L127-L160
train
64,814
pavlov99/jsonapi
jsonapi/api.py
API.register
def register(self, resource=None, **kwargs): """ Register resource for currnet API. :param resource: Resource to be registered :type resource: jsonapi.resource.Resource or None :return: resource :rtype: jsonapi.resource.Resource .. versionadded:: 0.4.1 :param kw...
python
def register(self, resource=None, **kwargs): """ Register resource for currnet API. :param resource: Resource to be registered :type resource: jsonapi.resource.Resource or None :return: resource :rtype: jsonapi.resource.Resource .. versionadded:: 0.4.1 :param kw...
[ "def", "register", "(", "self", ",", "resource", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "resource", "is", "None", ":", "def", "wrapper", "(", "resource", ")", ":", "return", "self", ".", "register", "(", "resource", ",", "*", "*", "k...
Register resource for currnet API. :param resource: Resource to be registered :type resource: jsonapi.resource.Resource or None :return: resource :rtype: jsonapi.resource.Resource .. versionadded:: 0.4.1 :param kwargs: Extra meta parameters
[ "Register", "resource", "for", "currnet", "API", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L69-L109
train
64,815
pavlov99/jsonapi
jsonapi/api.py
API.urls
def urls(self): """ Get all of the api endpoints. NOTE: only for django as of now. NOTE: urlpatterns are deprecated since Django1.8 :return list: urls """ from django.conf.urls import url urls = [ url(r'^$', self.documentation), url(r'^m...
python
def urls(self): """ Get all of the api endpoints. NOTE: only for django as of now. NOTE: urlpatterns are deprecated since Django1.8 :return list: urls """ from django.conf.urls import url urls = [ url(r'^$', self.documentation), url(r'^m...
[ "def", "urls", "(", "self", ")", ":", "from", "django", ".", "conf", ".", "urls", "import", "url", "urls", "=", "[", "url", "(", "r'^$'", ",", "self", ".", "documentation", ")", ",", "url", "(", "r'^map$'", ",", "self", ".", "map_view", ")", ",", ...
Get all of the api endpoints. NOTE: only for django as of now. NOTE: urlpatterns are deprecated since Django1.8 :return list: urls
[ "Get", "all", "of", "the", "api", "endpoints", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L112-L135
train
64,816
pavlov99/jsonapi
jsonapi/api.py
API.update_urls
def update_urls(self, request, resource_name=None, ids=None): """ Update url configuration. :param request: :param resource_name: :type resource_name: str or None :param ids: :rtype: None """ http_host = request.META.get('HTTP_HOST', None) if ht...
python
def update_urls(self, request, resource_name=None, ids=None): """ Update url configuration. :param request: :param resource_name: :type resource_name: str or None :param ids: :rtype: None """ http_host = request.META.get('HTTP_HOST', None) if ht...
[ "def", "update_urls", "(", "self", ",", "request", ",", "resource_name", "=", "None", ",", "ids", "=", "None", ")", ":", "http_host", "=", "request", ".", "META", ".", "get", "(", "'HTTP_HOST'", ",", "None", ")", "if", "http_host", "is", "None", ":", ...
Update url configuration. :param request: :param resource_name: :type resource_name: str or None :param ids: :rtype: None
[ "Update", "url", "configuration", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L137-L166
train
64,817
pavlov99/jsonapi
jsonapi/api.py
API.map_view
def map_view(self, request): """ Show information about available resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse """ self.update_urls(request) resource_info = { "resources": [{ "id": index ...
python
def map_view(self, request): """ Show information about available resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse """ self.update_urls(request) resource_info = { "resources": [{ "id": index ...
[ "def", "map_view", "(", "self", ",", "request", ")", ":", "self", ".", "update_urls", "(", "request", ")", "resource_info", "=", "{", "\"resources\"", ":", "[", "{", "\"id\"", ":", "index", "+", "1", ",", "\"href\"", ":", "\"{}/{}\"", ".", "format", "(...
Show information about available resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse
[ "Show", "information", "about", "available", "resources", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L168-L189
train
64,818
pavlov99/jsonapi
jsonapi/api.py
API.documentation
def documentation(self, request): """ Resource documentation. .. versionadded:: 0.7.2 Content-Type check :return django.http.HttpResponse """ self.update_urls(request) context = { "resources": sorted(self.resource_map.items()) } ...
python
def documentation(self, request): """ Resource documentation. .. versionadded:: 0.7.2 Content-Type check :return django.http.HttpResponse """ self.update_urls(request) context = { "resources": sorted(self.resource_map.items()) } ...
[ "def", "documentation", "(", "self", ",", "request", ")", ":", "self", ".", "update_urls", "(", "request", ")", "context", "=", "{", "\"resources\"", ":", "sorted", "(", "self", ".", "resource_map", ".", "items", "(", ")", ")", "}", "return", "render", ...
Resource documentation. .. versionadded:: 0.7.2 Content-Type check :return django.http.HttpResponse
[ "Resource", "documentation", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L191-L204
train
64,819
pavlov99/jsonapi
jsonapi/api.py
API.handler_view
def handler_view(self, request, resource_name, ids=None): """ Handler for resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse """ signal_request.send(sender=self, request=request) time_start = time.time() self.upda...
python
def handler_view(self, request, resource_name, ids=None): """ Handler for resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse """ signal_request.send(sender=self, request=request) time_start = time.time() self.upda...
[ "def", "handler_view", "(", "self", ",", "request", ",", "resource_name", ",", "ids", "=", "None", ")", ":", "signal_request", ".", "send", "(", "sender", "=", "self", ",", "request", "=", "request", ")", "time_start", "=", "time", ".", "time", "(", ")...
Handler for resources. .. versionadded:: 0.5.7 Content-Type check :return django.http.HttpResponse
[ "Handler", "for", "resources", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/api.py#L258-L312
train
64,820
RobSpectre/Caesar-Cipher
caesarcipher/caesarcipher.py
CaesarCipher.cipher
def cipher(self): """Applies the Caesar shift cipher. Based on the attributes of the object, applies the Caesar shift cipher to the message attribute. Accepts positive and negative integers as offsets. Required attributes: message offset Returns...
python
def cipher(self): """Applies the Caesar shift cipher. Based on the attributes of the object, applies the Caesar shift cipher to the message attribute. Accepts positive and negative integers as offsets. Required attributes: message offset Returns...
[ "def", "cipher", "(", "self", ")", ":", "# If no offset is selected, pick random one with sufficient distance", "# from original.", "if", "self", ".", "offset", "is", "False", ":", "self", ".", "offset", "=", "randrange", "(", "5", ",", "25", ")", "logging", ".", ...
Applies the Caesar shift cipher. Based on the attributes of the object, applies the Caesar shift cipher to the message attribute. Accepts positive and negative integers as offsets. Required attributes: message offset Returns: String with cip...
[ "Applies", "the", "Caesar", "shift", "cipher", "." ]
df30071e8170c019b236aa39bb2c2e98be583451
https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L102-L145
train
64,821
RobSpectre/Caesar-Cipher
caesarcipher/caesarcipher.py
CaesarCipher.calculate_entropy
def calculate_entropy(self, entropy_string): """Calculates the entropy of a string based on known frequency of English letters. Args: entropy_string: A str representing the string to calculate. Returns: A negative float with the total entropy of the string (high...
python
def calculate_entropy(self, entropy_string): """Calculates the entropy of a string based on known frequency of English letters. Args: entropy_string: A str representing the string to calculate. Returns: A negative float with the total entropy of the string (high...
[ "def", "calculate_entropy", "(", "self", ",", "entropy_string", ")", ":", "total", "=", "0", "for", "char", "in", "entropy_string", ":", "if", "char", ".", "isalpha", "(", ")", ":", "prob", "=", "self", ".", "frequency", "[", "char", ".", "lower", "(",...
Calculates the entropy of a string based on known frequency of English letters. Args: entropy_string: A str representing the string to calculate. Returns: A negative float with the total entropy of the string (higher is better).
[ "Calculates", "the", "entropy", "of", "a", "string", "based", "on", "known", "frequency", "of", "English", "letters", "." ]
df30071e8170c019b236aa39bb2c2e98be583451
https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L147-L164
train
64,822
RobSpectre/Caesar-Cipher
caesarcipher/caesarcipher.py
CaesarCipher.cracked
def cracked(self): """Attempts to crack ciphertext using frequency of letters in English. Returns: String of most likely message. """ logging.info("Cracking message: {0}".format(self.message)) entropy_values = {} attempt_cache = {} message = self.mess...
python
def cracked(self): """Attempts to crack ciphertext using frequency of letters in English. Returns: String of most likely message. """ logging.info("Cracking message: {0}".format(self.message)) entropy_values = {} attempt_cache = {} message = self.mess...
[ "def", "cracked", "(", "self", ")", ":", "logging", ".", "info", "(", "\"Cracking message: {0}\"", ".", "format", "(", "self", ".", "message", ")", ")", "entropy_values", "=", "{", "}", "attempt_cache", "=", "{", "}", "message", "=", "self", ".", "messag...
Attempts to crack ciphertext using frequency of letters in English. Returns: String of most likely message.
[ "Attempts", "to", "crack", "ciphertext", "using", "frequency", "of", "letters", "in", "English", "." ]
df30071e8170c019b236aa39bb2c2e98be583451
https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L167-L198
train
64,823
RobSpectre/Caesar-Cipher
caesarcipher/caesarcipher.py
CaesarCipher.decoded
def decoded(self): """Decodes message using Caesar shift cipher Inverse operation of encoding, applies negative offset to Caesar shift cipher. Returns: String decoded with cipher. """ logging.info("Decoding message: {0}".format(self.message)) self.of...
python
def decoded(self): """Decodes message using Caesar shift cipher Inverse operation of encoding, applies negative offset to Caesar shift cipher. Returns: String decoded with cipher. """ logging.info("Decoding message: {0}".format(self.message)) self.of...
[ "def", "decoded", "(", "self", ")", ":", "logging", ".", "info", "(", "\"Decoding message: {0}\"", ".", "format", "(", "self", ".", "message", ")", ")", "self", ".", "offset", "=", "self", ".", "offset", "*", "-", "1", "return", "self", ".", "cipher", ...
Decodes message using Caesar shift cipher Inverse operation of encoding, applies negative offset to Caesar shift cipher. Returns: String decoded with cipher.
[ "Decodes", "message", "using", "Caesar", "shift", "cipher" ]
df30071e8170c019b236aa39bb2c2e98be583451
https://github.com/RobSpectre/Caesar-Cipher/blob/df30071e8170c019b236aa39bb2c2e98be583451/caesarcipher/caesarcipher.py#L211-L222
train
64,824
pavlov99/jsonapi
jsonapi/request_parser.py
RequestParser.parse
def parse(cls, querydict): """ Parse querydict data. There are expected agruments: distinct, fields, filter, include, page, sort Parameters ---------- querydict : django.http.request.QueryDict MultiValueDict with query arguments. Returns ...
python
def parse(cls, querydict): """ Parse querydict data. There are expected agruments: distinct, fields, filter, include, page, sort Parameters ---------- querydict : django.http.request.QueryDict MultiValueDict with query arguments. Returns ...
[ "def", "parse", "(", "cls", ",", "querydict", ")", ":", "for", "key", "in", "querydict", ".", "keys", "(", ")", ":", "if", "not", "any", "(", "(", "key", "in", "JSONAPIQueryDict", ".", "_fields", ",", "cls", ".", "RE_FIELDS", ".", "match", "(", "ke...
Parse querydict data. There are expected agruments: distinct, fields, filter, include, page, sort Parameters ---------- querydict : django.http.request.QueryDict MultiValueDict with query arguments. Returns ------- result : dict ...
[ "Parse", "querydict", "data", "." ]
c27943f22f1f1d30d651fe267a99d2b38f69d604
https://github.com/pavlov99/jsonapi/blob/c27943f22f1f1d30d651fe267a99d2b38f69d604/jsonapi/request_parser.py#L23-L61
train
64,825
python-wink/python-wink
src/pywink/devices/binary_switch.py
WinkBinarySwitch.binary_state_name
def binary_state_name(self): """ Search all of the capabilities of the device and return the supported binary state field. Default to returning powered. """ return_field = "powered" _capabilities = self.json_state.get('capabilities') if _capabilities is not...
python
def binary_state_name(self): """ Search all of the capabilities of the device and return the supported binary state field. Default to returning powered. """ return_field = "powered" _capabilities = self.json_state.get('capabilities') if _capabilities is not...
[ "def", "binary_state_name", "(", "self", ")", ":", "return_field", "=", "\"powered\"", "_capabilities", "=", "self", ".", "json_state", ".", "get", "(", "'capabilities'", ")", "if", "_capabilities", "is", "not", "None", ":", "_fields", "=", "_capabilities", "....
Search all of the capabilities of the device and return the supported binary state field. Default to returning powered.
[ "Search", "all", "of", "the", "capabilities", "of", "the", "device", "and", "return", "the", "supported", "binary", "state", "field", ".", "Default", "to", "returning", "powered", "." ]
cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da
https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/binary_switch.py#L25-L38
train
64,826
markovmodel/msmtools
msmtools/flux/dense/tpt.py
flux_production
def flux_production(F): r"""Returns the net flux production for all states Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. Returns ------- prod : (n) ndarray array with flux production (positive) or consumption (negative) at each stat...
python
def flux_production(F): r"""Returns the net flux production for all states Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. Returns ------- prod : (n) ndarray array with flux production (positive) or consumption (negative) at each stat...
[ "def", "flux_production", "(", "F", ")", ":", "influxes", "=", "np", ".", "array", "(", "np", ".", "sum", "(", "F", ",", "axis", "=", "0", ")", ")", ".", "flatten", "(", ")", "# all that flows in", "outfluxes", "=", "np", ".", "array", "(", "np", ...
r"""Returns the net flux production for all states Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. Returns ------- prod : (n) ndarray array with flux production (positive) or consumption (negative) at each state
[ "r", "Returns", "the", "net", "flux", "production", "for", "all", "states" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/dense/tpt.py#L104-L120
train
64,827
markovmodel/msmtools
msmtools/flux/dense/tpt.py
total_flux
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer stat...
python
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer stat...
[ "def", "total_flux", "(", "F", ",", "A", "=", "None", ")", ":", "if", "A", "is", "None", ":", "prod", "=", "flux_production", "(", "F", ")", "zeros", "=", "np", ".", "zeros", "(", "len", "(", "prod", ")", ")", "outflux", "=", "np", ".", "sum", ...
r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks Parameters ---------- F : (n, n) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer state labels for set A (reactant) ...
[ "r", "Compute", "the", "total", "flux", "or", "turnover", "flux", "that", "is", "produced", "by", "the", "flux", "sources", "and", "consumed", "by", "the", "flux", "sinks" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/dense/tpt.py#L218-L246
train
64,828
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker._init_journal
def _init_journal(self, permissive=True): """Add the initialization lines to the journal. By default adds JrnObj variable and timestamp to the journal contents. Args: permissive (bool): if True most errors in journal will not cause Revit to stop journ...
python
def _init_journal(self, permissive=True): """Add the initialization lines to the journal. By default adds JrnObj variable and timestamp to the journal contents. Args: permissive (bool): if True most errors in journal will not cause Revit to stop journ...
[ "def", "_init_journal", "(", "self", ",", "permissive", "=", "True", ")", ":", "nowstamp", "=", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%d-%b-%Y %H:%M:%S.%f\"", ")", "[", ":", "-", "3", "]", "self", ".", "_add_entry", "(", "templates",...
Add the initialization lines to the journal. By default adds JrnObj variable and timestamp to the journal contents. Args: permissive (bool): if True most errors in journal will not cause Revit to stop journal execution. Some sti...
[ "Add", "the", "initialization", "lines", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L59-L73
train
64,829
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker._new_from_rft
def _new_from_rft(self, base_template, rft_file): """Append a new file from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: base_template (str): new file journal template from rmj.templates rft_fil...
python
def _new_from_rft(self, base_template, rft_file): """Append a new file from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: base_template (str): new file journal template from rmj.templates rft_fil...
[ "def", "_new_from_rft", "(", "self", ",", "base_template", ",", "rft_file", ")", ":", "self", ".", "_add_entry", "(", "base_template", ")", "self", ".", "_add_entry", "(", "templates", ".", "NEW_FROM_RFT", ".", "format", "(", "rft_file_path", "=", "rft_file", ...
Append a new file from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: base_template (str): new file journal template from rmj.templates rft_file (str): full path to .rft template to be used
[ "Append", "a", "new", "file", "from", ".", "rft", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L75-L88
train
64,830
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.new_model
def new_model(self, template_name='<None>'): """Append a new model from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: template_name (str): optional full path to .rft template ...
python
def new_model(self, template_name='<None>'): """Append a new model from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: template_name (str): optional full path to .rft template ...
[ "def", "new_model", "(", "self", ",", "template_name", "=", "'<None>'", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "NEW_MODEL", ".", "format", "(", "template_name", "=", "template_name", ")", ")" ]
Append a new model from .rft entry to the journal. This instructs Revit to create a new model based on the provided .rft template. Args: template_name (str): optional full path to .rft template to be used. default value is <None>
[ "Append", "a", "new", "model", "from", ".", "rft", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L134-L145
train
64,831
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.new_template
def new_template(self, template_name='<None>'): """Append a new template from .rft entry to the journal. This instructs Revit to create a new template model based on the provided .rft template. Args: template_name (str): optional full path to .rft template ...
python
def new_template(self, template_name='<None>'): """Append a new template from .rft entry to the journal. This instructs Revit to create a new template model based on the provided .rft template. Args: template_name (str): optional full path to .rft template ...
[ "def", "new_template", "(", "self", ",", "template_name", "=", "'<None>'", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "NEW_MODEL_TEMPLATE", ".", "format", "(", "template_name", "=", "template_name", ")", ")" ]
Append a new template from .rft entry to the journal. This instructs Revit to create a new template model based on the provided .rft template. Args: template_name (str): optional full path to .rft template to be used. default value is <None>
[ "Append", "a", "new", "template", "from", ".", "rft", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L147-L158
train
64,832
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.open_workshared_model
def open_workshared_model(self, model_path, central=False, detached=False, keep_worksets=True, audit=False, show_workset_config=1): """Append a open workshared model entry to the journal. This instructs Revit to open a workshared model. ...
python
def open_workshared_model(self, model_path, central=False, detached=False, keep_worksets=True, audit=False, show_workset_config=1): """Append a open workshared model entry to the journal. This instructs Revit to open a workshared model. ...
[ "def", "open_workshared_model", "(", "self", ",", "model_path", ",", "central", "=", "False", ",", "detached", "=", "False", ",", "keep_worksets", "=", "True", ",", "audit", "=", "False", ",", "show_workset_config", "=", "1", ")", ":", "if", "detached", ":...
Append a open workshared model entry to the journal. This instructs Revit to open a workshared model. Args: model_path (str): full path to workshared model central (bool): if True opens central model and not local detached (bool): if True opens a detached model ...
[ "Append", "a", "open", "workshared", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L160-L226
train
64,833
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.open_model
def open_model(self, model_path, audit=False): """Append a open non-workshared model entry to the journal. This instructs Revit to open a non-workshared model. Args: model_path (str): full path to non-workshared model audit (bool): if True audits the model when opening ...
python
def open_model(self, model_path, audit=False): """Append a open non-workshared model entry to the journal. This instructs Revit to open a non-workshared model. Args: model_path (str): full path to non-workshared model audit (bool): if True audits the model when opening ...
[ "def", "open_model", "(", "self", ",", "model_path", ",", "audit", "=", "False", ")", ":", "if", "audit", ":", "self", ".", "_add_entry", "(", "templates", ".", "FILE_OPEN_AUDIT", ".", "format", "(", "model_path", "=", "model_path", ")", ")", "else", ":"...
Append a open non-workshared model entry to the journal. This instructs Revit to open a non-workshared model. Args: model_path (str): full path to non-workshared model audit (bool): if True audits the model when opening
[ "Append", "a", "open", "non", "-", "workshared", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L228-L242
train
64,834
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.execute_command
def execute_command(self, tab_name, panel_name, command_module, command_class, command_data=None): """Append an execute external command entry to the journal. This instructs Revit to execute the provided command from the provided module, tab, and panel. Args: ...
python
def execute_command(self, tab_name, panel_name, command_module, command_class, command_data=None): """Append an execute external command entry to the journal. This instructs Revit to execute the provided command from the provided module, tab, and panel. Args: ...
[ "def", "execute_command", "(", "self", ",", "tab_name", ",", "panel_name", ",", "command_module", ",", "command_class", ",", "command_data", "=", "None", ")", ":", "# make sure command_data is not empty", "command_data", "=", "{", "}", "if", "command_data", "is", ...
Append an execute external command entry to the journal. This instructs Revit to execute the provided command from the provided module, tab, and panel. Args: tab_name (str): name of ribbon tab that contains the command panel_name (str): name of ribbon panel that contain...
[ "Append", "an", "execute", "external", "command", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L251-L297
train
64,835
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.execute_dynamo_definition
def execute_dynamo_definition(self, definition_path, show_ui=False, shutdown=True, automation=False, path_exec=True): """Execute a dynamo definition. Args: definition_path (str): full path to dynamo definition file ...
python
def execute_dynamo_definition(self, definition_path, show_ui=False, shutdown=True, automation=False, path_exec=True): """Execute a dynamo definition. Args: definition_path (str): full path to dynamo definition file ...
[ "def", "execute_dynamo_definition", "(", "self", ",", "definition_path", ",", "show_ui", "=", "False", ",", "shutdown", "=", "True", ",", "automation", "=", "False", ",", "path_exec", "=", "True", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", ...
Execute a dynamo definition. Args: definition_path (str): full path to dynamo definition file show_ui (bool): show dynamo UI at execution shutdown (bool): shutdown model after execution automation (bool): activate dynamo automation path_exec (bool): a...
[ "Execute", "a", "dynamo", "definition", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L299-L324
train
64,836
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.import_family
def import_family(self, rfa_file): """Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file """ self._add_entry(templates.IMPORT_FAMILY ...
python
def import_family(self, rfa_file): """Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file """ self._add_entry(templates.IMPORT_FAMILY ...
[ "def", "import_family", "(", "self", ",", "rfa_file", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "IMPORT_FAMILY", ".", "format", "(", "family_file", "=", "rfa_file", ")", ")" ]
Append a import family entry to the journal. This instructs Revit to import a family into the opened model. Args: rfa_file (str): full path of the family file
[ "Append", "a", "import", "family", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L326-L335
train
64,837
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.export_warnings
def export_warnings(self, export_file): """Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. ...
python
def export_warnings(self, export_file): """Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. ...
[ "def", "export_warnings", "(", "self", ",", "export_file", ")", ":", "warn_filepath", "=", "op", ".", "dirname", "(", "export_file", ")", "warn_filename", "=", "op", ".", "splitext", "(", "op", ".", "basename", "(", "export_file", ")", ")", "[", "0", "]"...
Append an export warnings entry to the journal. This instructs Revit to export warnings from the opened model. Currently Revit will stop journal execution if the model does not have any warnings and the export warnings UI button is disabled. Args: export_file (str): full pa...
[ "Append", "an", "export", "warnings", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L345-L359
train
64,838
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.purge_unused
def purge_unused(self, pass_count=3): """Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3 """ for purge_count in range(0...
python
def purge_unused(self, pass_count=3): """Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3 """ for purge_count in range(0...
[ "def", "purge_unused", "(", "self", ",", "pass_count", "=", "3", ")", ":", "for", "purge_count", "in", "range", "(", "0", ",", "pass_count", ")", ":", "self", ".", "_add_entry", "(", "templates", ".", "PROJECT_PURGE", ")" ]
Append an purge model entry to the journal. This instructs Revit to purge the open model. Args: pass_count (int): number of times to execute the purge. default is 3
[ "Append", "an", "purge", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L361-L371
train
64,839
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.sync_model
def sync_model(self, comment='', compact_central=False, release_borrowed=True, release_workset=True, save_local=False): """Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment...
python
def sync_model(self, comment='', compact_central=False, release_borrowed=True, release_workset=True, save_local=False): """Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment...
[ "def", "sync_model", "(", "self", ",", "comment", "=", "''", ",", "compact_central", "=", "False", ",", "release_borrowed", "=", "True", ",", "release_workset", "=", "True", ",", "save_local", "=", "False", ")", ":", "self", ".", "_add_entry", "(", "templa...
Append a sync model entry to the journal. This instructs Revit to sync the currently open workshared model. Args: comment (str): comment to be provided for the sync step compact_central (bool): if True compacts the central file release_borrowed (bool): if True relea...
[ "Append", "a", "sync", "model", "entry", "to", "the", "journal", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L394-L420
train
64,840
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalMaker.write_journal
def write_journal(self, journal_file_path): """Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file """ # TODO: assert the extension is txt and not other with open(journal_file_path, "w") as jrn_file: ...
python
def write_journal(self, journal_file_path): """Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file """ # TODO: assert the extension is txt and not other with open(journal_file_path, "w") as jrn_file: ...
[ "def", "write_journal", "(", "self", ",", "journal_file_path", ")", ":", "# TODO: assert the extension is txt and not other", "with", "open", "(", "journal_file_path", ",", "\"w\"", ")", "as", "jrn_file", ":", "jrn_file", ".", "write", "(", "self", ".", "_journal_co...
Write the constructed journal in to the provided file. Args: journal_file_path (str): full path to output journal file
[ "Write", "the", "constructed", "journal", "in", "to", "the", "provided", "file", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L422-L430
train
64,841
eirannejad/Revit-Journal-Maker
rjm/__init__.py
JournalReader.endswith
def endswith(self, search_str): """Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for ...
python
def endswith(self, search_str): """Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for ...
[ "def", "endswith", "(", "self", ",", "search_str", ")", ":", "for", "entry", "in", "reversed", "(", "list", "(", "open", "(", "self", ".", "_jrnl_file", ",", "'r'", ")", ")", "[", "-", "5", ":", "]", ")", ":", "if", "search_str", "in", "entry", "...
Check whether the provided string exists in Journal file. Only checks the last 5 lines of the journal file. This method is usually used when tracking a journal from an active Revit session. Args: search_str (str): string to search for Returns: bool: if True the...
[ "Check", "whether", "the", "provided", "string", "exists", "in", "Journal", "file", "." ]
09a4f27da6d183f63a2c93ed99dca8a8590d5241
https://github.com/eirannejad/Revit-Journal-Maker/blob/09a4f27da6d183f63a2c93ed99dca8a8590d5241/rjm/__init__.py#L453-L469
train
64,842
markovmodel/msmtools
msmtools/estimation/sparse/prior.py
prior_neighbor
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) ...
python
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) ...
[ "def", "prior_neighbor", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "C_sym", "=", "C", "+", "C", ".", "transpose", "(", ")", "C_sym", "=", "C_sym", ".", "tocoo", "(", ")", "data", "=", "C_sym", ".", "data", "row", "=", "C_sym", ".", "row", ...
r"""Neighbor prior of strength alpha for the given count matrix. Prior is defined by b_ij = alpha if Z_ij+Z_ji > 0 b_ij = 0 else Parameters ---------- C : (M, M) scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns -...
[ "r", "Neighbor", "prior", "of", "strength", "alpha", "for", "the", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/prior.py#L31-L59
train
64,843
markovmodel/msmtools
msmtools/estimation/sparse/prior.py
prior_const
def prior_const(C, alpha=0.001): """Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B ...
python
def prior_const(C, alpha=0.001): """Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B ...
[ "def", "prior_const", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "B", "=", "alpha", "*", "np", ".", "ones", "(", "C", ".", "shape", ")", "return", "B" ]
Constant prior of strength alpha. Prior is defined via b_ij=alpha for all i,j Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray Prior count mat...
[ "Constant", "prior", "of", "strength", "alpha", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/prior.py#L62-L83
train
64,844
markovmodel/msmtools
msmtools/analysis/dense/assessment.py
is_transition_matrix
def is_transition_matrix(T, tol=1e-10): """ Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, ...
python
def is_transition_matrix(T, tol=1e-10): """ Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, ...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", "=", "1e-10", ")", ":", "if", "T", ".", "ndim", "!=", "2", ":", "return", "False", "if", "T", ".", "shape", "[", "0", "]", "!=", "T", ".", "shape", "[", "1", "]", ":", "return", "False", "dim...
Tests whether T is a transition matrix Parameters ---------- T : ndarray shape=(n, n) matrix to test tol : float tolerance to check with Returns ------- Truth value : bool True, if all elements are in interval [0, 1] and each row of T sums up to 1. ...
[ "Tests", "whether", "T", "is", "a", "transition", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/assessment.py#L25-L50
train
64,845
markovmodel/msmtools
msmtools/estimation/sparse/count_matrix.py
count_matrix_coo2_mult
def count_matrix_coo2_mult(dtrajs, lag, sliding=True, sparse=True, nstates=None): r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of nda...
python
def count_matrix_coo2_mult(dtrajs, lag, sliding=True, sparse=True, nstates=None): r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of nda...
[ "def", "count_matrix_coo2_mult", "(", "dtrajs", ",", "lag", ",", "sliding", "=", "True", ",", "sparse", "=", "True", ",", "nstates", "=", "None", ")", ":", "# Determine number of states", "if", "nstates", "is", "None", ":", "from", "msmtools", ".", "dtraj", ...
r"""Generate a count matrix from a given list discrete trajectories. The generated count matrix is a sparse matrix in compressed sparse row (CSR) or numpy ndarray format. Parameters ---------- dtraj : list of ndarrays discrete trajectories lag : int Lagtime in trajectory steps ...
[ "r", "Generate", "a", "count", "matrix", "from", "a", "given", "list", "discrete", "trajectories", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/count_matrix.py#L33-L88
train
64,846
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_transition_matrix
def is_transition_matrix(T, tol): """ True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherw...
python
def is_transition_matrix(T, tol): """ True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherw...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", ")", ":", "T", "=", "T", ".", "tocsr", "(", ")", "# compressed sparse row for fast row slicing", "values", "=", "T", ".", "data", "# non-zero entries of T", "\"\"\"Check entry-wise positivity\"\"\"", "is_positive", ...
True if T is a transition matrix Parameters ---------- T : scipy.sparse matrix Matrix to check tol : float tolerance to check with Returns ------- Truth value: bool True, if T is positive and normed False, otherwise
[ "True", "if", "T", "is", "a", "transition", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L33-L60
train
64,847
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_connected
def is_connected(T, directed=True): r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix dire...
python
def is_connected(T, directed=True): r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix dire...
[ "def", "is_connected", "(", "T", ",", "directed", "=", "True", ")", ":", "nc", "=", "connected_components", "(", "T", ",", "directed", "=", "directed", ",", "connection", "=", "'strong'", ",", "return_labels", "=", "False", ")", "return", "nc", "==", "1"...
r"""Check connectivity of the transition matrix. Return true, if the input matrix is completely connected, effectively checking if the number of connected components equals one. Parameters ---------- T : scipy.sparse matrix Transition matrix directed : bool, optional Whether to ...
[ "r", "Check", "connectivity", "of", "the", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L138-L160
train
64,848
markovmodel/msmtools
msmtools/analysis/sparse/assessment.py
is_ergodic
def is_ergodic(T, tol): """ checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise """ if isdense...
python
def is_ergodic(T, tol): """ checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise """ if isdense...
[ "def", "is_ergodic", "(", "T", ",", "tol", ")", ":", "if", "isdense", "(", "T", ")", ":", "T", "=", "T", ".", "tocsr", "(", ")", "if", "not", "is_transition_matrix", "(", "T", ",", "tol", ")", ":", "raise", "ValueError", "(", "\"given matrix is not a...
checks if T is 'ergodic' Parameters ---------- T : scipy.sparse matrix Transition matrix tol : float tolerance Returns ------- Truth value : bool True, if # strongly connected components = 1 False, otherwise
[ "checks", "if", "T", "is", "ergodic" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/assessment.py#L163-L189
train
64,849
yaybu/callsign
callsign/scripts/daemon.py
spawn
def spawn(opts, conf): """ Acts like twistd """ if opts.config is not None: os.environ["CALLSIGN_CONFIG_FILE"] = opts.config sys.argv[1:] = [ "-noy", sibpath(__file__, "callsign.tac"), "--pidfile", conf['pidfile'], "--logfile", conf['logfile'], ] twistd.run()
python
def spawn(opts, conf): """ Acts like twistd """ if opts.config is not None: os.environ["CALLSIGN_CONFIG_FILE"] = opts.config sys.argv[1:] = [ "-noy", sibpath(__file__, "callsign.tac"), "--pidfile", conf['pidfile'], "--logfile", conf['logfile'], ] twistd.run()
[ "def", "spawn", "(", "opts", ",", "conf", ")", ":", "if", "opts", ".", "config", "is", "not", "None", ":", "os", ".", "environ", "[", "\"CALLSIGN_CONFIG_FILE\"", "]", "=", "opts", ".", "config", "sys", ".", "argv", "[", "1", ":", "]", "=", "[", "...
Acts like twistd
[ "Acts", "like", "twistd" ]
e70e5368bfe4fd3ae3fdd1ed43944b53ffa1e100
https://github.com/yaybu/callsign/blob/e70e5368bfe4fd3ae3fdd1ed43944b53ffa1e100/callsign/scripts/daemon.py#L13-L22
train
64,850
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
find_bottleneck
def find_bottleneck(F, A, B): r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The ...
python
def find_bottleneck(F, A, B): r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The ...
[ "def", "find_bottleneck", "(", "F", ",", "A", ",", "B", ")", ":", "if", "F", ".", "nnz", "==", "0", ":", "raise", "PathwayError", "(", "'no more pathways left: Flux matrix does not contain any positive entries'", ")", "F", "=", "F", ".", "tocoo", "(", ")", "...
r"""Find dynamic bottleneck of flux network. Parameters ---------- F : scipy.sparse matrix The flux network A : array_like The set of starting states B : array_like The set of end states Returns ------- e : tuple of int The edge corresponding to the dynamic ...
[ "r", "Find", "dynamic", "bottleneck", "of", "flux", "network", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L39-L98
train
64,851
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
has_connection
def has_connection(graph, A, B): r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ...
python
def has_connection(graph, A, B): r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ...
[ "def", "has_connection", "(", "graph", ",", "A", ",", "B", ")", ":", "for", "istart", "in", "A", ":", "nodes", "=", "csgraph", ".", "breadth_first_order", "(", "graph", ",", "istart", ",", "directed", "=", "True", ",", "return_predecessors", "=", "False"...
r"""Check if the given graph contains a path connecting A and B. Parameters ---------- graph : scipy.sparse matrix Adjacency matrix of the graph A : array_like The set of starting states B : array_like The set of end states Returns ------- hc : bool True ...
[ "r", "Check", "if", "the", "given", "graph", "contains", "a", "path", "connecting", "A", "and", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L101-L124
train
64,852
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
has_path
def has_path(nodes, A, B): r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns...
python
def has_path(nodes, A, B): r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns...
[ "def", "has_path", "(", "nodes", ",", "A", ",", "B", ")", ":", "x1", "=", "np", ".", "intersect1d", "(", "nodes", ",", "A", ")", ".", "size", ">", "0", "x2", "=", "np", ".", "intersect1d", "(", "nodes", ",", "B", ")", ".", "size", ">", "0", ...
r"""Test if nodes from a breadth_first_order search lead from A to B. Parameters ---------- nodes : array_like Nodes from breadth_first_oder_seatch A : array_like The set of educt states B : array_like The set of product states Returns ------- has_path : boo...
[ "r", "Test", "if", "nodes", "from", "a", "breadth_first_order", "search", "lead", "from", "A", "to", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L127-L148
train
64,853
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
pathway
def pathway(F, A, B): r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w...
python
def pathway(F, A, B): r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w...
[ "def", "pathway", "(", "F", ",", "A", ",", "B", ")", ":", "if", "F", ".", "nnz", "==", "0", ":", "raise", "PathwayError", "(", "'no more pathways left: Flux matrix does not contain any positive entries'", ")", "b1", ",", "b2", ",", "F", "=", "find_bottleneck",...
r"""Compute the dominant reaction-pathway. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- w : list The domina...
[ "r", "Compute", "the", "dominant", "reaction", "-", "pathway", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L151-L188
train
64,854
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
remove_path
def remove_path(F, path): r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated fl...
python
def remove_path(F, path): r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated fl...
[ "def", "remove_path", "(", "F", ",", "path", ")", ":", "c", "=", "capacity", "(", "F", ",", "path", ")", "F", "=", "F", ".", "todok", "(", ")", "L", "=", "len", "(", "path", ")", "for", "l", "in", "range", "(", "L", "-", "1", ")", ":", "i...
r"""Remove capacity along a path from flux network. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) path : list Reaction path Returns ------- F : (M, M) scipy.sparse matrix The updated flux network
[ "r", "Remove", "capacity", "along", "a", "path", "from", "flux", "network", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L218-L241
train
64,855
markovmodel/msmtools
msmtools/flux/sparse/pathways.py
add_endstates
def add_endstates(F, A, B): r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states ...
python
def add_endstates(F, A, B): r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states ...
[ "def", "add_endstates", "(", "F", ",", "A", ",", "B", ")", ":", "\"\"\"Outgoing currents from A\"\"\"", "F", "=", "F", ".", "tocsr", "(", ")", "outA", "=", "(", "F", "[", "A", ",", ":", "]", ".", "sum", "(", "axis", "=", "1", ")", ")", ".", "ge...
r"""Adds artifical end states replacing source and sink sets. Parameters ---------- F : (M, M) scipy.sparse matrix The flux network (matrix of netflux values) A : array_like The set of starting states B : array_like The set of end states Returns ------- F_new : ...
[ "r", "Adds", "artifical", "end", "states", "replacing", "source", "and", "sink", "sets", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/pathways.py#L322-L380
train
64,856
nitely/v8-cffi
v8cffi/context.py
_is_utf_8
def _is_utf_8(txt): """ Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool """ assert isinstance(txt, six.binary_type) try: _ = six.text_type(txt, 'utf-8') except (TypeError, UnicodeEncodeErro...
python
def _is_utf_8(txt): """ Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool """ assert isinstance(txt, six.binary_type) try: _ = six.text_type(txt, 'utf-8') except (TypeError, UnicodeEncodeErro...
[ "def", "_is_utf_8", "(", "txt", ")", ":", "assert", "isinstance", "(", "txt", ",", "six", ".", "binary_type", ")", "try", ":", "_", "=", "six", ".", "text_type", "(", "txt", ",", "'utf-8'", ")", "except", "(", "TypeError", ",", "UnicodeEncodeError", ")...
Check a string is utf-8 encoded :param bytes txt: utf-8 string :return: Whether the string\ is utf-8 encoded or not :rtype: bool
[ "Check", "a", "string", "is", "utf", "-", "8", "encoded" ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L22-L38
train
64,857
nitely/v8-cffi
v8cffi/context.py
Context.load_libs
def load_libs(self, scripts_paths): """ Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list...
python
def load_libs(self, scripts_paths): """ Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list...
[ "def", "load_libs", "(", "self", ",", "scripts_paths", ")", ":", "for", "path", "in", "scripts_paths", ":", "self", ".", "run_script", "(", "_read_file", "(", "path", ")", ",", "identifier", "=", "path", ")" ]
Load script files into the context.\ This can be thought as the HTML script tag.\ The files content must be utf-8 encoded. This is a shortcut for reading the files\ and pass the content to :py:func:`run_script` :param list scripts_paths: Script file paths. :raises OSErr...
[ "Load", "script", "files", "into", "the", "context", ".", "\\", "This", "can", "be", "thought", "as", "the", "HTML", "script", "tag", ".", "\\", "The", "files", "content", "must", "be", "utf", "-", "8", "encoded", "." ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L168-L185
train
64,858
nitely/v8-cffi
v8cffi/context.py
Context.run_script
def run_script(self, script, identifier=_DEFAULT_SCRIPT_NAME): """ Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param ident...
python
def run_script(self, script, identifier=_DEFAULT_SCRIPT_NAME): """ Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param ident...
[ "def", "run_script", "(", "self", ",", "script", ",", "identifier", "=", "_DEFAULT_SCRIPT_NAME", ")", ":", "assert", "isinstance", "(", "script", ",", "six", ".", "text_type", ")", "or", "_is_utf_8", "(", "script", ")", "assert", "isinstance", "(", "identifi...
Run a JS script within the context.\ All code is ran synchronously,\ there is no event loop. It's thread-safe :param script: utf-8 encoded or unicode string :type script: bytes or str :param identifier: utf-8 encoded or unicode string.\ This is used as the name of the sc...
[ "Run", "a", "JS", "script", "within", "the", "context", ".", "\\", "All", "code", "is", "ran", "synchronously", "\\", "there", "is", "no", "event", "loop", ".", "It", "s", "thread", "-", "safe" ]
e3492e7eaacb30be75999c24413aa15eeab57a5d
https://github.com/nitely/v8-cffi/blob/e3492e7eaacb30be75999c24413aa15eeab57a5d/v8cffi/context.py#L187-L229
train
64,859
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
eigenvalues
def eigenvalues(T, k=None, reversible=False, mu=None): r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, op...
python
def eigenvalues(T, k=None, reversible=False, mu=None): r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, op...
[ "def", "eigenvalues", "(", "T", ",", "k", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "if", "reversible", ":", "try", ":", "evals", "=", "eigenvalues_rev", "(", "T", ",", "k", "=", "k", ",", "mu", "=", "mu", ...
r"""Compute eigenvalues of given transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T reversible : bool, optional Indicate that transition matrix is reversibl...
[ "r", "Compute", "eigenvalues", "of", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L43-L96
train
64,860
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
eigenvalues_rev
def eigenvalues_rev(T, k=None, mu=None): r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional ...
python
def eigenvalues_rev(T, k=None, mu=None): r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional ...
[ "def", "eigenvalues_rev", "(", "T", ",", "k", "=", "None", ",", "mu", "=", "None", ")", ":", "\"\"\"compute stationary distribution if not given\"\"\"", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "if", "np", ".", "any...
r"""Compute eigenvalues of reversible transition matrix. Parameters ---------- T : (d, d) ndarray Transition matrix (stochastic matrix) k : int or tuple of ints, optional Compute the first k eigenvalues of T mu : (d,) ndarray, optional Stationary distribution of T Retur...
[ "r", "Compute", "eigenvalues", "of", "reversible", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L98-L134
train
64,861
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
rdl_decomposition_nrev
def rdl_decomposition_nrev(T, norm='standard'): r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary dist...
python
def rdl_decomposition_nrev(T, norm='standard'): r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary dist...
[ "def", "rdl_decomposition_nrev", "(", "T", ",", "norm", "=", "'standard'", ")", ":", "d", "=", "T", ".", "shape", "[", "0", "]", "w", ",", "R", "=", "eig", "(", "T", ")", "\"\"\"Sort by decreasing magnitude of eigenvalue\"\"\"", "ind", "=", "np", ".", "a...
r"""Decomposition into left and right eigenvectors. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary distribution mu of T. Right eigenvectors R h...
[ "r", "Decomposition", "into", "left", "and", "right", "eigenvectors", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L319-L394
train
64,862
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
rdl_decomposition_rev
def rdl_decomposition_rev(T, norm='reversible', mu=None): r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probabil...
python
def rdl_decomposition_rev(T, norm='reversible', mu=None): r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probabil...
[ "def", "rdl_decomposition_rev", "(", "T", ",", "norm", "=", "'reversible'", ",", "mu", "=", "None", ")", ":", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "\"\"\" symmetrize T \"\"\"", "smu", "=", "np", ".", "sqrt", ...
r"""Decomposition into left and right eigenvectors for reversible transition matrices. Parameters ---------- T : (M, M) ndarray Transition matrix norm: {'standard', 'reversible'} standard: (L'R) = Id, L[:,0] is a probability distribution, the stationary distribution mu o...
[ "r", "Decomposition", "into", "left", "and", "right", "eigenvectors", "for", "reversible", "transition", "matrices", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L396-L474
train
64,863
markovmodel/msmtools
msmtools/analysis/dense/decomposition.py
timescales_from_eigenvalues
def timescales_from_eigenvalues(evals, tau=1): r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order. """ """Chec...
python
def timescales_from_eigenvalues(evals, tau=1): r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order. """ """Chec...
[ "def", "timescales_from_eigenvalues", "(", "evals", ",", "tau", "=", "1", ")", ":", "\"\"\"Check for dominant eigenvalues with large imaginary part\"\"\"", "if", "not", "np", ".", "allclose", "(", "evals", ".", "imag", ",", "0.0", ")", ":", "warnings", ".", "warn"...
r"""Compute implied time scales from given eigenvalues Parameters ---------- evals : eigenvalues tau : lag time Returns ------- ts : ndarray The implied time scales to the given eigenvalues, in the same order.
[ "r", "Compute", "implied", "time", "scales", "from", "given", "eigenvalues" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/decomposition.py#L522-L556
train
64,864
markovmodel/msmtools
msmtools/util/matrix/matrix.py
is_sparse_file
def is_sparse_file(filename): """Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False. """ dirname, basename = os.path.split(filename) name, ext = os.path.splitext(basename) matrix_name, matrix_ext = os.path.splitext(nam...
python
def is_sparse_file(filename): """Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False. """ dirname, basename = os.path.split(filename) name, ext = os.path.splitext(basename) matrix_name, matrix_ext = os.path.splitext(nam...
[ "def", "is_sparse_file", "(", "filename", ")", ":", "dirname", ",", "basename", "=", "os", ".", "path", ".", "split", "(", "filename", ")", "name", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "basename", ")", "matrix_name", ",", "matrix_e...
Determine if the given filename indicates a dense or a sparse matrix If pathname is xxx.coo.yyy return True otherwise False.
[ "Determine", "if", "the", "given", "filename", "indicates", "a", "dense", "or", "a", "sparse", "matrix" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/util/matrix/matrix.py#L44-L56
train
64,865
markovmodel/msmtools
msmtools/analysis/sparse/stationary_vector.py
stationary_distribution_from_backward_iteration
def stationary_distribution_from_backward_iteration(P, eps=1e-15): r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue...
python
def stationary_distribution_from_backward_iteration(P, eps=1e-15): r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue...
[ "def", "stationary_distribution_from_backward_iteration", "(", "P", ",", "eps", "=", "1e-15", ")", ":", "A", "=", "P", ".", "transpose", "(", ")", "mu", "=", "1.0", "-", "eps", "x0", "=", "np", ".", "ones", "(", "P", ".", "shape", "[", "0", "]", ")...
r"""Fast computation of the stationary vector using backward iteration. Parameters ---------- P : (M, M) scipy.sparse matrix Transition matrix eps : float (optional) Perturbation parameter for the true eigenvalue. Returns ------- pi : (M,) ndarray Stationary vec...
[ "r", "Fast", "computation", "of", "the", "stationary", "vector", "using", "backward", "iteration", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/stationary_vector.py#L77-L99
train
64,866
markovmodel/msmtools
msmtools/analysis/sparse/decomposition.py
eigenvalues
def eigenvalues(T, k=None, ncv=None, reversible=False, mu=None): r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The ...
python
def eigenvalues(T, k=None, ncv=None, reversible=False, mu=None): r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The ...
[ "def", "eigenvalues", "(", "T", ",", "k", "=", "None", ",", "ncv", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "if", "k", "is", "None", ":", "raise", "ValueError", "(", "\"Number of eigenvalues required for decomposition...
r"""Compute the eigenvalues of a sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int, optional Number of eigenvalues to compute. ncv : int, optional The number of Lanczos vectors generated, `ncv` must be greater than k; ...
[ "r", "Compute", "the", "eigenvalues", "of", "a", "sparse", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/decomposition.py#L41-L86
train
64,867
markovmodel/msmtools
msmtools/analysis/sparse/decomposition.py
eigenvalues_rev
def eigenvalues_rev(T, k, ncv=None, mu=None): r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos...
python
def eigenvalues_rev(T, k, ncv=None, mu=None): r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos...
[ "def", "eigenvalues_rev", "(", "T", ",", "k", ",", "ncv", "=", "None", ",", "mu", "=", "None", ")", ":", "\"\"\"compute stationary distribution if not given\"\"\"", "if", "mu", "is", "None", ":", "mu", "=", "stationary_distribution", "(", "T", ")", "if", "np...
r"""Compute the eigenvalues of a reversible, sparse transition matrix. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix k : int Number of eigenvalues to compute. ncv : int, optional The number of Lanczos vectors generated, `ncv` must be greater than k; ...
[ "r", "Compute", "the", "eigenvalues", "of", "a", "reversible", "sparse", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/sparse/decomposition.py#L88-L131
train
64,868
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
number_of_states
def number_of_states(dtrajs): r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ # determine number of states n nmax = 0 for dtraj in dtrajs: nmax = max(nmax, np.max(dtra...
python
def number_of_states(dtrajs): r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ # determine number of states n nmax = 0 for dtraj in dtrajs: nmax = max(nmax, np.max(dtra...
[ "def", "number_of_states", "(", "dtrajs", ")", ":", "# determine number of states n", "nmax", "=", "0", "for", "dtraj", "in", "dtrajs", ":", "nmax", "=", "max", "(", "nmax", ",", "np", ".", "max", "(", "dtraj", ")", ")", "# return number of states", "return"...
r""" Determine the number of states from a set of discrete trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories
[ "r", "Determine", "the", "number", "of", "states", "from", "a", "set", "of", "discrete", "trajectories" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L35-L49
train
64,869
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
determine_lengths
def determine_lengths(dtrajs): r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ if (isinstance(dtrajs[0], (int))): return len(dtrajs) * np.ones((1)) lengths = np.zeros((len(dtrajs))) for i in ...
python
def determine_lengths(dtrajs): r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories """ if (isinstance(dtrajs[0], (int))): return len(dtrajs) * np.ones((1)) lengths = np.zeros((len(dtrajs))) for i in ...
[ "def", "determine_lengths", "(", "dtrajs", ")", ":", "if", "(", "isinstance", "(", "dtrajs", "[", "0", "]", ",", "(", "int", ")", ")", ")", ":", "return", "len", "(", "dtrajs", ")", "*", "np", ".", "ones", "(", "(", "1", ")", ")", "lengths", "=...
r""" Determines the lengths of all trajectories Parameters ---------- dtrajs : list of int-arrays discrete trajectories
[ "r", "Determines", "the", "lengths", "of", "all", "trajectories" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L52-L66
train
64,870
markovmodel/msmtools
msmtools/estimation/dense/bootstrapping.py
bootstrap_counts_singletraj
def bootstrap_counts_singletraj(dtraj, lagtime, n): """ Samples n counts at the given lagtime from the given trajectory """ # check if length is sufficient L = len(dtraj) if (lagtime > L): raise ValueError( 'Cannot sample counts with lagtime ' + str(lagtime) + ' from a trajec...
python
def bootstrap_counts_singletraj(dtraj, lagtime, n): """ Samples n counts at the given lagtime from the given trajectory """ # check if length is sufficient L = len(dtraj) if (lagtime > L): raise ValueError( 'Cannot sample counts with lagtime ' + str(lagtime) + ' from a trajec...
[ "def", "bootstrap_counts_singletraj", "(", "dtraj", ",", "lagtime", ",", "n", ")", ":", "# check if length is sufficient", "L", "=", "len", "(", "dtraj", ")", "if", "(", "lagtime", ">", "L", ")", ":", "raise", "ValueError", "(", "'Cannot sample counts with lagti...
Samples n counts at the given lagtime from the given trajectory
[ "Samples", "n", "counts", "at", "the", "given", "lagtime", "from", "the", "given", "trajectory" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/bootstrapping.py#L113-L127
train
64,871
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
connected_sets
def connected_sets(C, directed=True): r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether ...
python
def connected_sets(C, directed=True): r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether ...
[ "def", "connected_sets", "(", "C", ",", "directed", "=", "True", ")", ":", "M", "=", "C", ".", "shape", "[", "0", "]", "\"\"\" Compute connected components of C. nc is the number of\n components, indices contain the component labels of the states\n \"\"\"", "nc", ",", ...
r"""Compute connected components for a directed graph with weights represented by the given count matrix. Parameters ---------- C : scipy.sparse matrix or numpy ndarray square matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a dire...
[ "r", "Compute", "connected", "components", "for", "a", "directed", "graph", "with", "weights", "represented", "by", "the", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L32-L86
train
64,872
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
largest_connected_submatrix
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the l...
python
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the l...
[ "def", "largest_connected_submatrix", "(", "C", ",", "directed", "=", "True", ",", "lcc", "=", "None", ")", ":", "if", "lcc", "is", "None", ":", "lcc", "=", "largest_connected_set", "(", "C", ",", "directed", "=", "directed", ")", "\"\"\"Row slicing\"\"\"", ...
r"""Compute the count matrix of the largest connected set. The input count matrix is used as a weight matrix for the construction of a directed graph. The largest connected set of the constructed graph is computed. Vertices belonging to the largest connected component are used to generate a completely ...
[ "r", "Compute", "the", "count", "matrix", "of", "the", "largest", "connected", "set", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L107-L152
train
64,873
markovmodel/msmtools
msmtools/estimation/sparse/connectivity.py
is_connected
def is_connected(C, directed=True): r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : ...
python
def is_connected(C, directed=True): r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : ...
[ "def", "is_connected", "(", "C", ",", "directed", "=", "True", ")", ":", "nc", "=", "csgraph", ".", "connected_components", "(", "C", ",", "directed", "=", "directed", ",", "connection", "=", "'strong'", ",", "return_labels", "=", "False", ")", "return", ...
r"""Return true, if the input count matrix is completely connected. Effectively checking if the number of connected components equals one. Parameters ---------- C : scipy.sparse matrix or numpy ndarray Count matrix specifying edge weights. directed : bool, optional Whether to compute...
[ "r", "Return", "true", "if", "the", "input", "count", "matrix", "is", "completely", "connected", ".", "Effectively", "checking", "if", "the", "number", "of", "connected", "components", "equals", "one", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/connectivity.py#L155-L175
train
64,874
markovmodel/msmtools
msmtools/flux/api.py
coarsegrain
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Not...
python
def coarsegrain(F, sets): r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Not...
[ "def", "coarsegrain", "(", "F", ",", "sets", ")", ":", "if", "issparse", "(", "F", ")", ":", "return", "sparse", ".", "tpt", ".", "coarsegrain", "(", "F", ",", "sets", ")", "elif", "isdense", "(", "F", ")", ":", "return", "dense", ".", "tpt", "."...
r"""Coarse-grains the flux to the given sets. Parameters ---------- F : (n, n) ndarray or scipy.sparse matrix Matrix of flux values between pairs of states. sets : list of array-like of ints The sets of states onto which the flux is coarse-grained. Notes ----- The coarse gr...
[ "r", "Coarse", "-", "grains", "the", "flux", "to", "the", "given", "sets", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L334-L367
train
64,875
markovmodel/msmtools
msmtools/flux/api.py
total_flux
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer sta...
python
def total_flux(F, A=None): r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer sta...
[ "def", "total_flux", "(", "F", ",", "A", "=", "None", ")", ":", "if", "issparse", "(", "F", ")", ":", "return", "sparse", ".", "tpt", ".", "total_flux", "(", "F", ",", "A", "=", "A", ")", "elif", "isdense", "(", "F", ")", ":", "return", "dense"...
r"""Compute the total flux, or turnover flux, that is produced by the flux sources and consumed by the flux sinks. Parameters ---------- F : (M, M) ndarray Matrix of flux values between pairs of states. A : array_like (optional) List of integer state labels for set A (reactant) ...
[ "r", "Compute", "the", "total", "flux", "or", "turnover", "flux", "that", "is", "produced", "by", "the", "flux", "sources", "and", "consumed", "by", "the", "flux", "sinks", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L375-L404
train
64,876
markovmodel/msmtools
msmtools/flux/api.py
mfpt
def mfpt(totflux, pi, qminus): r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- ...
python
def mfpt(totflux, pi, qminus): r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- ...
[ "def", "mfpt", "(", "totflux", ",", "pi", ",", "qminus", ")", ":", "return", "dense", ".", "tpt", ".", "mfpt", "(", "totflux", ",", "pi", ",", "qminus", ")" ]
r"""Mean first passage time for reaction A to B. Parameters ---------- totflux : float The total flux between reactant and product pi : (M,) ndarray Stationary distribution qminus : (M,) ndarray Backward comittor Returns ------- tAB : float The mean firs...
[ "r", "Mean", "first", "passage", "time", "for", "reaction", "A", "to", "B", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L451-L484
train
64,877
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_pcca_connected_isa
def _pcca_connected_isa(evec, n_clusters): """ PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix w...
python
def _pcca_connected_isa(evec, n_clusters): """ PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix w...
[ "def", "_pcca_connected_isa", "(", "evec", ",", "n_clusters", ")", ":", "(", "n", ",", "m", ")", "=", "evec", ".", "shape", "# do we have enough eigenvectors?", "if", "n_clusters", ">", "m", ":", "raise", "ValueError", "(", "\"Cannot cluster the (\"", "+", "st...
PCCA+ spectral clustering method using the inner simplex algorithm. Clusters the first n_cluster eigenvectors of a transition matrix in order to cluster the states. This function assumes that the state space is fully connected, i.e. the transition matrix whose eigenvectors are used is supposed to have only...
[ "PCCA", "+", "spectral", "clustering", "method", "using", "the", "inner", "simplex", "algorithm", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L35-L128
train
64,878
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_opt_soft
def _opt_soft(eigvectors, rot_matrix, n_clusters): """ Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be f...
python
def _opt_soft(eigvectors, rot_matrix, n_clusters): """ Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be f...
[ "def", "_opt_soft", "(", "eigvectors", ",", "rot_matrix", ",", "n_clusters", ")", ":", "# only consider first n_clusters eigenvectors", "eigvectors", "=", "eigvectors", "[", ":", ",", ":", "n_clusters", "]", "# crop first row and first column from rot_matrix", "# rot_crop_m...
Optimizes the PCCA+ rotation matrix such that the memberships are exclusively nonnegative. Parameters ---------- eigenvectors : ndarray A matrix with the sorted eigenvectors in the columns. The stationary eigenvector should be first, then the one to the slowest relaxation process, etc. ...
[ "Optimizes", "the", "PCCA", "+", "rotation", "matrix", "such", "that", "the", "memberships", "are", "exclusively", "nonnegative", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L131-L192
train
64,879
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
_fill_matrix
def _fill_matrix(rot_crop_matrix, eigvectors): """ Helper function for opt_soft """ (x, y) = rot_crop_matrix.shape row_sums = np.sum(rot_crop_matrix, axis=1) row_sums = np.reshape(row_sums, (x, 1)) # add -row_sums as leftmost column to rot_crop_matrix rot_crop_matrix = np.concatenate...
python
def _fill_matrix(rot_crop_matrix, eigvectors): """ Helper function for opt_soft """ (x, y) = rot_crop_matrix.shape row_sums = np.sum(rot_crop_matrix, axis=1) row_sums = np.reshape(row_sums, (x, 1)) # add -row_sums as leftmost column to rot_crop_matrix rot_crop_matrix = np.concatenate...
[ "def", "_fill_matrix", "(", "rot_crop_matrix", ",", "eigvectors", ")", ":", "(", "x", ",", "y", ")", "=", "rot_crop_matrix", ".", "shape", "row_sums", "=", "np", ".", "sum", "(", "rot_crop_matrix", ",", "axis", "=", "1", ")", "row_sums", "=", "np", "."...
Helper function for opt_soft
[ "Helper", "function", "for", "opt_soft" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L194-L219
train
64,880
markovmodel/msmtools
msmtools/analysis/dense/pcca.py
coarsegrain
def coarsegrain(P, n): """ Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method fi...
python
def coarsegrain(P, n): """ Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method fi...
[ "def", "coarsegrain", "(", "P", ",", "n", ")", ":", "M", "=", "pcca", "(", "P", ",", "n", ")", "# coarse-grained transition matrix", "W", "=", "np", ".", "linalg", ".", "inv", "(", "np", ".", "dot", "(", "M", ".", "T", ",", "M", ")", ")", "A", ...
Coarse-grains transition matrix P to n sets using PCCA Coarse-grains transition matrix P such that the dominant eigenvalues are preserved, using: ..math: \tilde{P} = M^T P M (M^T M)^{-1} See [2]_ for the derivation of this form from the coarse-graining method first derived in [1]_. Reference...
[ "Coarse", "-", "grains", "transition", "matrix", "P", "to", "n", "sets", "using", "PCCA" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/pcca.py#L460-L492
train
64,881
markovmodel/msmtools
msmtools/analysis/api.py
is_transition_matrix
def is_transition_matrix(T, tol=1e-12): r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matr...
python
def is_transition_matrix(T, tol=1e-12): r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matr...
[ "def", "is_transition_matrix", "(", "T", ",", "tol", "=", "1e-12", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", ...
r"""Check if the given matrix is a transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_transition_matrix : bool True, if T is a valid tran...
[ "r", "Check", "if", "the", "given", "matrix", "is", "a", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L93-L133
train
64,882
markovmodel/msmtools
msmtools/analysis/api.py
is_rate_matrix
def is_rate_matrix(K, tol=1e-12): r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool ...
python
def is_rate_matrix(K, tol=1e-12): r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool ...
[ "def", "is_rate_matrix", "(", "K", ",", "tol", "=", "1e-12", ")", ":", "K", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "K", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "K",...
r"""Check if the given matrix is a rate matrix. Parameters ---------- K : (M, M) ndarray or scipy.sparse matrix Matrix to check tol : float (optional) Floating point tolerance to check with Returns ------- is_rate_matrix : bool True, if K is a valid rate matrix, Fal...
[ "r", "Check", "if", "the", "given", "matrix", "is", "a", "rate", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L136-L176
train
64,883
markovmodel/msmtools
msmtools/analysis/api.py
is_connected
def is_connected(T, directed=True): r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and ...
python
def is_connected(T, directed=True): r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and ...
[ "def", "is_connected", "(", "T", ",", "directed", "=", "True", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T...
r"""Check connectivity of the given matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Matrix to check directed : bool (optional) If True respect direction of transitions, if False do not distinguish between forward and backward transitions Returns --...
[ "r", "Check", "connectivity", "of", "the", "given", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L179-L241
train
64,884
markovmodel/msmtools
msmtools/analysis/api.py
is_reversible
def is_reversible(T, mu=None, tol=1e-12): r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional)...
python
def is_reversible(T, mu=None, tol=1e-12): r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional)...
[ "def", "is_reversible", "(", "T", ",", "mu", "=", "None", ",", "tol", "=", "1e-12", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'nume...
r"""Check reversibility of the given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix mu : (M,) ndarray (optional) Test reversibility with respect to this vector tol : float (optional) Floating point tolerance to check wit...
[ "r", "Check", "reversibility", "of", "the", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L244-L300
train
64,885
markovmodel/msmtools
msmtools/analysis/api.py
timescales
def timescales(T, tau=1, k=None, ncv=None, reversible=False, mu=None): r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the mic...
python
def timescales(T, tau=1, k=None, ncv=None, reversible=False, mu=None): r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the mic...
[ "def", "timescales", "(", "T", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=...
r"""Compute implied time scales of given transition matrix. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix tau : int (optional) The time-lag (in elementary time steps of the microstate trajectory) at which the given transition matrix was ...
[ "r", "Compute", "implied", "time", "scales", "of", "given", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L410-L466
train
64,886
markovmodel/msmtools
msmtools/analysis/api.py
committor
def committor(T, A, B, forward=True, mu=None): r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather ...
python
def committor(T, A, B, forward=True, mu=None): r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather ...
[ "def", "committor", "(", "T", ",", "A", ",", "B", ",", "forward", "=", "True", ",", "mu", "=", "None", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", ...
r"""Compute the committor between sets of microstates. The committor assigns to each microstate a probability that being at this state, the set B will be hit next, rather than set A (forward committor), or that the set A has been hit previously rather than set B (backward committor). See [1] for a ...
[ "r", "Compute", "the", "committor", "between", "sets", "of", "microstates", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L758-L885
train
64,887
markovmodel/msmtools
msmtools/analysis/api.py
expected_counts
def expected_counts(T, p0, N): r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns ...
python
def expected_counts(T, p0, N): r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns ...
[ "def", "expected_counts", "(", "T", ",", "p0", ",", "N", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "p0", "=", "_ty...
r"""Compute expected transition counts for Markov chain with n steps. Parameters ---------- T : (M, M) ndarray or sparse matrix Transition matrix p0 : (M,) ndarray Initial (probability) vector N : int Number of steps to take Returns -------- EC : (M, M) ndarray ...
[ "r", "Compute", "expected", "transition", "counts", "for", "Markov", "chain", "with", "n", "steps", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L892-L941
train
64,888
markovmodel/msmtools
msmtools/analysis/api.py
fingerprint_correlation
def fingerprint_correlation(T, obs1, obs2=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on stat...
python
def fingerprint_correlation(T, obs1, obs2=None, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on stat...
[ "def", "fingerprint_correlation", "(", "T", ",", "obs1", ",", "obs2", "=", "None", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_spars...
r"""Dynamical fingerprint for equilibrium correlation experiment. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observable, represented as vector on state space obs2 : (M,) ndarray (optional) Second observable, for cros...
[ "r", "Dynamical", "fingerprint", "for", "equilibrium", "correlation", "experiment", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1003-L1111
train
64,889
markovmodel/msmtools
msmtools/analysis/api.py
fingerprint_relaxation
def fingerprint_relaxation(T, p0, obs, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matri...
python
def fingerprint_relaxation(T, p0, obs, tau=1, k=None, ncv=None): r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matri...
[ "def", "fingerprint_relaxation", "(", "T", ",", "p0", ",", "obs", ",", "tau", "=", "1", ",", "k", "=", "None", ",", "ncv", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", "...
r"""Dynamical fingerprint for relaxation experiment. The dynamical fingerprint is given by the implied time-scale spectrum together with the corresponding amplitudes. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix obs1 : (M,) ndarray Observabl...
[ "r", "Dynamical", "fingerprint", "for", "relaxation", "experiment", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1114-L1204
train
64,890
markovmodel/msmtools
msmtools/analysis/api.py
expectation
def expectation(T, a, mu=None): r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. I...
python
def expectation(T, a, mu=None): r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. I...
[ "def", "expectation", "(", "T", ",", "a", ",", "mu", "=", "None", ")", ":", "# check if square matrix and remember size", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", ...
r"""Equilibrium expectation value of a given observable. Parameters ---------- T : (M, M) ndarray or scipy.sparse matrix Transition matrix a : (M,) ndarray Observable vector mu : (M,) ndarray (optional) The stationary distribution of T. If given, the stationary dist...
[ "r", "Equilibrium", "expectation", "value", "of", "a", "given", "observable", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1207-L1256
train
64,891
markovmodel/msmtools
msmtools/analysis/api.py
_pcca_object
def _pcca_object(T, m): """ Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object """ if _issparse(T...
python
def _pcca_object(T, m): """ Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object """ if _issparse(T...
[ "def", "_pcca_object", "(", "T", ",", "m", ")", ":", "if", "_issparse", "(", "T", ")", ":", "_showSparseConversionWarning", "(", ")", "T", "=", "T", ".", "toarray", "(", ")", "T", "=", "_types", ".", "ensure_ndarray", "(", "T", ",", "ndim", "=", "2...
Constructs the pcca object from dense or sparse Parameters ---------- T : (n, n) ndarray or scipy.sparse matrix Transition matrix m : int Number of metastable sets Returns ------- pcca : PCCA PCCA object
[ "Constructs", "the", "pcca", "object", "from", "dense", "or", "sparse" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1430-L1450
train
64,892
markovmodel/msmtools
msmtools/analysis/api.py
eigenvalue_sensitivity
def eigenvalue_sensitivity(T, k): r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th e...
python
def eigenvalue_sensitivity(T, k): r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th e...
[ "def", "eigenvalue_sensitivity", "(", "T", ",", "k", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T", ")", ":...
r"""Sensitivity matrix of a specified eigenvalue. Parameters ---------- T : (M, M) ndarray Transition matrix k : int Compute sensitivity matrix for k-th eigenvalue Returns ------- S : (M, M) ndarray Sensitivity matrix for k-th eigenvalue.
[ "r", "Sensitivity", "matrix", "of", "a", "specified", "eigenvalue", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1654-L1675
train
64,893
markovmodel/msmtools
msmtools/analysis/api.py
eigenvector_sensitivity
def eigenvector_sensitivity(T, k, j, right=True): r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True co...
python
def eigenvector_sensitivity(T, k, j, right=True): r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True co...
[ "def", "eigenvector_sensitivity", "(", "T", ",", "k", ",", "j", ",", "right", "=", "True", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")"...
r"""Sensitivity matrix of a selected eigenvector element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). k : int Eigenvector index j : int Element index right : bool If True compute for right eigenvector, otherwise compute for lef...
[ "r", "Sensitivity", "matrix", "of", "a", "selected", "eigenvector", "element", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1702-L1727
train
64,894
markovmodel/msmtools
msmtools/analysis/api.py
stationary_distribution_sensitivity
def stationary_distribution_sensitivity(T, j): r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is compute...
python
def stationary_distribution_sensitivity(T, j): r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is compute...
[ "def", "stationary_distribution_sensitivity", "(", "T", ",", "j", ")", ":", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "if", "_issparse", "(", "T"...
r"""Sensitivity matrix of a stationary distribution element. Parameters ---------- T : (M, M) ndarray Transition matrix (stochastic matrix). j : int Index of stationary distribution element for which sensitivity matrix is computed. Returns ------- S : (M, M) ndarray...
[ "r", "Sensitivity", "matrix", "of", "a", "stationary", "distribution", "element", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1731-L1755
train
64,895
markovmodel/msmtools
msmtools/analysis/api.py
mfpt_sensitivity
def mfpt_sensitivity(T, target, i): r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for st...
python
def mfpt_sensitivity(T, target, i): r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for st...
[ "def", "mfpt_sensitivity", "(", "T", ",", "target", ",", "i", ")", ":", "# check input", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "kind", "=", "'numeric'", ")", "target", "=...
r"""Sensitivity matrix of the mean first-passage time from specified state. Parameters ---------- T : (M, M) ndarray Transition matrix target : int or list Target state or set for mfpt computation i : int Compute the sensitivity for state `i` Returns ------- S :...
[ "r", "Sensitivity", "matrix", "of", "the", "mean", "first", "-", "passage", "time", "from", "specified", "state", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1758-L1784
train
64,896
markovmodel/msmtools
msmtools/analysis/api.py
committor_sensitivity
def committor_sensitivity(T, A, B, i, forward=True): r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for s...
python
def committor_sensitivity(T, A, B, i, forward=True): r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for s...
[ "def", "committor_sensitivity", "(", "T", ",", "A", ",", "B", ",", "i", ",", "forward", "=", "True", ")", ":", "# check inputs", "T", "=", "_types", ".", "ensure_ndarray_or_sparse", "(", "T", ",", "ndim", "=", "2", ",", "uniform", "=", "True", ",", "...
r"""Sensitivity matrix of a specified committor entry. Parameters ---------- T : (M, M) ndarray Transition matrix A : array_like List of integer state labels for set A B : array_like List of integer state labels for set B i : int Compute the sensitivity for comm...
[ "r", "Sensitivity", "matrix", "of", "a", "specified", "committor", "entry", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/api.py#L1787-L1822
train
64,897
markovmodel/msmtools
msmtools/estimation/dense/covariance.py
tmatrix_cov
def tmatrix_cov(C, row=None): r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function...
python
def tmatrix_cov(C, row=None): r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function...
[ "def", "tmatrix_cov", "(", "C", ",", "row", "=", "None", ")", ":", "if", "row", "is", "None", ":", "alpha", "=", "C", "+", "1.0", "# Dirichlet parameters", "alpha0", "=", "alpha", ".", "sum", "(", "axis", "=", "1", ")", "# Sum of paramters (per row)", ...
r"""Covariance tensor for the non-reversible transition matrix ensemble Normally the covariance tensor cov(p_ij, p_kl) would carry four indices (i,j,k,l). In the non-reversible case rows are independent so that cov(p_ij, p_kl)=0 for i not equal to k. Therefore the function will only return cov(p_ij, p_...
[ "r", "Covariance", "tensor", "for", "the", "non", "-", "reversible", "transition", "matrix", "ensemble" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/covariance.py#L31-L73
train
64,898
markovmodel/msmtools
msmtools/estimation/dense/covariance.py
dirichlet_covariance
def dirichlet_covariance(alpha): r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix """ alpha0 = alpha.sum() norm = alpha0 ** ...
python
def dirichlet_covariance(alpha): r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix """ alpha0 = alpha.sum() norm = alpha0 ** ...
[ "def", "dirichlet_covariance", "(", "alpha", ")", ":", "alpha0", "=", "alpha", ".", "sum", "(", ")", "norm", "=", "alpha0", "**", "2", "*", "(", "alpha0", "+", "1.0", ")", "\"\"\"Non normalized covariance\"\"\"", "Z", "=", "-", "alpha", "[", ":", ",", ...
r"""Covariance matrix for Dirichlet distribution. Parameters ---------- alpha : (M, ) ndarray Parameters of Dirichlet distribution Returns ------- cov : (M, M) ndarray Covariance matrix
[ "r", "Covariance", "matrix", "for", "Dirichlet", "distribution", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/dense/covariance.py#L76-L103
train
64,899