partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
tokenize
Convert a single string into a list of substrings split along punctuation and word boundaries. Keep whitespace intact by always attaching it to the previous token. Arguments: ---------- text : str normalize_ascii : bool, perform some replacements on non-ascii characters ...
ciseau/word_tokenizer.py
def tokenize(text, normalize_ascii=True): """ Convert a single string into a list of substrings split along punctuation and word boundaries. Keep whitespace intact by always attaching it to the previous token. Arguments: ---------- text : str normalize_ascii : bool, perform ...
def tokenize(text, normalize_ascii=True): """ Convert a single string into a list of substrings split along punctuation and word boundaries. Keep whitespace intact by always attaching it to the previous token. Arguments: ---------- text : str normalize_ascii : bool, perform ...
[ "Convert", "a", "single", "string", "into", "a", "list", "of", "substrings", "split", "along", "punctuation", "and", "word", "boundaries", ".", "Keep", "whitespace", "intact", "by", "always", "attaching", "it", "to", "the", "previous", "token", "." ]
JonathanRaiman/ciseau
python
https://github.com/JonathanRaiman/ciseau/blob/f72d1c82d85eeb3d3ac9fac17690041725402175/ciseau/word_tokenizer.py#L185-L260
[ "def", "tokenize", "(", "text", ",", "normalize_ascii", "=", "True", ")", ":", "# 1. If there's no punctuation, return immediately", "if", "no_punctuation", ".", "match", "(", "text", ")", ":", "return", "[", "text", "]", "# 2. let's standardize the input text to ascii ...
f72d1c82d85eeb3d3ac9fac17690041725402175
test
main
Main command line interface.
keyrings/cryptfile/convert.py
def main(argv=None): """Main command line interface.""" if argv is None: argv = sys.argv[1:] cli = CommandLineTool() try: return cli.run(argv) except KeyboardInterrupt: print('Canceled') return 3
def main(argv=None): """Main command line interface.""" if argv is None: argv = sys.argv[1:] cli = CommandLineTool() try: return cli.run(argv) except KeyboardInterrupt: print('Canceled') return 3
[ "Main", "command", "line", "interface", "." ]
frispete/keyrings.cryptfile
python
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/convert.py#L132-L142
[ "def", "main", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "cli", "=", "CommandLineTool", "(", ")", "try", ":", "return", "cli", ".", "run", "(", "argv", ")", "except...
cfa80d4848a5c3c0aeee41a954b2b120c80e69b2
test
ArgonAESEncryption._create_cipher
Create the cipher object to encrypt or decrypt a payload.
keyrings/cryptfile/cryptfile.py
def _create_cipher(self, password, salt, nonce = None): """ Create the cipher object to encrypt or decrypt a payload. """ from argon2.low_level import hash_secret_raw, Type from Crypto.Cipher import AES aesmode = self._get_mode(self.aesmode) if aesmode is None: ...
def _create_cipher(self, password, salt, nonce = None): """ Create the cipher object to encrypt or decrypt a payload. """ from argon2.low_level import hash_secret_raw, Type from Crypto.Cipher import AES aesmode = self._get_mode(self.aesmode) if aesmode is None: ...
[ "Create", "the", "cipher", "object", "to", "encrypt", "or", "decrypt", "a", "payload", "." ]
frispete/keyrings.cryptfile
python
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L38-L58
[ "def", "_create_cipher", "(", "self", ",", "password", ",", "salt", ",", "nonce", "=", "None", ")", ":", "from", "argon2", ".", "low_level", "import", "hash_secret_raw", ",", "Type", "from", "Crypto", ".", "Cipher", "import", "AES", "aesmode", "=", "self",...
cfa80d4848a5c3c0aeee41a954b2b120c80e69b2
test
ArgonAESEncryption._get_mode
Return the AES mode, or a list of valid AES modes, if mode == None
keyrings/cryptfile/cryptfile.py
def _get_mode(mode = None): """ Return the AES mode, or a list of valid AES modes, if mode == None """ from Crypto.Cipher import AES AESModeMap = { 'CCM': AES.MODE_CCM, 'EAX': AES.MODE_EAX, 'GCM': AES.MODE_GCM, 'OCB': AES.MODE_OCB,...
def _get_mode(mode = None): """ Return the AES mode, or a list of valid AES modes, if mode == None """ from Crypto.Cipher import AES AESModeMap = { 'CCM': AES.MODE_CCM, 'EAX': AES.MODE_EAX, 'GCM': AES.MODE_GCM, 'OCB': AES.MODE_OCB,...
[ "Return", "the", "AES", "mode", "or", "a", "list", "of", "valid", "AES", "modes", "if", "mode", "==", "None" ]
frispete/keyrings.cryptfile
python
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L61-L76
[ "def", "_get_mode", "(", "mode", "=", "None", ")", ":", "from", "Crypto", ".", "Cipher", "import", "AES", "AESModeMap", "=", "{", "'CCM'", ":", "AES", ".", "MODE_CCM", ",", "'EAX'", ":", "AES", ".", "MODE_EAX", ",", "'GCM'", ":", "AES", ".", "MODE_GC...
cfa80d4848a5c3c0aeee41a954b2b120c80e69b2
test
CryptFileKeyring.priority
Applicable for all platforms, where the schemes, that are integrated with your environment, does not fit.
keyrings/cryptfile/cryptfile.py
def priority(self): """ Applicable for all platforms, where the schemes, that are integrated with your environment, does not fit. """ try: __import__('argon2.low_level') except ImportError: # pragma: no cover raise RuntimeError("argon2_cffi pac...
def priority(self): """ Applicable for all platforms, where the schemes, that are integrated with your environment, does not fit. """ try: __import__('argon2.low_level') except ImportError: # pragma: no cover raise RuntimeError("argon2_cffi pac...
[ "Applicable", "for", "all", "platforms", "where", "the", "schemes", "that", "are", "integrated", "with", "your", "environment", "does", "not", "fit", "." ]
frispete/keyrings.cryptfile
python
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L90-L106
[ "def", "priority", "(", "self", ")", ":", "try", ":", "__import__", "(", "'argon2.low_level'", ")", "except", "ImportError", ":", "# pragma: no cover", "raise", "RuntimeError", "(", "\"argon2_cffi package required\"", ")", "try", ":", "__import__", "(", "'Crypto.Cip...
cfa80d4848a5c3c0aeee41a954b2b120c80e69b2
test
CryptFileKeyring._check_scheme
check for a valid scheme raise AttributeError if missing raise ValueError if not valid
keyrings/cryptfile/cryptfile.py
def _check_scheme(self, config): """ check for a valid scheme raise AttributeError if missing raise ValueError if not valid """ try: scheme = config.get( escape_for_ini('keyring-setting'), escape_for_ini('scheme'), ...
def _check_scheme(self, config): """ check for a valid scheme raise AttributeError if missing raise ValueError if not valid """ try: scheme = config.get( escape_for_ini('keyring-setting'), escape_for_ini('scheme'), ...
[ "check", "for", "a", "valid", "scheme" ]
frispete/keyrings.cryptfile
python
https://github.com/frispete/keyrings.cryptfile/blob/cfa80d4848a5c3c0aeee41a954b2b120c80e69b2/keyrings/cryptfile/cryptfile.py#L132-L162
[ "def", "_check_scheme", "(", "self", ",", "config", ")", ":", "try", ":", "scheme", "=", "config", ".", "get", "(", "escape_for_ini", "(", "'keyring-setting'", ")", ",", "escape_for_ini", "(", "'scheme'", ")", ",", ")", "except", "(", "configparser", ".", ...
cfa80d4848a5c3c0aeee41a954b2b120c80e69b2
test
startLogging
Starts the global Twisted logger subsystem with maybe stdout and/or a file specified in the config file
examples/subscriber.py
def startLogging(console=True, filepath=None): ''' Starts the global Twisted logger subsystem with maybe stdout and/or a file specified in the config file ''' global logLevelFilterPredicate observers = [] if console: observers.append( FilteringLogObserver(observer=textFileLogObse...
def startLogging(console=True, filepath=None): ''' Starts the global Twisted logger subsystem with maybe stdout and/or a file specified in the config file ''' global logLevelFilterPredicate observers = [] if console: observers.append( FilteringLogObserver(observer=textFileLogObse...
[ "Starts", "the", "global", "Twisted", "logger", "subsystem", "with", "maybe", "stdout", "and", "/", "or", "a", "file", "specified", "in", "the", "config", "file" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L27-L42
[ "def", "startLogging", "(", "console", "=", "True", ",", "filepath", "=", "None", ")", ":", "global", "logLevelFilterPredicate", "observers", "=", "[", "]", "if", "console", ":", "observers", ".", "append", "(", "FilteringLogObserver", "(", "observer", "=", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
setLogLevel
Set a new log level for a given namespace LevelStr is: 'critical', 'error', 'warn', 'info', 'debug'
examples/subscriber.py
def setLogLevel(namespace=None, levelStr='info'): ''' Set a new log level for a given namespace LevelStr is: 'critical', 'error', 'warn', 'info', 'debug' ''' level = LogLevel.levelWithName(levelStr) logLevelFilterPredicate.setLogLevelForNamespace(namespace=namespace, level=level)
def setLogLevel(namespace=None, levelStr='info'): ''' Set a new log level for a given namespace LevelStr is: 'critical', 'error', 'warn', 'info', 'debug' ''' level = LogLevel.levelWithName(levelStr) logLevelFilterPredicate.setLogLevelForNamespace(namespace=namespace, level=level)
[ "Set", "a", "new", "log", "level", "for", "a", "given", "namespace", "LevelStr", "is", ":", "critical", "error", "warn", "info", "debug" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L45-L51
[ "def", "setLogLevel", "(", "namespace", "=", "None", ",", "levelStr", "=", "'info'", ")", ":", "level", "=", "LogLevel", ".", "levelWithName", "(", "levelStr", ")", "logLevelFilterPredicate", ".", "setLogLevelForNamespace", "(", "namespace", "=", "namespace", ",...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
MQTTService.connectToBroker
Connect to MQTT broker
examples/subscriber.py
def connectToBroker(self, protocol): ''' Connect to MQTT broker ''' self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) try: ...
def connectToBroker(self, protocol): ''' Connect to MQTT broker ''' self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) try: ...
[ "Connect", "to", "MQTT", "broker" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L72-L87
[ "def", "connectToBroker", "(", "self", ",", "protocol", ")", ":", "self", ".", "protocol", "=", "protocol", "self", ".", "protocol", ".", "onPublish", "=", "self", ".", "onPublish", "self", ".", "protocol", ".", "onDisconnection", "=", "self", ".", "onDisc...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
MQTTService.onPublish
Callback Receiving messages from publisher
examples/subscriber.py
def onPublish(self, topic, payload, qos, dup, retain, msgId): ''' Callback Receiving messages from publisher ''' log.debug("msg={payload}", payload=payload)
def onPublish(self, topic, payload, qos, dup, retain, msgId): ''' Callback Receiving messages from publisher ''' log.debug("msg={payload}", payload=payload)
[ "Callback", "Receiving", "messages", "from", "publisher" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L117-L121
[ "def", "onPublish", "(", "self", ",", "topic", ",", "payload", ",", "qos", ",", "dup", ",", "retain", ",", "msgId", ")", ":", "log", ".", "debug", "(", "\"msg={payload}\"", ",", "payload", "=", "payload", ")" ]
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
MQTTService.onDisconnection
get notfied of disconnections and get a deferred for a new protocol object (next retry)
examples/subscriber.py
def onDisconnection(self, reason): ''' get notfied of disconnections and get a deferred for a new protocol object (next retry) ''' log.debug("<Connection was lost !> <reason={r}>", r=reason) self.whenConnected().addCallback(self.connectToBroker)
def onDisconnection(self, reason): ''' get notfied of disconnections and get a deferred for a new protocol object (next retry) ''' log.debug("<Connection was lost !> <reason={r}>", r=reason) self.whenConnected().addCallback(self.connectToBroker)
[ "get", "notfied", "of", "disconnections", "and", "get", "a", "deferred", "for", "a", "new", "protocol", "object", "(", "next", "retry", ")" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/subscriber.py#L124-L130
[ "def", "onDisconnection", "(", "self", ",", "reason", ")", ":", "log", ".", "debug", "(", "\"<Connection was lost !> <reason={r}>\"", ",", "r", "=", "reason", ")", "self", ".", "whenConnected", "(", ")", ".", "addCallback", "(", "self", ".", "connectToBroker",...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
MQTTService.connectToBroker
Connect to MQTT broker
examples/pubsubs.py
def connectToBroker(self, protocol): ''' Connect to MQTT broker ''' self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) self.task = task...
def connectToBroker(self, protocol): ''' Connect to MQTT broker ''' self.protocol = protocol self.protocol.onPublish = self.onPublish self.protocol.onDisconnection = self.onDisconnection self.protocol.setWindowSize(3) self.task = task...
[ "Connect", "to", "MQTT", "broker" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/examples/pubsubs.py#L72-L89
[ "def", "connectToBroker", "(", "self", ",", "protocol", ")", ":", "self", ".", "protocol", "=", "protocol", "self", ".", "protocol", ".", "onPublish", "=", "self", ".", "onPublish", "self", ".", "protocol", ".", "onDisconnection", "=", "self", ".", "onDisc...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
MQTTFactory.makeId
Produce ids for Protocol packets, outliving their sessions
mqtt/client/factory.py
def makeId(self): '''Produce ids for Protocol packets, outliving their sessions''' self.id = (self.id + 1) % 65536 self.id = self.id or 1 # avoid id 0 return self.id
def makeId(self): '''Produce ids for Protocol packets, outliving their sessions''' self.id = (self.id + 1) % 65536 self.id = self.id or 1 # avoid id 0 return self.id
[ "Produce", "ids", "for", "Protocol", "packets", "outliving", "their", "sessions" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/factory.py#L116-L120
[ "def", "makeId", "(", "self", ")", ":", "self", ".", "id", "=", "(", "self", ".", "id", "+", "1", ")", "%", "65536", "self", ".", "id", "=", "self", ".", "id", "or", "1", "# avoid id 0", "return", "self", ".", "id" ]
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
BaseState.connect
Send a CONNECT control packet.
mqtt/client/base.py
def connect(self, request): ''' Send a CONNECT control packet. ''' state = self.__class__.__name__ return defer.fail(MQTTStateError("Unexpected connect() operation", state))
def connect(self, request): ''' Send a CONNECT control packet. ''' state = self.__class__.__name__ return defer.fail(MQTTStateError("Unexpected connect() operation", state))
[ "Send", "a", "CONNECT", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/base.py#L100-L105
[ "def", "connect", "(", "self", ",", "request", ")", ":", "state", "=", "self", ".", "__class__", ".", "__name__", "return", "defer", ".", "fail", "(", "MQTTStateError", "(", "\"Unexpected connect() operation\"", ",", "state", ")", ")" ]
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
BaseState.handleCONNACK
Handles CONNACK packet from the server
mqtt/client/base.py
def handleCONNACK(self, response): ''' Handles CONNACK packet from the server ''' state = self.__class__.__name__ log.error("Unexpected {packet:7} packet received in {log_source}", packet="CONNACK")
def handleCONNACK(self, response): ''' Handles CONNACK packet from the server ''' state = self.__class__.__name__ log.error("Unexpected {packet:7} packet received in {log_source}", packet="CONNACK")
[ "Handles", "CONNACK", "packet", "from", "the", "server" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/base.py#L138-L143
[ "def", "handleCONNACK", "(", "self", ",", "response", ")", ":", "state", "=", "self", ".", "__class__", ".", "__name__", "log", ".", "error", "(", "\"Unexpected {packet:7} packet received in {log_source}\"", ",", "packet", "=", "\"CONNACK\"", ")" ]
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
IMQTTClientControl.connect
Abstract ======== Send a CONNECT control packet. Description =========== After a Network Connection is established by a Client to a Server, the first Packet sent from the Client to the Server MUST be a CONNECT Packet [MQTT-3.1.0-1]. A Client can only...
mqtt/client/interfaces.py
def connect(clientId, keepalive=0, willTopic=None, willMessage=None, willQoS=0, willRetain=False, username=None, password=None, cleanStart=True, version=mqtt.v311): ''' Abstract ======== Send a CONNECT control packet. Description =======...
def connect(clientId, keepalive=0, willTopic=None, willMessage=None, willQoS=0, willRetain=False, username=None, password=None, cleanStart=True, version=mqtt.v311): ''' Abstract ======== Send a CONNECT control packet. Description =======...
[ "Abstract", "========" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/client/interfaces.py#L44-L84
[ "def", "connect", "(", "clientId", ",", "keepalive", "=", "0", ",", "willTopic", "=", "None", ",", "willMessage", "=", "None", ",", "willQoS", "=", "0", ",", "willRetain", "=", "False", ",", "username", "=", "None", ",", "password", "=", "None", ",", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
encodeString
Encode an UTF-8 string into MQTT format. Returns a bytearray
mqtt/pdu.py
def encodeString(string): ''' Encode an UTF-8 string into MQTT format. Returns a bytearray ''' encoded = bytearray(2) encoded.extend(bytearray(string, encoding='utf-8')) l = len(encoded)-2 if(l > 65535): raise StringValueError(l) encoded[0] = l >> 8 encoded[1] = l & 0xFF...
def encodeString(string): ''' Encode an UTF-8 string into MQTT format. Returns a bytearray ''' encoded = bytearray(2) encoded.extend(bytearray(string, encoding='utf-8')) l = len(encoded)-2 if(l > 65535): raise StringValueError(l) encoded[0] = l >> 8 encoded[1] = l & 0xFF...
[ "Encode", "an", "UTF", "-", "8", "string", "into", "MQTT", "format", ".", "Returns", "a", "bytearray" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L51-L63
[ "def", "encodeString", "(", "string", ")", ":", "encoded", "=", "bytearray", "(", "2", ")", "encoded", ".", "extend", "(", "bytearray", "(", "string", ",", "encoding", "=", "'utf-8'", ")", ")", "l", "=", "len", "(", "encoded", ")", "-", "2", "if", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
decodeString
Decodes an UTF-8 string from an encoded MQTT bytearray. Returns the decoded string and renaining bytearray to be parsed
mqtt/pdu.py
def decodeString(encoded): ''' Decodes an UTF-8 string from an encoded MQTT bytearray. Returns the decoded string and renaining bytearray to be parsed ''' length = encoded[0]*256 + encoded[1] return (encoded[2:2+length].decode('utf-8'), encoded[2+length:])
def decodeString(encoded): ''' Decodes an UTF-8 string from an encoded MQTT bytearray. Returns the decoded string and renaining bytearray to be parsed ''' length = encoded[0]*256 + encoded[1] return (encoded[2:2+length].decode('utf-8'), encoded[2+length:])
[ "Decodes", "an", "UTF", "-", "8", "string", "from", "an", "encoded", "MQTT", "bytearray", ".", "Returns", "the", "decoded", "string", "and", "renaining", "bytearray", "to", "be", "parsed" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L65-L71
[ "def", "decodeString", "(", "encoded", ")", ":", "length", "=", "encoded", "[", "0", "]", "*", "256", "+", "encoded", "[", "1", "]", "return", "(", "encoded", "[", "2", ":", "2", "+", "length", "]", ".", "decode", "(", "'utf-8'", ")", ",", "encod...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
encode16Int
Encodes a 16 bit unsigned integer into MQTT format. Returns a bytearray
mqtt/pdu.py
def encode16Int(value): ''' Encodes a 16 bit unsigned integer into MQTT format. Returns a bytearray ''' value = int(value) encoded = bytearray(2) encoded[0] = value >> 8 encoded[1] = value & 0xFF return encoded
def encode16Int(value): ''' Encodes a 16 bit unsigned integer into MQTT format. Returns a bytearray ''' value = int(value) encoded = bytearray(2) encoded[0] = value >> 8 encoded[1] = value & 0xFF return encoded
[ "Encodes", "a", "16", "bit", "unsigned", "integer", "into", "MQTT", "format", ".", "Returns", "a", "bytearray" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L74-L83
[ "def", "encode16Int", "(", "value", ")", ":", "value", "=", "int", "(", "value", ")", "encoded", "=", "bytearray", "(", "2", ")", "encoded", "[", "0", "]", "=", "value", ">>", "8", "encoded", "[", "1", "]", "=", "value", "&", "0xFF", "return", "e...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
encodeLength
Encodes value into a multibyte sequence defined by MQTT protocol. Used to encode packet length fields.
mqtt/pdu.py
def encodeLength(value): ''' Encodes value into a multibyte sequence defined by MQTT protocol. Used to encode packet length fields. ''' encoded = bytearray() while True: digit = value % 128 value //= 128 if value > 0: digit |= 128 encoded.append(digit)...
def encodeLength(value): ''' Encodes value into a multibyte sequence defined by MQTT protocol. Used to encode packet length fields. ''' encoded = bytearray() while True: digit = value % 128 value //= 128 if value > 0: digit |= 128 encoded.append(digit)...
[ "Encodes", "value", "into", "a", "multibyte", "sequence", "defined", "by", "MQTT", "protocol", ".", "Used", "to", "encode", "packet", "length", "fields", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L92-L106
[ "def", "encodeLength", "(", "value", ")", ":", "encoded", "=", "bytearray", "(", ")", "while", "True", ":", "digit", "=", "value", "%", "128", "value", "//=", "128", "if", "value", ">", "0", ":", "digit", "|=", "128", "encoded", ".", "append", "(", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
decodeLength
Decodes a variable length value defined in the MQTT protocol. This value typically represents remaining field lengths
mqtt/pdu.py
def decodeLength(encoded): ''' Decodes a variable length value defined in the MQTT protocol. This value typically represents remaining field lengths ''' value = 0 multiplier = 1 for i in encoded: value += (i & 0x7F) * multiplier multiplier *= 0x80 if (i & 0x80) !...
def decodeLength(encoded): ''' Decodes a variable length value defined in the MQTT protocol. This value typically represents remaining field lengths ''' value = 0 multiplier = 1 for i in encoded: value += (i & 0x7F) * multiplier multiplier *= 0x80 if (i & 0x80) !...
[ "Decodes", "a", "variable", "length", "value", "defined", "in", "the", "MQTT", "protocol", ".", "This", "value", "typically", "represents", "remaining", "field", "lengths" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L109-L121
[ "def", "decodeLength", "(", "encoded", ")", ":", "value", "=", "0", "multiplier", "=", "1", "for", "i", "in", "encoded", ":", "value", "+=", "(", "i", "&", "0x7F", ")", "*", "multiplier", "multiplier", "*=", "0x80", "if", "(", "i", "&", "0x80", ")"...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
DISCONNECT.encode
Encode and store a DISCONNECT control packet.
mqtt/pdu.py
def encode(self): ''' Encode and store a DISCONNECT control packet. ''' header = bytearray(2) header[0] = 0xE0 self.encoded = header return str(header) if PY2 else bytes(header)
def encode(self): ''' Encode and store a DISCONNECT control packet. ''' header = bytearray(2) header[0] = 0xE0 self.encoded = header return str(header) if PY2 else bytes(header)
[ "Encode", "and", "store", "a", "DISCONNECT", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L133-L140
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "2", ")", "header", "[", "0", "]", "=", "0xE0", "self", ".", "encoded", "=", "header", "return", "str", "(", "header", ")", "if", "PY2", "else", "bytes", "(", "header", ")" ]
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
CONNECT.encode
Encode and store a CONNECT control packet. @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded username string exceeds 65535 bytes.
mqtt/pdu.py
def encode(self): ''' Encode and store a CONNECT control packet. @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded username string exceeds 65535 bytes. ''' header = bytearray(1) varHeader = bytearray() ...
def encode(self): ''' Encode and store a CONNECT control packet. @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded username string exceeds 65535 bytes. ''' header = bytearray(1) varHeader = bytearray() ...
[ "Encode", "and", "store", "a", "CONNECT", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L211-L249
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "varHeader", "=", "bytearray", "(", ")", "payload", "=", "bytearray", "(", ")", "header", "[", "0", "]", "=", "0x10", "# packet code", "# ---- Variable header encoding section...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
CONNECT.decode
Decode a CONNECT control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a CONNECT control packet. ''' self.encoded = packet # Strip the fixed header plus variable length field lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] # Var...
def decode(self, packet): ''' Decode a CONNECT control packet. ''' self.encoded = packet # Strip the fixed header plus variable length field lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] # Var...
[ "Decode", "a", "CONNECT", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L251-L289
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "# Strip the fixed header plus variable length field", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remai...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
CONNACK.encode
Encode and store a CONNACK control packet.
mqtt/pdu.py
def encode(self): ''' Encode and store a CONNACK control packet. ''' header = bytearray(1) varHeader = bytearray(2) header[0] = 0x20 varHeader[0] = self.session varHeader[1] = self.resultCode header.extend(encodeLength(len(varHe...
def encode(self): ''' Encode and store a CONNACK control packet. ''' header = bytearray(1) varHeader = bytearray(2) header[0] = 0x20 varHeader[0] = self.session varHeader[1] = self.resultCode header.extend(encodeLength(len(varHe...
[ "Encode", "and", "store", "a", "CONNACK", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L302-L315
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "varHeader", "=", "bytearray", "(", "2", ")", "header", "[", "0", "]", "=", "0x20", "varHeader", "[", "0", "]", "=", "self", ".", "session", "varHeader", "[", "1", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
CONNACK.decode
Decode a CONNACK control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a CONNACK control packet. ''' self.encoded = packet # Strip the fixed header plus variable length field lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self....
def decode(self, packet): ''' Decode a CONNACK control packet. ''' self.encoded = packet # Strip the fixed header plus variable length field lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self....
[ "Decode", "a", "CONNACK", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L317-L328
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "# Strip the fixed header plus variable length field", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remai...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
SUBSCRIBE.decode
Decode a SUBSCRIBE control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a SUBSCRIBE control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining[0:2]) self....
def decode(self, packet): ''' Decode a SUBSCRIBE control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining[0:2]) self....
[ "Decode", "a", "SUBSCRIBE", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L357-L373
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remaining", "=", "packet", "[", "lenLen", "+", "1"...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
SUBACK.encode
Encode and store a SUBACK control packet.
mqtt/pdu.py
def encode(self): ''' Encode and store a SUBACK control packet. ''' header = bytearray(1) payload = bytearray() varHeader = encode16Int(self.msgId) header[0] = 0x90 for code in self.granted: payload.append(code[0] | (0x80 if code[1] == Tru...
def encode(self): ''' Encode and store a SUBACK control packet. ''' header = bytearray(1) payload = bytearray() varHeader = encode16Int(self.msgId) header[0] = 0x90 for code in self.granted: payload.append(code[0] | (0x80 if code[1] == Tru...
[ "Encode", "and", "store", "a", "SUBACK", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L387-L401
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "payload", "=", "bytearray", "(", ")", "varHeader", "=", "encode16Int", "(", "self", ".", "msgId", ")", "header", "[", "0", "]", "=", "0x90", "for", "code", "in", "s...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
UNSUBSCRIBE.encode
Encode and store an UNSUBCRIBE control packet @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes
mqtt/pdu.py
def encode(self): ''' Encode and store an UNSUBCRIBE control packet @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes ''' header = bytearray(1) payload = bytearray() varHeader = encode16Int(self.msgId) header[0] = 0xA2 # packe...
def encode(self): ''' Encode and store an UNSUBCRIBE control packet @raise e: C{ValueError} if any encoded topic string exceeds 65535 bytes ''' header = bytearray(1) payload = bytearray() varHeader = encode16Int(self.msgId) header[0] = 0xA2 # packe...
[ "Encode", "and", "store", "an", "UNSUBCRIBE", "control", "packet" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L430-L445
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "payload", "=", "bytearray", "(", ")", "varHeader", "=", "encode16Int", "(", "self", ".", "msgId", ")", "header", "[", "0", "]", "=", "0xA2", "# packet with QoS=1", "for...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
UNSUBSCRIBE.decode
Decode a UNSUBACK control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a UNSUBACK control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining[0:2]) self.t...
def decode(self, packet): ''' Decode a UNSUBACK control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining[0:2]) self.t...
[ "Decode", "a", "UNSUBACK", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L447-L463
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remaining", "=", "packet", "[", "lenLen", "+", "1"...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
UNSUBACK.encode
Encode and store an UNSUBACK control packet
mqtt/pdu.py
def encode(self): ''' Encode and store an UNSUBACK control packet ''' header = bytearray(1) varHeader = encode16Int(self.msgId) header[0] = 0xB0 header.extend(encodeLength(len(varHeader))) header.extend(varHeader) self.encoded = header ...
def encode(self): ''' Encode and store an UNSUBACK control packet ''' header = bytearray(1) varHeader = encode16Int(self.msgId) header[0] = 0xB0 header.extend(encodeLength(len(varHeader))) header.extend(varHeader) self.encoded = header ...
[ "Encode", "and", "store", "an", "UNSUBACK", "control", "packet" ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L474-L484
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "varHeader", "=", "encode16Int", "(", "self", ".", "msgId", ")", "header", "[", "0", "]", "=", "0xB0", "header", ".", "extend", "(", "encodeLength", "(", "len", "(", ...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
PUBLISH.encode
Encode and store a PUBLISH control packet. @raise e: C{ValueError} if encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded packet size exceeds 268435455 bytes. @raise e: C{TypeError} if C{data} is not a string, bytearray, int, boolean or float.
mqtt/pdu.py
def encode(self): ''' Encode and store a PUBLISH control packet. @raise e: C{ValueError} if encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded packet size exceeds 268435455 bytes. @raise e: C{TypeError} if C{data} is not a string, bytearray, int, boolean...
def encode(self): ''' Encode and store a PUBLISH control packet. @raise e: C{ValueError} if encoded topic string exceeds 65535 bytes. @raise e: C{ValueError} if encoded packet size exceeds 268435455 bytes. @raise e: C{TypeError} if C{data} is not a string, bytearray, int, boolean...
[ "Encode", "and", "store", "a", "PUBLISH", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L511-L542
[ "def", "encode", "(", "self", ")", ":", "header", "=", "bytearray", "(", "1", ")", "varHeader", "=", "bytearray", "(", ")", "payload", "=", "bytearray", "(", ")", "if", "self", ".", "qos", ":", "header", "[", "0", "]", "=", "0x30", "|", "self", "...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
PUBLISH.decode
Decode a PUBLISH control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a PUBLISH control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.dup = (packet[0] & 0x08) == 0x08 self.qos = (p...
def decode(self, packet): ''' Decode a PUBLISH control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.dup = (packet[0] & 0x08) == 0x08 self.qos = (p...
[ "Decode", "a", "PUBLISH", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L544-L563
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remaining", "=", "packet", "[", "lenLen", "+", "1"...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
PUBREL.decode
Decode a PUBREL control packet.
mqtt/pdu.py
def decode(self, packet): ''' Decode a PUBREL control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining) self.dup = (pa...
def decode(self, packet): ''' Decode a PUBREL control packet. ''' self.encoded = packet lenLen = 1 while packet[lenLen] & 0x80: lenLen += 1 packet_remaining = packet[lenLen+1:] self.msgId = decode16Int(packet_remaining) self.dup = (pa...
[ "Decode", "a", "PUBREL", "control", "packet", "." ]
astrorafael/twisted-mqtt
python
https://github.com/astrorafael/twisted-mqtt/blob/5b322f7c2b82a502b1e1b70703ae45f1f668d07d/mqtt/pdu.py#L651-L661
[ "def", "decode", "(", "self", ",", "packet", ")", ":", "self", ".", "encoded", "=", "packet", "lenLen", "=", "1", "while", "packet", "[", "lenLen", "]", "&", "0x80", ":", "lenLen", "+=", "1", "packet_remaining", "=", "packet", "[", "lenLen", "+", "1"...
5b322f7c2b82a502b1e1b70703ae45f1f668d07d
test
API.get_url
Return url for call method. :param method (optional): `str` method name. :returns: `str` URL.
vklancer/api.py
def get_url(self, method=None, **kwargs): """Return url for call method. :param method (optional): `str` method name. :returns: `str` URL. """ kwargs.setdefault('v', self.__version) if self.__token is not None: kwargs.setdefault('access_token', self.__token)...
def get_url(self, method=None, **kwargs): """Return url for call method. :param method (optional): `str` method name. :returns: `str` URL. """ kwargs.setdefault('v', self.__version) if self.__token is not None: kwargs.setdefault('access_token', self.__token)...
[ "Return", "url", "for", "call", "method", "." ]
bindlock/vklancer
python
https://github.com/bindlock/vklancer/blob/10151c3856bc6f46a1f446ae4d605d46aace3669/vklancer/api.py#L26-L39
[ "def", "get_url", "(", "self", ",", "method", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'v'", ",", "self", ".", "__version", ")", "if", "self", ".", "__token", "is", "not", "None", ":", "kwargs", ".", "setde...
10151c3856bc6f46a1f446ae4d605d46aace3669
test
API.request
Send request to API. :param method: `str` method name. :returns: `dict` response.
vklancer/api.py
def request(self, method, **kwargs): """ Send request to API. :param method: `str` method name. :returns: `dict` response. """ kwargs.setdefault('v', self.__version) if self.__token is not None: kwargs.setdefault('access_token', self.__token) ...
def request(self, method, **kwargs): """ Send request to API. :param method: `str` method name. :returns: `dict` response. """ kwargs.setdefault('v', self.__version) if self.__token is not None: kwargs.setdefault('access_token', self.__token) ...
[ "Send", "request", "to", "API", "." ]
bindlock/vklancer
python
https://github.com/bindlock/vklancer/blob/10151c3856bc6f46a1f446ae4d605d46aace3669/vklancer/api.py#L41-L53
[ "def", "request", "(", "self", ",", "method", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'v'", ",", "self", ".", "__version", ")", "if", "self", ".", "__token", "is", "not", "None", ":", "kwargs", ".", "setdefault", "(", ...
10151c3856bc6f46a1f446ae4d605d46aace3669
test
authentication
Authentication on vk.com. :param login: login on vk.com. :param password: password on vk.com. :returns: `requests.Session` session with cookies.
vklancer/utils.py
def authentication(login, password): """ Authentication on vk.com. :param login: login on vk.com. :param password: password on vk.com. :returns: `requests.Session` session with cookies. """ session = requests.Session() response = session.get('https://m.vk.com') url = re.search(r'act...
def authentication(login, password): """ Authentication on vk.com. :param login: login on vk.com. :param password: password on vk.com. :returns: `requests.Session` session with cookies. """ session = requests.Session() response = session.get('https://m.vk.com') url = re.search(r'act...
[ "Authentication", "on", "vk", ".", "com", "." ]
bindlock/vklancer
python
https://github.com/bindlock/vklancer/blob/10151c3856bc6f46a1f446ae4d605d46aace3669/vklancer/utils.py#L8-L21
[ "def", "authentication", "(", "login", ",", "password", ")", ":", "session", "=", "requests", ".", "Session", "(", ")", "response", "=", "session", ".", "get", "(", "'https://m.vk.com'", ")", "url", "=", "re", ".", "search", "(", "r'action=\"([^\\\"]+)\"'", ...
10151c3856bc6f46a1f446ae4d605d46aace3669
test
oauth
OAuth on vk.com. :param login: login on vk.com. :param password: password on vk.com. :param app_id: vk.com application id (default: 4729418). :param scope: allowed actions (default: 2097151 (all)). :returns: OAuth2 access token or None.
vklancer/utils.py
def oauth(login, password, app_id=4729418, scope=2097151): """ OAuth on vk.com. :param login: login on vk.com. :param password: password on vk.com. :param app_id: vk.com application id (default: 4729418). :param scope: allowed actions (default: 2097151 (all)). :returns: OAuth2 access token ...
def oauth(login, password, app_id=4729418, scope=2097151): """ OAuth on vk.com. :param login: login on vk.com. :param password: password on vk.com. :param app_id: vk.com application id (default: 4729418). :param scope: allowed actions (default: 2097151 (all)). :returns: OAuth2 access token ...
[ "OAuth", "on", "vk", ".", "com", "." ]
bindlock/vklancer
python
https://github.com/bindlock/vklancer/blob/10151c3856bc6f46a1f446ae4d605d46aace3669/vklancer/utils.py#L24-L50
[ "def", "oauth", "(", "login", ",", "password", ",", "app_id", "=", "4729418", ",", "scope", "=", "2097151", ")", ":", "session", "=", "authentication", "(", "login", ",", "password", ")", "data", "=", "{", "'response_type'", ":", "'token'", ",", "'client...
10151c3856bc6f46a1f446ae4d605d46aace3669
test
File.create_from_array
create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall have a scalar dtype. blockname : string name of the block Nfil...
bigfile/__init__.py
def create_from_array(self, blockname, array, Nfile=None, memorylimit=1024 * 1024 * 256): """ create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall h...
def create_from_array(self, blockname, array, Nfile=None, memorylimit=1024 * 1024 * 256): """ create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall h...
[ "create", "a", "block", "from", "array", "like", "objects", "The", "operation", "is", "well", "defined", "only", "if", "array", "is", "at", "most", "2d", "." ]
rainwoodman/bigfile
python
https://github.com/rainwoodman/bigfile/blob/1a2d05977fc8edebd8ddf9e81fdb97648596266d/bigfile/__init__.py#L96-L135
[ "def", "create_from_array", "(", "self", ",", "blockname", ",", "array", ",", "Nfile", "=", "None", ",", "memorylimit", "=", "1024", "*", "1024", "*", "256", ")", ":", "size", "=", "len", "(", "array", ")", "# sane value -- 32 million items per physical file",...
1a2d05977fc8edebd8ddf9e81fdb97648596266d
test
FileMPI.refresh
Refresh the list of blocks to the disk, collectively
bigfile/__init__.py
def refresh(self): """ Refresh the list of blocks to the disk, collectively """ if self.comm.rank == 0: self._blocks = self.list_blocks() else: self._blocks = None self._blocks = self.comm.bcast(self._blocks)
def refresh(self): """ Refresh the list of blocks to the disk, collectively """ if self.comm.rank == 0: self._blocks = self.list_blocks() else: self._blocks = None self._blocks = self.comm.bcast(self._blocks)
[ "Refresh", "the", "list", "of", "blocks", "to", "the", "disk", "collectively" ]
rainwoodman/bigfile
python
https://github.com/rainwoodman/bigfile/blob/1a2d05977fc8edebd8ddf9e81fdb97648596266d/bigfile/__init__.py#L199-L205
[ "def", "refresh", "(", "self", ")", ":", "if", "self", ".", "comm", ".", "rank", "==", "0", ":", "self", ".", "_blocks", "=", "self", ".", "list_blocks", "(", ")", "else", ":", "self", ".", "_blocks", "=", "None", "self", ".", "_blocks", "=", "se...
1a2d05977fc8edebd8ddf9e81fdb97648596266d
test
FileMPI.create_from_array
create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall have a scalar dtype. blockname : string name of the block Nfil...
bigfile/__init__.py
def create_from_array(self, blockname, array, Nfile=None, memorylimit=1024 * 1024 * 256): """ create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall h...
def create_from_array(self, blockname, array, Nfile=None, memorylimit=1024 * 1024 * 256): """ create a block from array like objects The operation is well defined only if array is at most 2d. Parameters ---------- array : array_like, array shall h...
[ "create", "a", "block", "from", "array", "like", "objects", "The", "operation", "is", "well", "defined", "only", "if", "array", "is", "at", "most", "2d", "." ]
rainwoodman/bigfile
python
https://github.com/rainwoodman/bigfile/blob/1a2d05977fc8edebd8ddf9e81fdb97648596266d/bigfile/__init__.py#L221-L261
[ "def", "create_from_array", "(", "self", ",", "blockname", ",", "array", ",", "Nfile", "=", "None", ",", "memorylimit", "=", "1024", "*", "1024", "*", "256", ")", ":", "size", "=", "self", ".", "comm", ".", "allreduce", "(", "len", "(", "array", ")",...
1a2d05977fc8edebd8ddf9e81fdb97648596266d
test
maybebool
If `value` is a string type, attempts to convert it to a boolean if it looks like it might be one, otherwise returns the value unchanged. The difference between this and :func:`pyramid.settings.asbool` is how non-bools are handled: this returns the original value, whereas `asbool` returns False.
pyramid_webassets/__init__.py
def maybebool(value): ''' If `value` is a string type, attempts to convert it to a boolean if it looks like it might be one, otherwise returns the value unchanged. The difference between this and :func:`pyramid.settings.asbool` is how non-bools are handled: this returns the original value, where...
def maybebool(value): ''' If `value` is a string type, attempts to convert it to a boolean if it looks like it might be one, otherwise returns the value unchanged. The difference between this and :func:`pyramid.settings.asbool` is how non-bools are handled: this returns the original value, where...
[ "If", "value", "is", "a", "string", "type", "attempts", "to", "convert", "it", "to", "a", "boolean", "if", "it", "looks", "like", "it", "might", "be", "one", "otherwise", "returns", "the", "value", "unchanged", ".", "The", "difference", "between", "this", ...
sontek/pyramid_webassets
python
https://github.com/sontek/pyramid_webassets/blob/d81a8f0c55aa49181ced4650fc88d434bbf94e62/pyramid_webassets/__init__.py#L24-L34
[ "def", "maybebool", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", "and", "value", ".", "lower", "(", ")", "in", "booly", ":", "return", "asbool", "(", "value", ")", "# pragma: no cover", "return", "value"...
d81a8f0c55aa49181ced4650fc88d434bbf94e62
test
get_webassets_env_from_settings
This function will take all webassets.* parameters, and call the ``Environment()`` constructor with kwargs passed in. The only two parameters that are not passed as keywords are: * base_dir * base_url which are passed in positionally. Read the ``WebAssets`` docs for ``Environment`` for more ...
pyramid_webassets/__init__.py
def get_webassets_env_from_settings(settings, prefix='webassets'): """This function will take all webassets.* parameters, and call the ``Environment()`` constructor with kwargs passed in. The only two parameters that are not passed as keywords are: * base_dir * base_url which are passed in po...
def get_webassets_env_from_settings(settings, prefix='webassets'): """This function will take all webassets.* parameters, and call the ``Environment()`` constructor with kwargs passed in. The only two parameters that are not passed as keywords are: * base_dir * base_url which are passed in po...
[ "This", "function", "will", "take", "all", "webassets", ".", "*", "parameters", "and", "call", "the", "Environment", "()", "constructor", "with", "kwargs", "passed", "in", "." ]
sontek/pyramid_webassets
python
https://github.com/sontek/pyramid_webassets/blob/d81a8f0c55aa49181ced4650fc88d434bbf94e62/pyramid_webassets/__init__.py#L207-L328
[ "def", "get_webassets_env_from_settings", "(", "settings", ",", "prefix", "=", "'webassets'", ")", ":", "# Make a dictionary of the webassets.* elements...", "kwargs", "=", "{", "}", "# assets settings", "cut_prefix", "=", "len", "(", "prefix", ")", "+", "1", "for", ...
d81a8f0c55aa49181ced4650fc88d434bbf94e62
test
classifier.format_data
Function for converting a dict to an array suitable for sklearn. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. scale : bool Whether or not to scale the data. Should always be `True`, unle...
latools/filtering/classifier_obj.py
def format_data(self, data, scale=True): """ Function for converting a dict to an array suitable for sklearn. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. scale : bool Whether or not...
def format_data(self, data, scale=True): """ Function for converting a dict to an array suitable for sklearn. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. scale : bool Whether or not...
[ "Function", "for", "converting", "a", "dict", "to", "an", "array", "suitable", "for", "sklearn", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L28-L65
[ "def", "format_data", "(", "self", ",", "data", ",", "scale", "=", "True", ")", ":", "if", "len", "(", "self", ".", "analytes", ")", "==", "1", ":", "# if single analyte", "d", "=", "nominal_values", "(", "data", "[", "self", ".", "analytes", "[", "0...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.fitting_data
Function to format data for cluster fitting. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. Returns ------- A data array for initial cluster fitting.
latools/filtering/classifier_obj.py
def fitting_data(self, data): """ Function to format data for cluster fitting. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. Returns ------- A data array for initial cluster fitt...
def fitting_data(self, data): """ Function to format data for cluster fitting. Parameters ---------- data : dict A dict of data, containing all elements of `analytes` as items. Returns ------- A data array for initial cluster fitt...
[ "Function", "to", "format", "data", "for", "cluster", "fitting", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L67-L87
[ "def", "fitting_data", "(", "self", ",", "data", ")", ":", "ds_fit", ",", "_", "=", "self", ".", "format_data", "(", "data", ",", "scale", "=", "False", ")", "# define scaler", "self", ".", "scaler", "=", "preprocessing", ".", "StandardScaler", "(", ")",...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.fit_kmeans
Fit KMeans clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. n_clusters : int The number of clusters in the data. **kwargs passed to `sklearn.cluster.KMeans`. Retur...
latools/filtering/classifier_obj.py
def fit_kmeans(self, data, n_clusters, **kwargs): """ Fit KMeans clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. n_clusters : int The number of clusters in the data. *...
def fit_kmeans(self, data, n_clusters, **kwargs): """ Fit KMeans clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. n_clusters : int The number of clusters in the data. *...
[ "Fit", "KMeans", "clustering", "algorithm", "to", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L89-L108
[ "def", "fit_kmeans", "(", "self", ",", "data", ",", "n_clusters", ",", "*", "*", "kwargs", ")", ":", "km", "=", "cl", ".", "KMeans", "(", "n_clusters", "=", "n_clusters", ",", "*", "*", "kwargs", ")", "km", ".", "fit", "(", "data", ")", "return", ...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.fit_meanshift
Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth value used during clustering. If none, determined automatically. Note: th...
latools/filtering/classifier_obj.py
def fit_meanshift(self, data, bandwidth=None, bin_seeding=False, **kwargs): """ Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth v...
def fit_meanshift(self, data, bandwidth=None, bin_seeding=False, **kwargs): """ Fit MeanShift clustering algorithm to data. Parameters ---------- data : array-like A dataset formatted by `classifier.fitting_data`. bandwidth : float The bandwidth v...
[ "Fit", "MeanShift", "clustering", "algorithm", "to", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L110-L137
[ "def", "fit_meanshift", "(", "self", ",", "data", ",", "bandwidth", "=", "None", ",", "bin_seeding", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "bandwidth", "is", "None", ":", "bandwidth", "=", "cl", ".", "estimate_bandwidth", "(", "data", ...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.fit
fit classifiers from large dataset. Parameters ---------- data : dict A dict of data for clustering. Must contain items with the same name as analytes used for clustering. method : str A string defining the clustering method used. Can be: ...
latools/filtering/classifier_obj.py
def fit(self, data, method='kmeans', **kwargs): """ fit classifiers from large dataset. Parameters ---------- data : dict A dict of data for clustering. Must contain items with the same name as analytes used for clustering. method : st...
def fit(self, data, method='kmeans', **kwargs): """ fit classifiers from large dataset. Parameters ---------- data : dict A dict of data for clustering. Must contain items with the same name as analytes used for clustering. method : st...
[ "fit", "classifiers", "from", "large", "dataset", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L139-L190
[ "def", "fit", "(", "self", ",", "data", ",", "method", "=", "'kmeans'", ",", "*", "*", "kwargs", ")", ":", "self", ".", "method", "=", "method", "ds_fit", "=", "self", ".", "fitting_data", "(", "data", ")", "mdict", "=", "{", "'kmeans'", ":", "self...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.predict
Label new data with cluster identities. Parameters ---------- data : dict A data dict containing the same analytes used to fit the classifier. sort_by : str The name of an analyte used to sort the resulting clusters. If None, defaults to t...
latools/filtering/classifier_obj.py
def predict(self, data): """ Label new data with cluster identities. Parameters ---------- data : dict A data dict containing the same analytes used to fit the classifier. sort_by : str The name of an analyte used to sort the resulting...
def predict(self, data): """ Label new data with cluster identities. Parameters ---------- data : dict A data dict containing the same analytes used to fit the classifier. sort_by : str The name of an analyte used to sort the resulting...
[ "Label", "new", "data", "with", "cluster", "identities", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L192-L218
[ "def", "predict", "(", "self", ",", "data", ")", ":", "size", "=", "data", "[", "self", ".", "analytes", "[", "0", "]", "]", ".", "size", "ds", ",", "sampled", "=", "self", ".", "format_data", "(", "data", ")", "# predict clusters", "cs", "=", "sel...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.map_clusters
Translate cluster identity back to original data size. Parameters ---------- size : int size of original dataset sampled : array-like integer array describing location of finite values in original data. clusters : array-like intege...
latools/filtering/classifier_obj.py
def map_clusters(self, size, sampled, clusters): """ Translate cluster identity back to original data size. Parameters ---------- size : int size of original dataset sampled : array-like integer array describing location of finite values ...
def map_clusters(self, size, sampled, clusters): """ Translate cluster identity back to original data size. Parameters ---------- size : int size of original dataset sampled : array-like integer array describing location of finite values ...
[ "Translate", "cluster", "identity", "back", "to", "original", "data", "size", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L220-L245
[ "def", "map_clusters", "(", "self", ",", "size", ",", "sampled", ",", "clusters", ")", ":", "ids", "=", "np", ".", "zeros", "(", "size", ",", "dtype", "=", "int", ")", "ids", "[", ":", "]", "=", "-", "2", "ids", "[", "sampled", "]", "=", "clust...
cd25a650cfee318152f234d992708511f7047fbe
test
classifier.sort_clusters
Sort clusters by the concentration of a particular analyte. Parameters ---------- data : dict A dataset containing sort_by as a key. cs : array-like An array of clusters, the same length as values of data. sort_by : str analyte to sort the clu...
latools/filtering/classifier_obj.py
def sort_clusters(self, data, cs, sort_by): """ Sort clusters by the concentration of a particular analyte. Parameters ---------- data : dict A dataset containing sort_by as a key. cs : array-like An array of clusters, the same length as values of...
def sort_clusters(self, data, cs, sort_by): """ Sort clusters by the concentration of a particular analyte. Parameters ---------- data : dict A dataset containing sort_by as a key. cs : array-like An array of clusters, the same length as values of...
[ "Sort", "clusters", "by", "the", "concentration", "of", "a", "particular", "analyte", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/classifier_obj.py#L247-L281
[ "def", "sort_clusters", "(", "self", ",", "data", ",", "cs", ",", "sort_by", ")", ":", "# label the clusters according to their contents", "sdat", "=", "data", "[", "sort_by", "]", "means", "=", "[", "]", "nclusts", "=", "np", ".", "arange", "(", "cs", "."...
cd25a650cfee318152f234d992708511f7047fbe
test
get_date
Return a datetime oject from a string, with optional time format. Parameters ---------- datetime : str Date-time as string in any sensible format. time_format : datetime str (optional) String describing the datetime format. If missing uses dateutil.parser to guess time format.
latools/helpers/helpers.py
def get_date(datetime, time_format=None): """ Return a datetime oject from a string, with optional time format. Parameters ---------- datetime : str Date-time as string in any sensible format. time_format : datetime str (optional) String describing the datetime format. If missin...
def get_date(datetime, time_format=None): """ Return a datetime oject from a string, with optional time format. Parameters ---------- datetime : str Date-time as string in any sensible format. time_format : datetime str (optional) String describing the datetime format. If missin...
[ "Return", "a", "datetime", "oject", "from", "a", "string", "with", "optional", "time", "format", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L29-L45
[ "def", "get_date", "(", "datetime", ",", "time_format", "=", "None", ")", ":", "if", "time_format", "is", "None", ":", "t", "=", "du", ".", "parser", ".", "parse", "(", "datetime", ")", "else", ":", "t", "=", "dt", ".", "datetime", ".", "strftime", ...
cd25a650cfee318152f234d992708511f7047fbe
test
get_total_n_points
Returns the total number of data points in values of dict. Paramters --------- d : dict
latools/helpers/helpers.py
def get_total_n_points(d): """ Returns the total number of data points in values of dict. Paramters --------- d : dict """ n = 0 for di in d.values(): n += len(di) return n
def get_total_n_points(d): """ Returns the total number of data points in values of dict. Paramters --------- d : dict """ n = 0 for di in d.values(): n += len(di) return n
[ "Returns", "the", "total", "number", "of", "data", "points", "in", "values", "of", "dict", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L47-L58
[ "def", "get_total_n_points", "(", "d", ")", ":", "n", "=", "0", "for", "di", "in", "d", ".", "values", "(", ")", ":", "n", "+=", "len", "(", "di", ")", "return", "n" ]
cd25a650cfee318152f234d992708511f7047fbe
test
get_total_time_span
Returns total length of analysis.
latools/helpers/helpers.py
def get_total_time_span(d): """ Returns total length of analysis. """ tmax = 0 for di in d.values(): if di.uTime.max() > tmax: tmax = di.uTime.max() return tmax
def get_total_time_span(d): """ Returns total length of analysis. """ tmax = 0 for di in d.values(): if di.uTime.max() > tmax: tmax = di.uTime.max() return tmax
[ "Returns", "total", "length", "of", "analysis", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L60-L70
[ "def", "get_total_time_span", "(", "d", ")", ":", "tmax", "=", "0", "for", "di", "in", "d", ".", "values", "(", ")", ":", "if", "di", ".", "uTime", ".", "max", "(", ")", ">", "tmax", ":", "tmax", "=", "di", ".", "uTime", ".", "max", "(", ")",...
cd25a650cfee318152f234d992708511f7047fbe
test
unitpicker
Determines the most appropriate plotting unit for data. Parameters ---------- a : float or array-like number to optimise. If array like, the 25% quantile is optimised. llim : float minimum allowable value in scaled data. Returns ------- (float, str) (multiplier, uni...
latools/helpers/helpers.py
def unitpicker(a, llim=0.1, denominator=None, focus_stage=None): """ Determines the most appropriate plotting unit for data. Parameters ---------- a : float or array-like number to optimise. If array like, the 25% quantile is optimised. llim : float minimum allowable value in sc...
def unitpicker(a, llim=0.1, denominator=None, focus_stage=None): """ Determines the most appropriate plotting unit for data. Parameters ---------- a : float or array-like number to optimise. If array like, the 25% quantile is optimised. llim : float minimum allowable value in sc...
[ "Determines", "the", "most", "appropriate", "plotting", "unit", "for", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L72-L128
[ "def", "unitpicker", "(", "a", ",", "llim", "=", "0.1", ",", "denominator", "=", "None", ",", "focus_stage", "=", "None", ")", ":", "if", "not", "isinstance", "(", "a", ",", "(", "int", ",", "float", ")", ")", ":", "a", "=", "nominal_values", "(", ...
cd25a650cfee318152f234d992708511f7047fbe
test
pretty_element
Returns formatted element name. Parameters ---------- s : str of format [A-Z][a-z]?[0-9]+ Returns ------- str LaTeX formatted string with superscript numbers.
latools/helpers/helpers.py
def pretty_element(s): """ Returns formatted element name. Parameters ---------- s : str of format [A-Z][a-z]?[0-9]+ Returns ------- str LaTeX formatted string with superscript numbers. """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.match('.*?...
def pretty_element(s): """ Returns formatted element name. Parameters ---------- s : str of format [A-Z][a-z]?[0-9]+ Returns ------- str LaTeX formatted string with superscript numbers. """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.match('.*?...
[ "Returns", "formatted", "element", "name", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L130-L147
[ "def", "pretty_element", "(", "s", ")", ":", "el", "=", "re", ".", "match", "(", "'.*?([A-z]{1,3}).*?'", ",", "s", ")", ".", "groups", "(", ")", "[", "0", "]", "m", "=", "re", ".", "match", "(", "'.*?([0-9]{1,3}).*?'", ",", "s", ")", ".", "groups",...
cd25a650cfee318152f234d992708511f7047fbe
test
analyte_2_namemass
Converts analytes in format '27Al' to 'Al27'. Parameters ---------- s : str of format [A-z]{1,3}[0-9]{1,3} Returns ------- str Name in format [0-9]{1,3}[A-z]{1,3}
latools/helpers/helpers.py
def analyte_2_namemass(s): """ Converts analytes in format '27Al' to 'Al27'. Parameters ---------- s : str of format [A-z]{1,3}[0-9]{1,3} Returns ------- str Name in format [0-9]{1,3}[A-z]{1,3} """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.ma...
def analyte_2_namemass(s): """ Converts analytes in format '27Al' to 'Al27'. Parameters ---------- s : str of format [A-z]{1,3}[0-9]{1,3} Returns ------- str Name in format [0-9]{1,3}[A-z]{1,3} """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.ma...
[ "Converts", "analytes", "in", "format", "27Al", "to", "Al27", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L149-L166
[ "def", "analyte_2_namemass", "(", "s", ")", ":", "el", "=", "re", ".", "match", "(", "'.*?([A-z]{1,3}).*?'", ",", "s", ")", ".", "groups", "(", ")", "[", "0", "]", "m", "=", "re", ".", "match", "(", "'.*?([0-9]{1,3}).*?'", ",", "s", ")", ".", "grou...
cd25a650cfee318152f234d992708511f7047fbe
test
analyte_2_massname
Converts analytes in format 'Al27' to '27Al'. Parameters ---------- s : str of format [0-9]{1,3}[A-z]{1,3} Returns ------- str Name in format [A-z]{1,3}[0-9]{1,3}
latools/helpers/helpers.py
def analyte_2_massname(s): """ Converts analytes in format 'Al27' to '27Al'. Parameters ---------- s : str of format [0-9]{1,3}[A-z]{1,3} Returns ------- str Name in format [A-z]{1,3}[0-9]{1,3} """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.ma...
def analyte_2_massname(s): """ Converts analytes in format 'Al27' to '27Al'. Parameters ---------- s : str of format [0-9]{1,3}[A-z]{1,3} Returns ------- str Name in format [A-z]{1,3}[0-9]{1,3} """ el = re.match('.*?([A-z]{1,3}).*?', s).groups()[0] m = re.ma...
[ "Converts", "analytes", "in", "format", "Al27", "to", "27Al", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L168-L185
[ "def", "analyte_2_massname", "(", "s", ")", ":", "el", "=", "re", ".", "match", "(", "'.*?([A-z]{1,3}).*?'", ",", "s", ")", ".", "groups", "(", ")", "[", "0", "]", "m", "=", "re", ".", "match", "(", "'.*?([0-9]{1,3}).*?'", ",", "s", ")", ".", "grou...
cd25a650cfee318152f234d992708511f7047fbe
test
collate_data
Copy all csvs in nested directroy to single directory. Function to copy all csvs from a directory, and place them in a new directory. Parameters ---------- in_dir : str Input directory containing csv files in subfolders extension : str The extension that identifies your data fi...
latools/helpers/helpers.py
def collate_data(in_dir, extension='.csv', out_dir=None): """ Copy all csvs in nested directroy to single directory. Function to copy all csvs from a directory, and place them in a new directory. Parameters ---------- in_dir : str Input directory containing csv files in subfolders ...
def collate_data(in_dir, extension='.csv', out_dir=None): """ Copy all csvs in nested directroy to single directory. Function to copy all csvs from a directory, and place them in a new directory. Parameters ---------- in_dir : str Input directory containing csv files in subfolders ...
[ "Copy", "all", "csvs", "in", "nested", "directroy", "to", "single", "directory", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L187-L218
[ "def", "collate_data", "(", "in_dir", ",", "extension", "=", "'.csv'", ",", "out_dir", "=", "None", ")", ":", "if", "out_dir", "is", "None", ":", "out_dir", "=", "'./'", "+", "re", ".", "search", "(", "'^\\.(.*)'", ",", "extension", ")", ".", "groups",...
cd25a650cfee318152f234d992708511f7047fbe
test
bool_2_indices
Convert boolean array into a 2D array of (start, stop) pairs.
latools/helpers/helpers.py
def bool_2_indices(a): """ Convert boolean array into a 2D array of (start, stop) pairs. """ if any(a): lims = [] lims.append(np.where(a[:-1] != a[1:])[0]) if a[0]: lims.append([0]) if a[-1]: lims.append([len(a) - 1]) lims = np.concatenate...
def bool_2_indices(a): """ Convert boolean array into a 2D array of (start, stop) pairs. """ if any(a): lims = [] lims.append(np.where(a[:-1] != a[1:])[0]) if a[0]: lims.append([0]) if a[-1]: lims.append([len(a) - 1]) lims = np.concatenate...
[ "Convert", "boolean", "array", "into", "a", "2D", "array", "of", "(", "start", "stop", ")", "pairs", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L220-L237
[ "def", "bool_2_indices", "(", "a", ")", ":", "if", "any", "(", "a", ")", ":", "lims", "=", "[", "]", "lims", ".", "append", "(", "np", ".", "where", "(", "a", "[", ":", "-", "1", "]", "!=", "a", "[", "1", ":", "]", ")", "[", "0", "]", "...
cd25a650cfee318152f234d992708511f7047fbe
test
enumerate_bool
Consecutively numbers contiguous booleans in array. i.e. a boolean sequence, and resulting numbering T F T T T F T F F F T T F 0-1 1 1 - 2 ---3 3 - where ' - ' Parameters ---------- bool_array : array_like Array of booleans. nstart : int The number of the first boolean...
latools/helpers/helpers.py
def enumerate_bool(bool_array, nstart=0): """ Consecutively numbers contiguous booleans in array. i.e. a boolean sequence, and resulting numbering T F T T T F T F F F T T F 0-1 1 1 - 2 ---3 3 - where ' - ' Parameters ---------- bool_array : array_like Array of booleans. ...
def enumerate_bool(bool_array, nstart=0): """ Consecutively numbers contiguous booleans in array. i.e. a boolean sequence, and resulting numbering T F T T T F T F F F T T F 0-1 1 1 - 2 ---3 3 - where ' - ' Parameters ---------- bool_array : array_like Array of booleans. ...
[ "Consecutively", "numbers", "contiguous", "booleans", "in", "array", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L239-L260
[ "def", "enumerate_bool", "(", "bool_array", ",", "nstart", "=", "0", ")", ":", "ind", "=", "bool_2_indices", "(", "bool_array", ")", "ns", "=", "np", ".", "full", "(", "bool_array", ".", "size", ",", "nstart", ",", "dtype", "=", "int", ")", "for", "n...
cd25a650cfee318152f234d992708511f7047fbe
test
tuples_2_bool
Generate boolean array from list of limit tuples. Parameters ---------- tuples : array_like [2, n] array of (start, end) values x : array_like x scale the tuples are mapped to Returns ------- array_like boolean array, True where x is between each pair of tuples.
latools/helpers/helpers.py
def tuples_2_bool(tuples, x): """ Generate boolean array from list of limit tuples. Parameters ---------- tuples : array_like [2, n] array of (start, end) values x : array_like x scale the tuples are mapped to Returns ------- array_like boolean array, True w...
def tuples_2_bool(tuples, x): """ Generate boolean array from list of limit tuples. Parameters ---------- tuples : array_like [2, n] array of (start, end) values x : array_like x scale the tuples are mapped to Returns ------- array_like boolean array, True w...
[ "Generate", "boolean", "array", "from", "list", "of", "limit", "tuples", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L262-L284
[ "def", "tuples_2_bool", "(", "tuples", ",", "x", ")", ":", "if", "np", ".", "ndim", "(", "tuples", ")", "==", "1", ":", "tuples", "=", "[", "tuples", "]", "out", "=", "np", ".", "zeros", "(", "x", ".", "size", ",", "dtype", "=", "bool", ")", ...
cd25a650cfee318152f234d992708511f7047fbe
test
rolling_window
Returns (win, len(a)) rolling - window array of data. Parameters ---------- a : array_like Array to calculate the rolling window of window : int Description of `window`. pad : same as dtype(a) Description of `pad`. Returns ------- array_like An array of ...
latools/helpers/helpers.py
def rolling_window(a, window, pad=None): """ Returns (win, len(a)) rolling - window array of data. Parameters ---------- a : array_like Array to calculate the rolling window of window : int Description of `window`. pad : same as dtype(a) Description of `pad`. Re...
def rolling_window(a, window, pad=None): """ Returns (win, len(a)) rolling - window array of data. Parameters ---------- a : array_like Array to calculate the rolling window of window : int Description of `window`. pad : same as dtype(a) Description of `pad`. Re...
[ "Returns", "(", "win", "len", "(", "a", "))", "rolling", "-", "window", "array", "of", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L328-L377
[ "def", "rolling_window", "(", "a", ",", "window", ",", "pad", "=", "None", ")", ":", "shape", "=", "a", ".", "shape", "[", ":", "-", "1", "]", "+", "(", "a", ".", "shape", "[", "-", "1", "]", "-", "window", "+", "1", ",", "window", ")", "st...
cd25a650cfee318152f234d992708511f7047fbe
test
fastsmooth
Returns rolling - window smooth of a. Function to efficiently calculate the rolling mean of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters ---------- a : array_like The 1D...
latools/helpers/helpers.py
def fastsmooth(a, win=11): """ Returns rolling - window smooth of a. Function to efficiently calculate the rolling mean of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters -----...
def fastsmooth(a, win=11): """ Returns rolling - window smooth of a. Function to efficiently calculate the rolling mean of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters -----...
[ "Returns", "rolling", "-", "window", "smooth", "of", "a", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L379-L406
[ "def", "fastsmooth", "(", "a", ",", "win", "=", "11", ")", ":", "# check to see if 'window' is odd (even does not work)", "if", "win", "%", "2", "==", "0", ":", "win", "+=", "1", "# add 1 to window if it is even.", "kernel", "=", "np", ".", "ones", "(", "win",...
cd25a650cfee318152f234d992708511f7047fbe
test
fastgrad
Returns rolling - window gradient of a. Function to efficiently calculate the rolling gradient of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters ---------- a : array_like ...
latools/helpers/helpers.py
def fastgrad(a, win=11): """ Returns rolling - window gradient of a. Function to efficiently calculate the rolling gradient of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters -...
def fastgrad(a, win=11): """ Returns rolling - window gradient of a. Function to efficiently calculate the rolling gradient of a numpy array using 'stride_tricks' to split up a 1D array into an ndarray of sub - sections of the original array, of dimensions [len(a) - win, win]. Parameters -...
[ "Returns", "rolling", "-", "window", "gradient", "of", "a", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L408-L439
[ "def", "fastgrad", "(", "a", ",", "win", "=", "11", ")", ":", "# check to see if 'window' is odd (even does not work)", "if", "win", "%", "2", "==", "0", ":", "win", "+=", "1", "# subtract 1 from window if it is even.", "# trick for efficient 'rolling' computation in nump...
cd25a650cfee318152f234d992708511f7047fbe
test
calc_grads
Calculate gradients of values in dat. Parameters ---------- x : array like Independent variable for items in dat. dat : dict {key: dependent_variable} pairs keys : str or array-like Which keys in dict to calculate the gradient of. win : int The side of the ro...
latools/helpers/helpers.py
def calc_grads(x, dat, keys=None, win=5): """ Calculate gradients of values in dat. Parameters ---------- x : array like Independent variable for items in dat. dat : dict {key: dependent_variable} pairs keys : str or array-like Which keys in dict to calculate the...
def calc_grads(x, dat, keys=None, win=5): """ Calculate gradients of values in dat. Parameters ---------- x : array like Independent variable for items in dat. dat : dict {key: dependent_variable} pairs keys : str or array-like Which keys in dict to calculate the...
[ "Calculate", "gradients", "of", "values", "in", "dat", ".", "Parameters", "----------", "x", ":", "array", "like", "Independent", "variable", "for", "items", "in", "dat", ".", "dat", ":", "dict", "{", "key", ":", "dependent_variable", "}", "pairs", "keys", ...
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L441-L479
[ "def", "calc_grads", "(", "x", ",", "dat", ",", "keys", "=", "None", ",", "win", "=", "5", ")", ":", "if", "keys", "is", "None", ":", "keys", "=", "dat", ".", "keys", "(", ")", "def", "grad", "(", "xy", ")", ":", "if", "(", "~", "np", ".", ...
cd25a650cfee318152f234d992708511f7047fbe
test
findmins
Function to find local minima. Parameters ---------- x, y : array_like 1D arrays of the independent (x) and dependent (y) variables. Returns ------- array_like Array of points in x where y has a local minimum.
latools/helpers/helpers.py
def findmins(x, y): """ Function to find local minima. Parameters ---------- x, y : array_like 1D arrays of the independent (x) and dependent (y) variables. Returns ------- array_like Array of points in x where y has a local minimum. """ return x[np.r_[False, y[1:] ...
def findmins(x, y): """ Function to find local minima. Parameters ---------- x, y : array_like 1D arrays of the independent (x) and dependent (y) variables. Returns ------- array_like Array of points in x where y has a local minimum. """ return x[np.r_[False, y[1:] ...
[ "Function", "to", "find", "local", "minima", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L481-L494
[ "def", "findmins", "(", "x", ",", "y", ")", ":", "return", "x", "[", "np", ".", "r_", "[", "False", ",", "y", "[", "1", ":", "]", "<", "y", "[", ":", "-", "1", "]", "]", "&", "np", ".", "r_", "[", "y", "[", ":", "-", "1", "]", "<", ...
cd25a650cfee318152f234d992708511f7047fbe
test
stack_keys
Combine elements of ddict into an array of shape (len(ddict[key]), len(keys)). Useful for preparing data for sklearn. Parameters ---------- ddict : dict A dict containing arrays or lists to be stacked. Must be of equal length. keys : list or str The keys of dict to stack. M...
latools/helpers/helpers.py
def stack_keys(ddict, keys, extra=None): """ Combine elements of ddict into an array of shape (len(ddict[key]), len(keys)). Useful for preparing data for sklearn. Parameters ---------- ddict : dict A dict containing arrays or lists to be stacked. Must be of equal length. ke...
def stack_keys(ddict, keys, extra=None): """ Combine elements of ddict into an array of shape (len(ddict[key]), len(keys)). Useful for preparing data for sklearn. Parameters ---------- ddict : dict A dict containing arrays or lists to be stacked. Must be of equal length. ke...
[ "Combine", "elements", "of", "ddict", "into", "an", "array", "of", "shape", "(", "len", "(", "ddict", "[", "key", "]", ")", "len", "(", "keys", "))", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/helpers.py#L496-L520
[ "def", "stack_keys", "(", "ddict", ",", "keys", ",", "extra", "=", "None", ")", ":", "if", "isinstance", "(", "keys", ",", "str", ")", ":", "d", "=", "[", "ddict", "[", "keys", "]", "]", "else", ":", "d", "=", "[", "ddict", "[", "k", "]", "fo...
cd25a650cfee318152f234d992708511f7047fbe
test
cluster_meanshift
Identify clusters using Meanshift algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. bandwidth : float or None If None, bandwidth is estimated automatically using sklean.cluster.estimate_bandwidth bin_seeding : bool Setting this...
latools/filtering/clustering.py
def cluster_meanshift(data, bandwidth=None, bin_seeding=False, **kwargs): """ Identify clusters using Meanshift algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. bandwidth : float or None If None, bandwidth is estimated automatically using...
def cluster_meanshift(data, bandwidth=None, bin_seeding=False, **kwargs): """ Identify clusters using Meanshift algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. bandwidth : float or None If None, bandwidth is estimated automatically using...
[ "Identify", "clusters", "using", "Meanshift", "algorithm", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/clustering.py#L5-L33
[ "def", "cluster_meanshift", "(", "data", ",", "bandwidth", "=", "None", ",", "bin_seeding", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "bandwidth", "is", "None", ":", "bandwidth", "=", "cl", ".", "estimate_bandwidth", "(", "data", ")", "ms", ...
cd25a650cfee318152f234d992708511f7047fbe
test
cluster_kmeans
Identify clusters using K - Means algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. n_clusters : int The number of clusters expected in the data. Returns ------- dict boolean array for each identified cluster.
latools/filtering/clustering.py
def cluster_kmeans(data, n_clusters, **kwargs): """ Identify clusters using K - Means algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. n_clusters : int The number of clusters expected in the data. Returns ------- dict ...
def cluster_kmeans(data, n_clusters, **kwargs): """ Identify clusters using K - Means algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. n_clusters : int The number of clusters expected in the data. Returns ------- dict ...
[ "Identify", "clusters", "using", "K", "-", "Means", "algorithm", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/clustering.py#L35-L56
[ "def", "cluster_kmeans", "(", "data", ",", "n_clusters", ",", "*", "*", "kwargs", ")", ":", "km", "=", "cl", ".", "KMeans", "(", "n_clusters", ",", "*", "*", "kwargs", ")", "kmf", "=", "km", ".", "fit", "(", "data", ")", "labels", "=", "kmf", "."...
cd25a650cfee318152f234d992708511f7047fbe
test
cluster_DBSCAN
Identify clusters using DBSCAN algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. eps : float The minimum 'distance' points must be apart for them to be in the same cluster. Defaults to 0.3. Note: If the data are normalised (they sh...
latools/filtering/clustering.py
def cluster_DBSCAN(data, eps=None, min_samples=None, n_clusters=None, maxiter=200, **kwargs): """ Identify clusters using DBSCAN algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. eps : float The minimum 'distance' points...
def cluster_DBSCAN(data, eps=None, min_samples=None, n_clusters=None, maxiter=200, **kwargs): """ Identify clusters using DBSCAN algorithm. Parameters ---------- data : array_like array of size [n_samples, n_features]. eps : float The minimum 'distance' points...
[ "Identify", "clusters", "using", "DBSCAN", "algorithm", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/clustering.py#L58-L123
[ "def", "cluster_DBSCAN", "(", "data", ",", "eps", "=", "None", ",", "min_samples", "=", "None", ",", "n_clusters", "=", "None", ",", "maxiter", "=", "200", ",", "*", "*", "kwargs", ")", ":", "if", "n_clusters", "is", "None", ":", "if", "eps", "is", ...
cd25a650cfee318152f234d992708511f7047fbe
test
get_defined_srms
Returns list of SRMS defined in the SRM database
latools/helpers/srm.py
def get_defined_srms(srm_file): """ Returns list of SRMS defined in the SRM database """ srms = read_table(srm_file) return np.asanyarray(srms.index.unique())
def get_defined_srms(srm_file): """ Returns list of SRMS defined in the SRM database """ srms = read_table(srm_file) return np.asanyarray(srms.index.unique())
[ "Returns", "list", "of", "SRMS", "defined", "in", "the", "SRM", "database" ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/srm.py#L22-L27
[ "def", "get_defined_srms", "(", "srm_file", ")", ":", "srms", "=", "read_table", "(", "srm_file", ")", "return", "np", ".", "asanyarray", "(", "srms", ".", "index", ".", "unique", "(", ")", ")" ]
cd25a650cfee318152f234d992708511f7047fbe
test
read_configuration
Read LAtools configuration file, and return parameters as dict.
latools/helpers/config.py
def read_configuration(config='DEFAULT'): """ Read LAtools configuration file, and return parameters as dict. """ # read configuration file _, conf = read_latoolscfg() # if 'DEFAULT', check which is the default configuration if config == 'DEFAULT': config = conf['DEFAULT']['config'] ...
def read_configuration(config='DEFAULT'): """ Read LAtools configuration file, and return parameters as dict. """ # read configuration file _, conf = read_latoolscfg() # if 'DEFAULT', check which is the default configuration if config == 'DEFAULT': config = conf['DEFAULT']['config'] ...
[ "Read", "LAtools", "configuration", "file", "and", "return", "parameters", "as", "dict", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L13-L27
[ "def", "read_configuration", "(", "config", "=", "'DEFAULT'", ")", ":", "# read configuration file", "_", ",", "conf", "=", "read_latoolscfg", "(", ")", "# if 'DEFAULT', check which is the default configuration", "if", "config", "==", "'DEFAULT'", ":", "config", "=", ...
cd25a650cfee318152f234d992708511f7047fbe
test
read_latoolscfg
Reads configuration, returns a ConfigParser object. Distinct from read_configuration, which returns a dict.
latools/helpers/config.py
def read_latoolscfg(): """ Reads configuration, returns a ConfigParser object. Distinct from read_configuration, which returns a dict. """ config_file = pkgrs.resource_filename('latools', 'latools.cfg') cf = configparser.ConfigParser() cf.read(config_file) return config_file, cf
def read_latoolscfg(): """ Reads configuration, returns a ConfigParser object. Distinct from read_configuration, which returns a dict. """ config_file = pkgrs.resource_filename('latools', 'latools.cfg') cf = configparser.ConfigParser() cf.read(config_file) return config_file, cf
[ "Reads", "configuration", "returns", "a", "ConfigParser", "object", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L30-L39
[ "def", "read_latoolscfg", "(", ")", ":", "config_file", "=", "pkgrs", ".", "resource_filename", "(", "'latools'", ",", "'latools.cfg'", ")", "cf", "=", "configparser", ".", "ConfigParser", "(", ")", "cf", ".", "read", "(", "config_file", ")", "return", "conf...
cd25a650cfee318152f234d992708511f7047fbe
test
print_all
Prints all currently defined configurations.
latools/helpers/config.py
def print_all(): """ Prints all currently defined configurations. """ # read configuration file _, conf = read_latoolscfg() default = conf['DEFAULT']['config'] pstr = '\nCurrently defined LAtools configurations:\n\n' for s in conf.sections(): if s == default: pstr +...
def print_all(): """ Prints all currently defined configurations. """ # read configuration file _, conf = read_latoolscfg() default = conf['DEFAULT']['config'] pstr = '\nCurrently defined LAtools configurations:\n\n' for s in conf.sections(): if s == default: pstr +...
[ "Prints", "all", "currently", "defined", "configurations", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L50-L76
[ "def", "print_all", "(", ")", ":", "# read configuration file", "_", ",", "conf", "=", "read_latoolscfg", "(", ")", "default", "=", "conf", "[", "'DEFAULT'", "]", "[", "'config'", "]", "pstr", "=", "'\\nCurrently defined LAtools configurations:\\n\\n'", "for", "s"...
cd25a650cfee318152f234d992708511f7047fbe
test
copy_SRM_file
Creates a copy of the default SRM table at the specified location. Parameters ---------- destination : str The save location for the SRM file. If no location specified, saves it as 'LAtools_[config]_SRMTable.csv' in the current working directory. config : str It's poss...
latools/helpers/config.py
def copy_SRM_file(destination=None, config='DEFAULT'): """ Creates a copy of the default SRM table at the specified location. Parameters ---------- destination : str The save location for the SRM file. If no location specified, saves it as 'LAtools_[config]_SRMTable.csv' in the cur...
def copy_SRM_file(destination=None, config='DEFAULT'): """ Creates a copy of the default SRM table at the specified location. Parameters ---------- destination : str The save location for the SRM file. If no location specified, saves it as 'LAtools_[config]_SRMTable.csv' in the cur...
[ "Creates", "a", "copy", "of", "the", "default", "SRM", "table", "at", "the", "specified", "location", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L78-L109
[ "def", "copy_SRM_file", "(", "destination", "=", "None", ",", "config", "=", "'DEFAULT'", ")", ":", "# find SRM file from configuration ", "conf", "=", "read_configuration", "(", ")", "src", "=", "pkgrs", ".", "resource_filename", "(", "'latools'", ",", "conf",...
cd25a650cfee318152f234d992708511f7047fbe
test
create
Adds a new configuration to latools.cfg. Parameters ---------- config_name : str The name of the new configuration. This should be descriptive (e.g. UC Davis Foram Group) srmfile : str (optional) The location of the srm file used for calibration. dataformat : str (optional) ...
latools/helpers/config.py
def create(config_name, srmfile=None, dataformat=None, base_on='DEFAULT', make_default=False): """ Adds a new configuration to latools.cfg. Parameters ---------- config_name : str The name of the new configuration. This should be descriptive (e.g. UC Davis Foram Group) srmfile :...
def create(config_name, srmfile=None, dataformat=None, base_on='DEFAULT', make_default=False): """ Adds a new configuration to latools.cfg. Parameters ---------- config_name : str The name of the new configuration. This should be descriptive (e.g. UC Davis Foram Group) srmfile :...
[ "Adds", "a", "new", "configuration", "to", "latools", ".", "cfg", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L111-L161
[ "def", "create", "(", "config_name", ",", "srmfile", "=", "None", ",", "dataformat", "=", "None", ",", "base_on", "=", "'DEFAULT'", ",", "make_default", "=", "False", ")", ":", "base_config", "=", "read_configuration", "(", "base_on", ")", "# read config file"...
cd25a650cfee318152f234d992708511f7047fbe
test
change_default
Change the default configuration.
latools/helpers/config.py
def change_default(config): """ Change the default configuration. """ config_file, cf = read_latoolscfg() if config not in cf.sections(): raise ValueError("\n'{:s}' is not a defined configuration.".format(config)) if config == 'REPRODUCE': pstr = ('Are you SURE you want to set ...
def change_default(config): """ Change the default configuration. """ config_file, cf = read_latoolscfg() if config not in cf.sections(): raise ValueError("\n'{:s}' is not a defined configuration.".format(config)) if config == 'REPRODUCE': pstr = ('Are you SURE you want to set ...
[ "Change", "the", "default", "configuration", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/helpers/config.py#L209-L233
[ "def", "change_default", "(", "config", ")", ":", "config_file", ",", "cf", "=", "read_latoolscfg", "(", ")", "if", "config", "not", "in", "cf", ".", "sections", "(", ")", ":", "raise", "ValueError", "(", "\"\\n'{:s}' is not a defined configuration.\"", ".", "...
cd25a650cfee318152f234d992708511f7047fbe
test
threshold
Return boolean arrays where a >= and < threshold. Parameters ---------- values : array-like Array of real values. threshold : float Threshold value Returns ------- (below, above) : tuple or boolean arrays
latools/filtering/filters.py
def threshold(values, threshold): """ Return boolean arrays where a >= and < threshold. Parameters ---------- values : array-like Array of real values. threshold : float Threshold value Returns ------- (below, above) : tuple or boolean arrays """ values ...
def threshold(values, threshold): """ Return boolean arrays where a >= and < threshold. Parameters ---------- values : array-like Array of real values. threshold : float Threshold value Returns ------- (below, above) : tuple or boolean arrays """ values ...
[ "Return", "boolean", "arrays", "where", "a", ">", "=", "and", "<", "threshold", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filters.py#L7-L23
[ "def", "threshold", "(", "values", ",", "threshold", ")", ":", "values", "=", "nominal_values", "(", "values", ")", "return", "(", "values", "<", "threshold", ",", "values", ">=", "threshold", ")" ]
cd25a650cfee318152f234d992708511f7047fbe
test
exclude_downhole
Exclude all data after the first excluded portion. This makes sense for spot measurements where, because of the signal mixing inherent in LA-ICPMS, once a contaminant is ablated, it will always be present to some degree in signals from further down the ablation pit. Parameters ---------- ...
latools/filtering/filters.py
def exclude_downhole(filt, threshold=2): """ Exclude all data after the first excluded portion. This makes sense for spot measurements where, because of the signal mixing inherent in LA-ICPMS, once a contaminant is ablated, it will always be present to some degree in signals from further down t...
def exclude_downhole(filt, threshold=2): """ Exclude all data after the first excluded portion. This makes sense for spot measurements where, because of the signal mixing inherent in LA-ICPMS, once a contaminant is ablated, it will always be present to some degree in signals from further down t...
[ "Exclude", "all", "data", "after", "the", "first", "excluded", "portion", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filters.py#L26-L56
[ "def", "exclude_downhole", "(", "filt", ",", "threshold", "=", "2", ")", ":", "cfilt", "=", "filt", ".", "copy", "(", ")", "inds", "=", "bool_2_indices", "(", "~", "filt", ")", "rem", "=", "(", "np", ".", "diff", "(", "inds", ")", ">=", "threshold"...
cd25a650cfee318152f234d992708511f7047fbe
test
defrag
'Defragment' a filter. Parameters ---------- filt : boolean array A filter threshold : int Consecutive values equal to or below this threshold length are considered fragments, and will be removed. mode : str Wheter to change False fragments to True ('include') ...
latools/filtering/filters.py
def defrag(filt, threshold=3, mode='include'): """ 'Defragment' a filter. Parameters ---------- filt : boolean array A filter threshold : int Consecutive values equal to or below this threshold length are considered fragments, and will be removed. mode : str ...
def defrag(filt, threshold=3, mode='include'): """ 'Defragment' a filter. Parameters ---------- filt : boolean array A filter threshold : int Consecutive values equal to or below this threshold length are considered fragments, and will be removed. mode : str ...
[ "Defragment", "a", "filter", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filters.py#L58-L94
[ "def", "defrag", "(", "filt", ",", "threshold", "=", "3", ",", "mode", "=", "'include'", ")", ":", "if", "bool_2_indices", "(", "filt", ")", "is", "None", ":", "return", "filt", "if", "mode", "==", "'include'", ":", "inds", "=", "bool_2_indices", "(", ...
cd25a650cfee318152f234d992708511f7047fbe
test
trim
Remove points from the start and end of True regions. Parameters ---------- start, end : int The number of points to remove from the start and end of the specified filter. ind : boolean array Which filter to trim. If True, applies to currently active filters.
latools/filtering/filters.py
def trim(ind, start=1, end=0): """ Remove points from the start and end of True regions. Parameters ---------- start, end : int The number of points to remove from the start and end of the specified filter. ind : boolean array Which filter to trim. If True, applies t...
def trim(ind, start=1, end=0): """ Remove points from the start and end of True regions. Parameters ---------- start, end : int The number of points to remove from the start and end of the specified filter. ind : boolean array Which filter to trim. If True, applies t...
[ "Remove", "points", "from", "the", "start", "and", "end", "of", "True", "regions", ".", "Parameters", "----------", "start", "end", ":", "int", "The", "number", "of", "points", "to", "remove", "from", "the", "start", "and", "end", "of", "the", "specified",...
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/filtering/filters.py#L96-L110
[ "def", "trim", "(", "ind", ",", "start", "=", "1", ",", "end", "=", "0", ")", ":", "return", "np", ".", "roll", "(", "ind", ",", "start", ")", "&", "np", ".", "roll", "(", "ind", ",", "-", "end", ")" ]
cd25a650cfee318152f234d992708511f7047fbe
test
D.setfocus
Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on the 'focus' stage, so if steps are done out of sequence, thing...
latools/D_obj.py
def setfocus(self, focus): """ Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on the 'focus' sta...
def setfocus(self, focus): """ Set the 'focus' attribute of the data file. The 'focus' attribute of the object points towards data from a particular stage of analysis. It is used to identify the 'working stage' of the data. Processing functions operate on the 'focus' sta...
[ "Set", "the", "focus", "attribute", "of", "the", "data", "file", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L155-L191
[ "def", "setfocus", "(", "self", ",", "focus", ")", ":", "self", ".", "focus", "=", "self", ".", "data", "[", "focus", "]", "self", ".", "focus_stage", "=", "focus", "self", ".", "__dict__", ".", "update", "(", "self", ".", "focus", ")" ]
cd25a650cfee318152f234d992708511f7047fbe
test
D.despike
Applies expdecay_despiker and noise_despiker to data. Parameters ---------- expdecay_despiker : bool Whether or not to apply the exponential decay filter. exponent : None or float The exponent for the exponential decay filter. If None, it is determine...
latools/D_obj.py
def despike(self, expdecay_despiker=True, exponent=None, noise_despiker=True, win=3, nlim=12., maxiter=3): """ Applies expdecay_despiker and noise_despiker to data. Parameters ---------- expdecay_despiker : bool Whether or not to apply the exponential...
def despike(self, expdecay_despiker=True, exponent=None, noise_despiker=True, win=3, nlim=12., maxiter=3): """ Applies expdecay_despiker and noise_despiker to data. Parameters ---------- expdecay_despiker : bool Whether or not to apply the exponential...
[ "Applies", "expdecay_despiker", "and", "noise_despiker", "to", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L196-L245
[ "def", "despike", "(", "self", ",", "expdecay_despiker", "=", "True", ",", "exponent", "=", "None", ",", "noise_despiker", "=", "True", ",", "win", "=", "3", ",", "nlim", "=", "12.", ",", "maxiter", "=", "3", ")", ":", "if", "not", "hasattr", "(", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.autorange
Automatically separates signal and background data regions. Automatically detect signal and background regions in the laser data, based on the behaviour of a single analyte. The analyte used should be abundant and homogenous in the sample. **Step 1: Thresholding.** The backgrou...
latools/D_obj.py
def autorange(self, analyte='total_counts', gwin=5, swin=3, win=30, on_mult=[1., 1.], off_mult=[1., 1.5], ploterrs=True, transform='log', **kwargs): """ Automatically separates signal and background data regions. Automatically detect signal and background reg...
def autorange(self, analyte='total_counts', gwin=5, swin=3, win=30, on_mult=[1., 1.], off_mult=[1., 1.5], ploterrs=True, transform='log', **kwargs): """ Automatically separates signal and background data regions. Automatically detect signal and background reg...
[ "Automatically", "separates", "signal", "and", "background", "data", "regions", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L248-L346
[ "def", "autorange", "(", "self", ",", "analyte", "=", "'total_counts'", ",", "gwin", "=", "5", ",", "swin", "=", "3", ",", "win", "=", "30", ",", "on_mult", "=", "[", "1.", ",", "1.", "]", ",", "off_mult", "=", "[", "1.", ",", "1.5", "]", ",", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.autorange_plot
Plot a detailed autorange report for this sample.
latools/D_obj.py
def autorange_plot(self, analyte='total_counts', gwin=7, swin=None, win=20, on_mult=[1.5, 1.], off_mult=[1., 1.5], transform='log'): """ Plot a detailed autorange report for this sample. """ if analyte is None: # sig = self.focus[...
def autorange_plot(self, analyte='total_counts', gwin=7, swin=None, win=20, on_mult=[1.5, 1.], off_mult=[1., 1.5], transform='log'): """ Plot a detailed autorange report for this sample. """ if analyte is None: # sig = self.focus[...
[ "Plot", "a", "detailed", "autorange", "report", "for", "this", "sample", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L348-L371
[ "def", "autorange_plot", "(", "self", ",", "analyte", "=", "'total_counts'", ",", "gwin", "=", "7", ",", "swin", "=", "None", ",", "win", "=", "20", ",", "on_mult", "=", "[", "1.5", ",", "1.", "]", ",", "off_mult", "=", "[", "1.", ",", "1.5", "]"...
cd25a650cfee318152f234d992708511f7047fbe
test
D.mkrngs
Transform boolean arrays into list of limit pairs. Gets Time limits of signal/background boolean arrays and stores them as sigrng and bkgrng arrays. These arrays can be saved by 'save_ranges' in the analyse object.
latools/D_obj.py
def mkrngs(self): """ Transform boolean arrays into list of limit pairs. Gets Time limits of signal/background boolean arrays and stores them as sigrng and bkgrng arrays. These arrays can be saved by 'save_ranges' in the analyse object. """ bbool = bool_2_indices...
def mkrngs(self): """ Transform boolean arrays into list of limit pairs. Gets Time limits of signal/background boolean arrays and stores them as sigrng and bkgrng arrays. These arrays can be saved by 'save_ranges' in the analyse object. """ bbool = bool_2_indices...
[ "Transform", "boolean", "arrays", "into", "list", "of", "limit", "pairs", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L373-L406
[ "def", "mkrngs", "(", "self", ")", ":", "bbool", "=", "bool_2_indices", "(", "self", ".", "bkg", ")", "if", "bbool", "is", "not", "None", ":", "self", ".", "bkgrng", "=", "self", ".", "Time", "[", "bbool", "]", "else", ":", "self", ".", "bkgrng", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.bkg_subtract
Subtract provided background from signal (focus stage). Results is saved in new 'bkgsub' focus stage Returns ------- None
latools/D_obj.py
def bkg_subtract(self, analyte, bkg, ind=None, focus_stage='despiked'): """ Subtract provided background from signal (focus stage). Results is saved in new 'bkgsub' focus stage Returns ------- None """ if 'bkgsub' not in self.data.keys(): sel...
def bkg_subtract(self, analyte, bkg, ind=None, focus_stage='despiked'): """ Subtract provided background from signal (focus stage). Results is saved in new 'bkgsub' focus stage Returns ------- None """ if 'bkgsub' not in self.data.keys(): sel...
[ "Subtract", "provided", "background", "from", "signal", "(", "focus", "stage", ")", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L409-L427
[ "def", "bkg_subtract", "(", "self", ",", "analyte", ",", "bkg", ",", "ind", "=", "None", ",", "focus_stage", "=", "'despiked'", ")", ":", "if", "'bkgsub'", "not", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "self", ".", "data", "[", "'bk...
cd25a650cfee318152f234d992708511f7047fbe
test
D.correct_spectral_interference
Correct spectral interference. Subtract interference counts from target_analyte, based on the intensity of a source_analayte and a known fractional contribution (f). Correction takes the form: target_analyte -= source_analyte * f Only operates on background-corrected data ('bk...
latools/D_obj.py
def correct_spectral_interference(self, target_analyte, source_analyte, f): """ Correct spectral interference. Subtract interference counts from target_analyte, based on the intensity of a source_analayte and a known fractional contribution (f). Correction takes the form: ...
def correct_spectral_interference(self, target_analyte, source_analyte, f): """ Correct spectral interference. Subtract interference counts from target_analyte, based on the intensity of a source_analayte and a known fractional contribution (f). Correction takes the form: ...
[ "Correct", "spectral", "interference", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L430-L467
[ "def", "correct_spectral_interference", "(", "self", ",", "target_analyte", ",", "source_analyte", ",", "f", ")", ":", "if", "target_analyte", "not", "in", "self", ".", "analytes", ":", "raise", "ValueError", "(", "'target_analyte: {:} not in available analytes ({:})'",...
cd25a650cfee318152f234d992708511f7047fbe
test
D.ratio
Divide all analytes by a specified internal_standard analyte. Parameters ---------- internal_standard : str The analyte used as the internal_standard. Returns ------- None
latools/D_obj.py
def ratio(self, internal_standard=None): """ Divide all analytes by a specified internal_standard analyte. Parameters ---------- internal_standard : str The analyte used as the internal_standard. Returns ------- None """ if in...
def ratio(self, internal_standard=None): """ Divide all analytes by a specified internal_standard analyte. Parameters ---------- internal_standard : str The analyte used as the internal_standard. Returns ------- None """ if in...
[ "Divide", "all", "analytes", "by", "a", "specified", "internal_standard", "analyte", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L470-L491
[ "def", "ratio", "(", "self", ",", "internal_standard", "=", "None", ")", ":", "if", "internal_standard", "is", "not", "None", ":", "self", ".", "internal_standard", "=", "internal_standard", "self", ".", "data", "[", "'ratios'", "]", "=", "Bunch", "(", ")"...
cd25a650cfee318152f234d992708511f7047fbe
test
D.calibrate
Apply calibration to data. The `calib_dict` must be calculated at the `analyse` level, and passed to this calibrate function. Parameters ---------- calib_dict : dict A dict of calibration values to apply to each analyte. Returns ------- None
latools/D_obj.py
def calibrate(self, calib_ps, analytes=None): """ Apply calibration to data. The `calib_dict` must be calculated at the `analyse` level, and passed to this calibrate function. Parameters ---------- calib_dict : dict A dict of calibration values to ap...
def calibrate(self, calib_ps, analytes=None): """ Apply calibration to data. The `calib_dict` must be calculated at the `analyse` level, and passed to this calibrate function. Parameters ---------- calib_dict : dict A dict of calibration values to ap...
[ "Apply", "calibration", "to", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L494-L532
[ "def", "calibrate", "(", "self", ",", "calib_ps", ",", "analytes", "=", "None", ")", ":", "# can have calibration function stored in self and pass *coefs?", "if", "analytes", "is", "None", ":", "analytes", "=", "self", ".", "analytes", "if", "'calibrated'", "not", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.sample_stats
Calculate sample statistics Returns samples, analytes, and arrays of statistics of shape (samples, analytes). Statistics are calculated from the 'focus' data variable, so output depends on how the data have been processed. Parameters ---------- analytes : array_...
latools/D_obj.py
def sample_stats(self, analytes=None, filt=True, stat_fns={}, eachtrace=True): """ Calculate sample statistics Returns samples, analytes, and arrays of statistics of shape (samples, analytes). Statistics are calculated from the 'focus' d...
def sample_stats(self, analytes=None, filt=True, stat_fns={}, eachtrace=True): """ Calculate sample statistics Returns samples, analytes, and arrays of statistics of shape (samples, analytes). Statistics are calculated from the 'focus' d...
[ "Calculate", "sample", "statistics" ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L536-L590
[ "def", "sample_stats", "(", "self", ",", "analytes", "=", "None", ",", "filt", "=", "True", ",", "stat_fns", "=", "{", "}", ",", "eachtrace", "=", "True", ")", ":", "if", "analytes", "is", "None", ":", "analytes", "=", "self", ".", "analytes", "elif"...
cd25a650cfee318152f234d992708511f7047fbe
test
D.ablation_times
Function for calculating the ablation time for each ablation. Returns ------- dict of times for each ablation.
latools/D_obj.py
def ablation_times(self): """ Function for calculating the ablation time for each ablation. Returns ------- dict of times for each ablation. """ ats = {} for n in np.arange(self.n) + 1: t = self.Time[self.ns == n] ats[n...
def ablation_times(self): """ Function for calculating the ablation time for each ablation. Returns ------- dict of times for each ablation. """ ats = {} for n in np.arange(self.n) + 1: t = self.Time[self.ns == n] ats[n...
[ "Function", "for", "calculating", "the", "ablation", "time", "for", "each", "ablation", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L593-L606
[ "def", "ablation_times", "(", "self", ")", ":", "ats", "=", "{", "}", "for", "n", "in", "np", ".", "arange", "(", "self", ".", "n", ")", "+", "1", ":", "t", "=", "self", ".", "Time", "[", "self", ".", "ns", "==", "n", "]", "ats", "[", "n", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.filter_threshold
Apply threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '_above' keeps all the data above the threshold. '_below' keeps all the data below the thresh...
latools/D_obj.py
def filter_threshold(self, analyte, threshold): """ Apply threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '_above' keeps all the data above the...
def filter_threshold(self, analyte, threshold): """ Apply threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '_above' keeps all the data above the...
[ "Apply", "threshold", "filter", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L610-L650
[ "def", "filter_threshold", "(", "self", ",", "analyte", ",", "threshold", ")", ":", "params", "=", "locals", "(", ")", "del", "(", "params", "[", "'self'", "]", ")", "# generate filter", "below", ",", "above", "=", "filters", ".", "threshold", "(", "self...
cd25a650cfee318152f234d992708511f7047fbe
test
D.filter_gradient_threshold
Apply gradient threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '_above' keeps all the data above the threshold. '_below' keeps all the data below t...
latools/D_obj.py
def filter_gradient_threshold(self, analyte, win, threshold, recalc=True): """ Apply gradient threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '...
def filter_gradient_threshold(self, analyte, win, threshold, recalc=True): """ Apply gradient threshold filter. Generates threshold filters for the given analytes above and below the specified threshold. Two filters are created with prefixes '_above' and '_below'. '...
[ "Apply", "gradient", "threshold", "filter", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L653-L702
[ "def", "filter_gradient_threshold", "(", "self", ",", "analyte", ",", "win", ",", "threshold", ",", "recalc", "=", "True", ")", ":", "params", "=", "locals", "(", ")", "del", "(", "params", "[", "'self'", "]", ")", "# calculate absolute gradient", "if", "r...
cd25a650cfee318152f234d992708511f7047fbe
test
D.filter_clustering
Applies an n - dimensional clustering filter to the data. Available Clustering Algorithms * 'meanshift': The `sklearn.cluster.MeanShift` algorithm. Automatically determines number of clusters in data based on the `bandwidth` of expected variation. * 'kmeans': The ...
latools/D_obj.py
def filter_clustering(self, analytes, filt=False, normalise=True, method='meanshift', include_time=False, sort=None, min_data=10, **kwargs): """ Applies an n - dimensional clustering filter to the data. Available Clustering Algorithms ...
def filter_clustering(self, analytes, filt=False, normalise=True, method='meanshift', include_time=False, sort=None, min_data=10, **kwargs): """ Applies an n - dimensional clustering filter to the data. Available Clustering Algorithms ...
[ "Applies", "an", "n", "-", "dimensional", "clustering", "filter", "to", "the", "data", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L705-L912
[ "def", "filter_clustering", "(", "self", ",", "analytes", ",", "filt", "=", "False", ",", "normalise", "=", "True", ",", "method", "=", "'meanshift'", ",", "include_time", "=", "False", ",", "sort", "=", "None", ",", "min_data", "=", "10", ",", "*", "*...
cd25a650cfee318152f234d992708511f7047fbe
test
D.calc_correlation
Calculate local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None The rolling window used when calculating the correlation. filt : bool Whether...
latools/D_obj.py
def calc_correlation(self, x_analyte, y_analyte, window=15, filt=True, recalc=True): """ Calculate local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None ...
def calc_correlation(self, x_analyte, y_analyte, window=15, filt=True, recalc=True): """ Calculate local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None ...
[ "Calculate", "local", "correlation", "between", "two", "analytes", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L915-L963
[ "def", "calc_correlation", "(", "self", ",", "x_analyte", ",", "y_analyte", ",", "window", "=", "15", ",", "filt", "=", "True", ",", "recalc", "=", "True", ")", ":", "label", "=", "'{:}_{:}_{:.0f}'", ".", "format", "(", "x_analyte", ",", "y_analyte", ","...
cd25a650cfee318152f234d992708511f7047fbe
test
D.filter_correlation
Calculate correlation filter. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None The rolling window used when calculating the correlation. r_threshold : float The correlation ind...
latools/D_obj.py
def filter_correlation(self, x_analyte, y_analyte, window=15, r_threshold=0.9, p_threshold=0.05, filt=True, recalc=False): """ Calculate correlation filter. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes ...
def filter_correlation(self, x_analyte, y_analyte, window=15, r_threshold=0.9, p_threshold=0.05, filt=True, recalc=False): """ Calculate correlation filter. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes ...
[ "Calculate", "correlation", "filter", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L966-L1021
[ "def", "filter_correlation", "(", "self", ",", "x_analyte", ",", "y_analyte", ",", "window", "=", "15", ",", "r_threshold", "=", "0.9", ",", "p_threshold", "=", "0.05", ",", "filt", "=", "True", ",", "recalc", "=", "False", ")", ":", "# make window odd", ...
cd25a650cfee318152f234d992708511f7047fbe
test
D.correlation_plot
Plot the local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None The rolling window used when calculating the correlation. filt : bool Whether ...
latools/D_obj.py
def correlation_plot(self, x_analyte, y_analyte, window=15, filt=True, recalc=False): """ Plot the local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None ...
def correlation_plot(self, x_analyte, y_analyte, window=15, filt=True, recalc=False): """ Plot the local correlation between two analytes. Parameters ---------- x_analyte, y_analyte : str The names of the x and y analytes to correlate. window : int, None ...
[ "Plot", "the", "local", "correlation", "between", "two", "analytes", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L1024-L1073
[ "def", "correlation_plot", "(", "self", ",", "x_analyte", ",", "y_analyte", ",", "window", "=", "15", ",", "filt", "=", "True", ",", "recalc", "=", "False", ")", ":", "label", "=", "'{:}_{:}_{:.0f}'", ".", "format", "(", "x_analyte", ",", "y_analyte", ",...
cd25a650cfee318152f234d992708511f7047fbe
test
D.filter_new
Make new filter from combination of other filters. Parameters ---------- name : str The name of the new filter. Should be unique. filt_str : str A logical combination of partial strings which will create the new filter. For example, 'Albelow & Mnbelow...
latools/D_obj.py
def filter_new(self, name, filt_str): """ Make new filter from combination of other filters. Parameters ---------- name : str The name of the new filter. Should be unique. filt_str : str A logical combination of partial strings which will create ...
def filter_new(self, name, filt_str): """ Make new filter from combination of other filters. Parameters ---------- name : str The name of the new filter. Should be unique. filt_str : str A logical combination of partial strings which will create ...
[ "Make", "new", "filter", "from", "combination", "of", "other", "filters", "." ]
oscarbranson/latools
python
https://github.com/oscarbranson/latools/blob/cd25a650cfee318152f234d992708511f7047fbe/latools/D_obj.py#L1076-L1096
[ "def", "filter_new", "(", "self", ",", "name", ",", "filt_str", ")", ":", "filt", "=", "self", ".", "filt", ".", "grab_filt", "(", "filt", "=", "filt_str", ")", "self", ".", "filt", ".", "add", "(", "name", ",", "filt", ",", "info", "=", "filt_str"...
cd25a650cfee318152f234d992708511f7047fbe