repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
btimby/fulltext
fulltext/data/winmake.py
rm
def rm(pattern): """Recursively remove a file or dir by pattern.""" paths = glob.glob(pattern) for path in paths: if path.startswith('.git/'): continue if os.path.isdir(path): def onerror(fun, path, excinfo): exc = excinfo[1] if exc.err...
python
def rm(pattern): """Recursively remove a file or dir by pattern.""" paths = glob.glob(pattern) for path in paths: if path.startswith('.git/'): continue if os.path.isdir(path): def onerror(fun, path, excinfo): exc = excinfo[1] if exc.err...
[ "def", "rm", "(", "pattern", ")", ":", "paths", "=", "glob", ".", "glob", "(", "pattern", ")", "for", "path", "in", "paths", ":", "if", "path", ".", "startswith", "(", "'.git/'", ")", ":", "continue", "if", "os", ".", "path", ".", "isdir", "(", "...
Recursively remove a file or dir by pattern.
[ "Recursively", "remove", "a", "file", "or", "dir", "by", "pattern", "." ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L106-L122
train
btimby/fulltext
fulltext/data/winmake.py
help
def help(): """Print this help""" safe_print('Run "make [-p <PYTHON>] <target>" where <target> is one of:') for name in sorted(_cmds): safe_print( " %-20s %s" % (name.replace('_', '-'), _cmds[name] or '')) sys.exit(1)
python
def help(): """Print this help""" safe_print('Run "make [-p <PYTHON>] <target>" where <target> is one of:') for name in sorted(_cmds): safe_print( " %-20s %s" % (name.replace('_', '-'), _cmds[name] or '')) sys.exit(1)
[ "def", "help", "(", ")", ":", "safe_print", "(", "'Run \"make [-p <PYTHON>] <target>\" where <target> is one of:'", ")", "for", "name", "in", "sorted", "(", "_cmds", ")", ":", "safe_print", "(", "\" %-20s %s\"", "%", "(", "name", ".", "replace", "(", "'_'", "...
Print this help
[ "Print", "this", "help" ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L149-L155
train
btimby/fulltext
fulltext/data/winmake.py
clean
def clean(): """Deletes dev files""" rm("$testfn*") rm("*.bak") rm("*.core") rm("*.egg-info") rm("*.orig") rm("*.pyc") rm("*.pyd") rm("*.pyo") rm("*.rej") rm("*.so") rm("*.~") rm("*__pycache__") rm(".coverage") rm(".tox") rm(".coverage") rm("build") ...
python
def clean(): """Deletes dev files""" rm("$testfn*") rm("*.bak") rm("*.core") rm("*.egg-info") rm("*.orig") rm("*.pyc") rm("*.pyd") rm("*.pyo") rm("*.rej") rm("*.so") rm("*.~") rm("*__pycache__") rm(".coverage") rm(".tox") rm(".coverage") rm("build") ...
[ "def", "clean", "(", ")", ":", "rm", "(", "\"$testfn*\"", ")", "rm", "(", "\"*.bak\"", ")", "rm", "(", "\"*.core\"", ")", "rm", "(", "\"*.egg-info\"", ")", "rm", "(", "\"*.orig\"", ")", "rm", "(", "\"*.pyc\"", ")", "rm", "(", "\"*.pyd\"", ")", "rm", ...
Deletes dev files
[ "Deletes", "dev", "files" ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L200-L222
train
btimby/fulltext
fulltext/data/winmake.py
lint
def lint(): """Run flake8 against all py files""" py_files = subprocess.check_output("git ls-files") if PY3: py_files = py_files.decode() py_files = [x for x in py_files.split() if x.endswith('.py')] py_files = ' '.join(py_files) sh("%s -m flake8 %s" % (PYTHON, py_files), nolog=True)
python
def lint(): """Run flake8 against all py files""" py_files = subprocess.check_output("git ls-files") if PY3: py_files = py_files.decode() py_files = [x for x in py_files.split() if x.endswith('.py')] py_files = ' '.join(py_files) sh("%s -m flake8 %s" % (PYTHON, py_files), nolog=True)
[ "def", "lint", "(", ")", ":", "py_files", "=", "subprocess", ".", "check_output", "(", "\"git ls-files\"", ")", "if", "PY3", ":", "py_files", "=", "py_files", ".", "decode", "(", ")", "py_files", "=", "[", "x", "for", "x", "in", "py_files", ".", "split...
Run flake8 against all py files
[ "Run", "flake8", "against", "all", "py", "files" ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L234-L241
train
btimby/fulltext
fulltext/data/winmake.py
coverage
def coverage(): """Run coverage tests.""" # Note: coverage options are controlled by .coveragerc file install() test_setup() sh("%s -m coverage run %s" % (PYTHON, TEST_SCRIPT)) sh("%s -m coverage report" % PYTHON) sh("%s -m coverage html" % PYTHON) sh("%s -m webbrowser -t htmlcov/index.h...
python
def coverage(): """Run coverage tests.""" # Note: coverage options are controlled by .coveragerc file install() test_setup() sh("%s -m coverage run %s" % (PYTHON, TEST_SCRIPT)) sh("%s -m coverage report" % PYTHON) sh("%s -m coverage html" % PYTHON) sh("%s -m webbrowser -t htmlcov/index.h...
[ "def", "coverage", "(", ")", ":", "# Note: coverage options are controlled by .coveragerc file", "install", "(", ")", "test_setup", "(", ")", "sh", "(", "\"%s -m coverage run %s\"", "%", "(", "PYTHON", ",", "TEST_SCRIPT", ")", ")", "sh", "(", "\"%s -m coverage report\...
Run coverage tests.
[ "Run", "coverage", "tests", "." ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L261-L269
train
btimby/fulltext
fulltext/data/winmake.py
venv
def venv(): """Install venv + deps.""" try: import virtualenv # NOQA except ImportError: sh("%s -m pip install virtualenv" % PYTHON) if not os.path.isdir("venv"): sh("%s -m virtualenv venv" % PYTHON) sh("venv\\Scripts\\pip install -r %s" % (REQUIREMENTS_TXT))
python
def venv(): """Install venv + deps.""" try: import virtualenv # NOQA except ImportError: sh("%s -m pip install virtualenv" % PYTHON) if not os.path.isdir("venv"): sh("%s -m virtualenv venv" % PYTHON) sh("venv\\Scripts\\pip install -r %s" % (REQUIREMENTS_TXT))
[ "def", "venv", "(", ")", ":", "try", ":", "import", "virtualenv", "# NOQA", "except", "ImportError", ":", "sh", "(", "\"%s -m pip install virtualenv\"", "%", "PYTHON", ")", "if", "not", "os", ".", "path", ".", "isdir", "(", "\"venv\"", ")", ":", "sh", "(...
Install venv + deps.
[ "Install", "venv", "+", "deps", "." ]
9234cc1e2099209430e20317649549026de283ce
https://github.com/btimby/fulltext/blob/9234cc1e2099209430e20317649549026de283ce/fulltext/data/winmake.py#L311-L319
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/kdbx4.py
compute_header_hmac_hash
def compute_header_hmac_hash(context): """Compute HMAC-SHA256 hash of header. Used to prevent header tampering.""" return hmac.new( hashlib.sha512( b'\xff' * 8 + hashlib.sha512( context._.header.value.dynamic_header.master_seed.data + context....
python
def compute_header_hmac_hash(context): """Compute HMAC-SHA256 hash of header. Used to prevent header tampering.""" return hmac.new( hashlib.sha512( b'\xff' * 8 + hashlib.sha512( context._.header.value.dynamic_header.master_seed.data + context....
[ "def", "compute_header_hmac_hash", "(", "context", ")", ":", "return", "hmac", ".", "new", "(", "hashlib", ".", "sha512", "(", "b'\\xff'", "*", "8", "+", "hashlib", ".", "sha512", "(", "context", ".", "_", ".", "header", ".", "value", ".", "dynamic_heade...
Compute HMAC-SHA256 hash of header. Used to prevent header tampering.
[ "Compute", "HMAC", "-", "SHA256", "hash", "of", "header", ".", "Used", "to", "prevent", "header", "tampering", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/kdbx4.py#L64-L79
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/kdbx4.py
compute_payload_block_hash
def compute_payload_block_hash(this): """Compute hash of each payload block. Used to prevent payload corruption and tampering.""" return hmac.new( hashlib.sha512( struct.pack('<Q', this._index) + hashlib.sha512( this._._.header.value.dynamic_header.master_see...
python
def compute_payload_block_hash(this): """Compute hash of each payload block. Used to prevent payload corruption and tampering.""" return hmac.new( hashlib.sha512( struct.pack('<Q', this._index) + hashlib.sha512( this._._.header.value.dynamic_header.master_see...
[ "def", "compute_payload_block_hash", "(", "this", ")", ":", "return", "hmac", ".", "new", "(", "hashlib", ".", "sha512", "(", "struct", ".", "pack", "(", "'<Q'", ",", "this", ".", "_index", ")", "+", "hashlib", ".", "sha512", "(", "this", ".", "_", "...
Compute hash of each payload block. Used to prevent payload corruption and tampering.
[ "Compute", "hash", "of", "each", "payload", "block", ".", "Used", "to", "prevent", "payload", "corruption", "and", "tampering", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/kdbx4.py#L156-L171
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/pytwofish.py
Twofish.decrypt
def decrypt(self, block): """Decrypt blocks.""" if len(block) % 16: raise ValueError("block size must be a multiple of 16") plaintext = b'' while block: a, b, c, d = struct.unpack("<4L", block[:16]) temp = [a, b, c, d] decrypt(self.conte...
python
def decrypt(self, block): """Decrypt blocks.""" if len(block) % 16: raise ValueError("block size must be a multiple of 16") plaintext = b'' while block: a, b, c, d = struct.unpack("<4L", block[:16]) temp = [a, b, c, d] decrypt(self.conte...
[ "def", "decrypt", "(", "self", ",", "block", ")", ":", "if", "len", "(", "block", ")", "%", "16", ":", "raise", "ValueError", "(", "\"block size must be a multiple of 16\"", ")", "plaintext", "=", "b''", "while", "block", ":", "a", ",", "b", ",", "c", ...
Decrypt blocks.
[ "Decrypt", "blocks", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/pytwofish.py#L81-L96
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/pytwofish.py
Twofish.encrypt
def encrypt(self, block): """Encrypt blocks.""" if len(block) % 16: raise ValueError("block size must be a multiple of 16") ciphertext = b'' while block: a, b, c, d = struct.unpack("<4L", block[0:16]) temp = [a, b, c, d] encrypt(self.con...
python
def encrypt(self, block): """Encrypt blocks.""" if len(block) % 16: raise ValueError("block size must be a multiple of 16") ciphertext = b'' while block: a, b, c, d = struct.unpack("<4L", block[0:16]) temp = [a, b, c, d] encrypt(self.con...
[ "def", "encrypt", "(", "self", ",", "block", ")", ":", "if", "len", "(", "block", ")", "%", "16", ":", "raise", "ValueError", "(", "\"block size must be a multiple of 16\"", ")", "ciphertext", "=", "b''", "while", "block", ":", "a", ",", "b", ",", "c", ...
Encrypt blocks.
[ "Encrypt", "blocks", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/pytwofish.py#L99-L114
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/common.py
aes_kdf
def aes_kdf(key, rounds, password=None, keyfile=None): """Set up a context for AES128-ECB encryption to find transformed_key""" cipher = AES.new(key, AES.MODE_ECB) key_composite = compute_key_composite( password=password, keyfile=keyfile ) # get the number of rounds from the header...
python
def aes_kdf(key, rounds, password=None, keyfile=None): """Set up a context for AES128-ECB encryption to find transformed_key""" cipher = AES.new(key, AES.MODE_ECB) key_composite = compute_key_composite( password=password, keyfile=keyfile ) # get the number of rounds from the header...
[ "def", "aes_kdf", "(", "key", ",", "rounds", ",", "password", "=", "None", ",", "keyfile", "=", "None", ")", ":", "cipher", "=", "AES", ".", "new", "(", "key", ",", "AES", ".", "MODE_ECB", ")", "key_composite", "=", "compute_key_composite", "(", "passw...
Set up a context for AES128-ECB encryption to find transformed_key
[ "Set", "up", "a", "context", "for", "AES128", "-", "ECB", "encryption", "to", "find", "transformed_key" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/common.py#L84-L98
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/common.py
compute_key_composite
def compute_key_composite(password=None, keyfile=None): """Compute composite key. Used in header verification and payload decryption.""" # hash the password if password: password_composite = hashlib.sha256(password.encode('utf-8')).digest() else: password_composite = b'' # hash ...
python
def compute_key_composite(password=None, keyfile=None): """Compute composite key. Used in header verification and payload decryption.""" # hash the password if password: password_composite = hashlib.sha256(password.encode('utf-8')).digest() else: password_composite = b'' # hash ...
[ "def", "compute_key_composite", "(", "password", "=", "None", ",", "keyfile", "=", "None", ")", ":", "# hash the password", "if", "password", ":", "password_composite", "=", "hashlib", ".", "sha256", "(", "password", ".", "encode", "(", "'utf-8'", ")", ")", ...
Compute composite key. Used in header verification and payload decryption.
[ "Compute", "composite", "key", ".", "Used", "in", "header", "verification", "and", "payload", "decryption", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/common.py#L101-L144
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/common.py
compute_master
def compute_master(context): """Computes master key from transformed key and master seed. Used in payload decryption.""" # combine the transformed key with the header master seed to find the master_key master_key = hashlib.sha256( context._.header.value.dynamic_header.master_seed.data + ...
python
def compute_master(context): """Computes master key from transformed key and master seed. Used in payload decryption.""" # combine the transformed key with the header master seed to find the master_key master_key = hashlib.sha256( context._.header.value.dynamic_header.master_seed.data + ...
[ "def", "compute_master", "(", "context", ")", ":", "# combine the transformed key with the header master seed to find the master_key", "master_key", "=", "hashlib", ".", "sha256", "(", "context", ".", "_", ".", "header", ".", "value", ".", "dynamic_header", ".", "master...
Computes master key from transformed key and master seed. Used in payload decryption.
[ "Computes", "master", "key", "from", "transformed", "key", "and", "master", "seed", ".", "Used", "in", "payload", "decryption", "." ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/common.py#L146-L154
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/common.py
Unprotect
def Unprotect(protected_stream_id, protected_stream_key, subcon): """Select stream cipher based on protected_stream_id""" return Switch( protected_stream_id, {'arcfourvariant': ARCFourVariantStream(protected_stream_key, subcon), 'salsa20': Salsa20Stream(protected_stream_key, subcon), ...
python
def Unprotect(protected_stream_id, protected_stream_key, subcon): """Select stream cipher based on protected_stream_id""" return Switch( protected_stream_id, {'arcfourvariant': ARCFourVariantStream(protected_stream_key, subcon), 'salsa20': Salsa20Stream(protected_stream_key, subcon), ...
[ "def", "Unprotect", "(", "protected_stream_id", ",", "protected_stream_key", ",", "subcon", ")", ":", "return", "Switch", "(", "protected_stream_id", ",", "{", "'arcfourvariant'", ":", "ARCFourVariantStream", "(", "protected_stream_key", ",", "subcon", ")", ",", "'s...
Select stream cipher based on protected_stream_id
[ "Select", "stream", "cipher", "based", "on", "protected_stream_id" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/common.py#L231-L241
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/twofish.py
BlockCipher.encrypt
def encrypt(self,plaintext,n=''): """Encrypt some plaintext plaintext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The encrypt function will encrypt the supplied plaintext. The behavior varies slightly depending on the chaini...
python
def encrypt(self,plaintext,n=''): """Encrypt some plaintext plaintext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The encrypt function will encrypt the supplied plaintext. The behavior varies slightly depending on the chaini...
[ "def", "encrypt", "(", "self", ",", "plaintext", ",", "n", "=", "''", ")", ":", "#self.ed = 'e' if chain is encrypting, 'd' if decrypting,", "# None if nothing happened with the chain yet", "#assert self.ed in ('e',None) ", "# makes sure you don't encrypt with a cipher that has started...
Encrypt some plaintext plaintext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The encrypt function will encrypt the supplied plaintext. The behavior varies slightly depending on the chaining mode. ECB, CBC: ---------...
[ "Encrypt", "some", "plaintext" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/twofish.py#L114-L159
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/twofish.py
BlockCipher.decrypt
def decrypt(self,ciphertext,n=''): """Decrypt some ciphertext ciphertext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The decrypt function will decrypt the supplied ciphertext. The behavior varies slightly depending on the cha...
python
def decrypt(self,ciphertext,n=''): """Decrypt some ciphertext ciphertext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The decrypt function will decrypt the supplied ciphertext. The behavior varies slightly depending on the cha...
[ "def", "decrypt", "(", "self", ",", "ciphertext", ",", "n", "=", "''", ")", ":", "#self.ed = 'e' if chain is encrypting, 'd' if decrypting,", "# None if nothing happened with the chain yet", "#assert self.ed in ('d',None)", "# makes sure you don't decrypt with a cipher that has started...
Decrypt some ciphertext ciphertext = a string of binary data n = the 'tweak' value when the chaining mode is XTS The decrypt function will decrypt the supplied ciphertext. The behavior varies slightly depending on the chaining mode. ECB, CBC: -------...
[ "Decrypt", "some", "ciphertext" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/twofish.py#L161-L204
train
pschmitt/pykeepass
pykeepass/kdbx_parsing/twofish.py
BlockCipher.final
def final(self,style='pkcs7'): # TODO: after calling final, reset the IV? so the cipher is as good as new? """Finalizes the encryption by padding the cache padfct = padding function import from CryptoPlus.Util.padding For ECB, CBC: the remaining bytes in the ca...
python
def final(self,style='pkcs7'): # TODO: after calling final, reset the IV? so the cipher is as good as new? """Finalizes the encryption by padding the cache padfct = padding function import from CryptoPlus.Util.padding For ECB, CBC: the remaining bytes in the ca...
[ "def", "final", "(", "self", ",", "style", "=", "'pkcs7'", ")", ":", "# TODO: after calling final, reset the IV? so the cipher is as good as new?", "assert", "self", ".", "mode", "not", "in", "(", "MODE_XTS", ",", "MODE_CMAC", ")", "# finalizing (=padding) doesn't make se...
Finalizes the encryption by padding the cache padfct = padding function import from CryptoPlus.Util.padding For ECB, CBC: the remaining bytes in the cache will be padded and encrypted. For OFB,CFB, CTR: an encrypted padding will be returned, makin...
[ "Finalizes", "the", "encryption", "by", "padding", "the", "cache" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/kdbx_parsing/twofish.py#L206-L237
train
pschmitt/pykeepass
pykeepass/baseelement.py
BaseElement._datetime_to_utc
def _datetime_to_utc(self, dt): """Convert naive datetimes to UTC""" if not dt.tzinfo: dt = dt.replace(tzinfo=tz.gettz()) return dt.astimezone(tz.gettz('UTC'))
python
def _datetime_to_utc(self, dt): """Convert naive datetimes to UTC""" if not dt.tzinfo: dt = dt.replace(tzinfo=tz.gettz()) return dt.astimezone(tz.gettz('UTC'))
[ "def", "_datetime_to_utc", "(", "self", ",", "dt", ")", ":", "if", "not", "dt", ".", "tzinfo", ":", "dt", "=", "dt", ".", "replace", "(", "tzinfo", "=", "tz", ".", "gettz", "(", ")", ")", "return", "dt", ".", "astimezone", "(", "tz", ".", "gettz"...
Convert naive datetimes to UTC
[ "Convert", "naive", "datetimes", "to", "UTC" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/baseelement.py#L92-L97
train
pschmitt/pykeepass
pykeepass/baseelement.py
BaseElement._encode_time
def _encode_time(self, value): """Convert datetime to base64 or plaintext string""" if self._kp.version >= (4, 0): diff_seconds = int( ( self._datetime_to_utc(value) - datetime( year=1, m...
python
def _encode_time(self, value): """Convert datetime to base64 or plaintext string""" if self._kp.version >= (4, 0): diff_seconds = int( ( self._datetime_to_utc(value) - datetime( year=1, m...
[ "def", "_encode_time", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_kp", ".", "version", ">=", "(", "4", ",", "0", ")", ":", "diff_seconds", "=", "int", "(", "(", "self", ".", "_datetime_to_utc", "(", "value", ")", "-", "datetime", "("...
Convert datetime to base64 or plaintext string
[ "Convert", "datetime", "to", "base64", "or", "plaintext", "string" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/baseelement.py#L99-L118
train
pschmitt/pykeepass
pykeepass/baseelement.py
BaseElement._decode_time
def _decode_time(self, text): """Convert base64 time or plaintext time to datetime""" if self._kp.version >= (4, 0): # decode KDBX4 date from b64 format try: return ( datetime(year=1, month=1, day=1, tzinfo=tz.gettz('UTC')) + ...
python
def _decode_time(self, text): """Convert base64 time or plaintext time to datetime""" if self._kp.version >= (4, 0): # decode KDBX4 date from b64 format try: return ( datetime(year=1, month=1, day=1, tzinfo=tz.gettz('UTC')) + ...
[ "def", "_decode_time", "(", "self", ",", "text", ")", ":", "if", "self", ".", "_kp", ".", "version", ">=", "(", "4", ",", "0", ")", ":", "# decode KDBX4 date from b64 format", "try", ":", "return", "(", "datetime", "(", "year", "=", "1", ",", "month", ...
Convert base64 time or plaintext time to datetime
[ "Convert", "base64", "time", "or", "plaintext", "time", "to", "datetime" ]
85da3630d6e410b2a10d3e711cd69308b51d401d
https://github.com/pschmitt/pykeepass/blob/85da3630d6e410b2a10d3e711cd69308b51d401d/pykeepass/baseelement.py#L120-L141
train
thunder-project/thunder
thunder/images/readers.py
fromrdd
def fromrdd(rdd, dims=None, nrecords=None, dtype=None, labels=None, ordered=False): """ Load images from a Spark RDD. Input RDD must be a collection of key-value pairs where keys are singleton tuples indexing images, and values are 2d or 3d ndarrays. Parameters ---------- rdd : SparkRD...
python
def fromrdd(rdd, dims=None, nrecords=None, dtype=None, labels=None, ordered=False): """ Load images from a Spark RDD. Input RDD must be a collection of key-value pairs where keys are singleton tuples indexing images, and values are 2d or 3d ndarrays. Parameters ---------- rdd : SparkRD...
[ "def", "fromrdd", "(", "rdd", ",", "dims", "=", "None", ",", "nrecords", "=", "None", ",", "dtype", "=", "None", ",", "labels", "=", "None", ",", "ordered", "=", "False", ")", ":", "from", ".", "images", "import", "Images", "from", "bolt", ".", "sp...
Load images from a Spark RDD. Input RDD must be a collection of key-value pairs where keys are singleton tuples indexing images, and values are 2d or 3d ndarrays. Parameters ---------- rdd : SparkRDD An RDD containing the images. dims : tuple or array, optional, default = None ...
[ "Load", "images", "from", "a", "Spark", "RDD", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L10-L56
train
thunder-project/thunder
thunder/images/readers.py
fromarray
def fromarray(values, labels=None, npartitions=None, engine=None): """ Load images from an array. First dimension will be used to index images, so remaining dimensions after the first should be the dimensions of the images, e.g. (3, 100, 200) for 3 x (100, 200) images Parameters ------...
python
def fromarray(values, labels=None, npartitions=None, engine=None): """ Load images from an array. First dimension will be used to index images, so remaining dimensions after the first should be the dimensions of the images, e.g. (3, 100, 200) for 3 x (100, 200) images Parameters ------...
[ "def", "fromarray", "(", "values", ",", "labels", "=", "None", ",", "npartitions", "=", "None", ",", "engine", "=", "None", ")", ":", "from", ".", "images", "import", "Images", "import", "bolt", "if", "isinstance", "(", "values", ",", "bolt", ".", "spa...
Load images from an array. First dimension will be used to index images, so remaining dimensions after the first should be the dimensions of the images, e.g. (3, 100, 200) for 3 x (100, 200) images Parameters ---------- values : array-like The array of images. Can be a numpy array,...
[ "Load", "images", "from", "an", "array", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L58-L116
train
thunder-project/thunder
thunder/images/readers.py
fromlist
def fromlist(items, accessor=None, keys=None, dims=None, dtype=None, labels=None, npartitions=None, engine=None): """ Load images from a list of items using the given accessor. Parameters ---------- accessor : function Apply to each item from the list to yield an image. keys : list, op...
python
def fromlist(items, accessor=None, keys=None, dims=None, dtype=None, labels=None, npartitions=None, engine=None): """ Load images from a list of items using the given accessor. Parameters ---------- accessor : function Apply to each item from the list to yield an image. keys : list, op...
[ "def", "fromlist", "(", "items", ",", "accessor", "=", "None", ",", "keys", "=", "None", ",", "dims", "=", "None", ",", "dtype", "=", "None", ",", "labels", "=", "None", ",", "npartitions", "=", "None", ",", "engine", "=", "None", ")", ":", "if", ...
Load images from a list of items using the given accessor. Parameters ---------- accessor : function Apply to each item from the list to yield an image. keys : list, optional, default=None An optional list of keys. dims : tuple, optional, default=None Specify a known image...
[ "Load", "images", "from", "a", "list", "of", "items", "using", "the", "given", "accessor", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L119-L157
train
thunder-project/thunder
thunder/images/readers.py
frompath
def frompath(path, accessor=None, ext=None, start=None, stop=None, recursive=False, npartitions=None, dims=None, dtype=None, labels=None, recount=False, engine=None, credentials=None): """ Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ----...
python
def frompath(path, accessor=None, ext=None, start=None, stop=None, recursive=False, npartitions=None, dims=None, dtype=None, labels=None, recount=False, engine=None, credentials=None): """ Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ----...
[ "def", "frompath", "(", "path", ",", "accessor", "=", "None", ",", "ext", "=", "None", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "recursive", "=", "False", ",", "npartitions", "=", "None", ",", "dims", "=", "None", ",", "dtype", "="...
Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ---------- accessor : function Apply to each item after loading to yield an image. ext : str, optional, default=None File extension. npartitions : int, optional, default=N...
[ "Load", "images", "from", "a", "path", "using", "the", "given", "accessor", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L159-L221
train
thunder-project/thunder
thunder/images/readers.py
fromtif
def fromtif(path, ext='tif', start=None, stop=None, recursive=False, nplanes=None, npartitions=None, labels=None, engine=None, credentials=None, discard_extra=False): """ Loads images from single or multi-page TIF files. Parameters ---------- path : str Path to data files or directory, spec...
python
def fromtif(path, ext='tif', start=None, stop=None, recursive=False, nplanes=None, npartitions=None, labels=None, engine=None, credentials=None, discard_extra=False): """ Loads images from single or multi-page TIF files. Parameters ---------- path : str Path to data files or directory, spec...
[ "def", "fromtif", "(", "path", ",", "ext", "=", "'tif'", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "recursive", "=", "False", ",", "nplanes", "=", "None", ",", "npartitions", "=", "None", ",", "labels", "=", "None", ",", "engine", "...
Loads images from single or multi-page TIF files. Parameters ---------- path : str Path to data files or directory, specified as either a local filesystem path or in a URI-like format, including scheme. May include a single '*' wildcard character. ext : string, optional, default = 'tif...
[ "Loads", "images", "from", "single", "or", "multi", "-", "page", "TIF", "files", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L323-L397
train
thunder-project/thunder
thunder/images/readers.py
frompng
def frompng(path, ext='png', start=None, stop=None, recursive=False, npartitions=None, labels=None, engine=None, credentials=None): """ Load images from PNG files. Parameters ---------- path : str Path to data files or directory, specified as either a local filesystem path or in a U...
python
def frompng(path, ext='png', start=None, stop=None, recursive=False, npartitions=None, labels=None, engine=None, credentials=None): """ Load images from PNG files. Parameters ---------- path : str Path to data files or directory, specified as either a local filesystem path or in a U...
[ "def", "frompng", "(", "path", ",", "ext", "=", "'png'", ",", "start", "=", "None", ",", "stop", "=", "None", ",", "recursive", "=", "False", ",", "npartitions", "=", "None", ",", "labels", "=", "None", ",", "engine", "=", "None", ",", "credentials",...
Load images from PNG files. Parameters ---------- path : str Path to data files or directory, specified as either a local filesystem path or in a URI-like format, including scheme. May include a single '*' wildcard character. ext : string, optional, default = 'tif' Extension re...
[ "Load", "images", "from", "PNG", "files", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L399-L436
train
thunder-project/thunder
thunder/images/readers.py
fromrandom
def fromrandom(shape=(10, 50, 50), npartitions=1, seed=42, engine=None): """ Generate random image data. Parameters ---------- shape : tuple, optional, default=(10, 50, 50) Dimensions of images. npartitions : int, optional, default=1 Number of partitions. seed : int, optio...
python
def fromrandom(shape=(10, 50, 50), npartitions=1, seed=42, engine=None): """ Generate random image data. Parameters ---------- shape : tuple, optional, default=(10, 50, 50) Dimensions of images. npartitions : int, optional, default=1 Number of partitions. seed : int, optio...
[ "def", "fromrandom", "(", "shape", "=", "(", "10", ",", "50", ",", "50", ")", ",", "npartitions", "=", "1", ",", "seed", "=", "42", ",", "engine", "=", "None", ")", ":", "seed", "=", "hash", "(", "seed", ")", "def", "generate", "(", "v", ")", ...
Generate random image data. Parameters ---------- shape : tuple, optional, default=(10, 50, 50) Dimensions of images. npartitions : int, optional, default=1 Number of partitions. seed : int, optional, default=42 Random seed.
[ "Generate", "random", "image", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L438-L459
train
thunder-project/thunder
thunder/images/readers.py
fromexample
def fromexample(name=None, engine=None): """ Load example image data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, if not specified will print options. engine : object, default = None Computa...
python
def fromexample(name=None, engine=None): """ Load example image data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, if not specified will print options. engine : object, default = None Computa...
[ "def", "fromexample", "(", "name", "=", "None", ",", "engine", "=", "None", ")", ":", "datasets", "=", "[", "'mouse'", ",", "'fish'", "]", "if", "name", "is", "None", ":", "print", "(", "'Availiable example image datasets'", ")", "for", "d", "in", "datas...
Load example image data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, if not specified will print options. engine : object, default = None Computational engine (e.g. a SparkContext for Spark)
[ "Load", "example", "image", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/readers.py#L461-L497
train
thunder-project/thunder
thunder/blocks/local.py
LocalChunks.unchunk
def unchunk(self): """ Reconstitute the chunked array back into a full ndarray. Returns ------- ndarray """ if self.padding != len(self.shape)*(0,): shape = self.values.shape arr = empty(shape, dtype=object) for inds in product...
python
def unchunk(self): """ Reconstitute the chunked array back into a full ndarray. Returns ------- ndarray """ if self.padding != len(self.shape)*(0,): shape = self.values.shape arr = empty(shape, dtype=object) for inds in product...
[ "def", "unchunk", "(", "self", ")", ":", "if", "self", ".", "padding", "!=", "len", "(", "self", ".", "shape", ")", "*", "(", "0", ",", ")", ":", "shape", "=", "self", ".", "values", ".", "shape", "arr", "=", "empty", "(", "shape", ",", "dtype"...
Reconstitute the chunked array back into a full ndarray. Returns ------- ndarray
[ "Reconstitute", "the", "chunked", "array", "back", "into", "a", "full", "ndarray", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/local.py#L54-L75
train
thunder-project/thunder
thunder/blocks/local.py
LocalChunks.chunk
def chunk(arr, chunk_size="150", padding=None): """ Created a chunked array from a full array and a chunk size. Parameters ---------- array : ndarray Array that will be broken into chunks chunk_size : string or tuple, default = '150' Size of each...
python
def chunk(arr, chunk_size="150", padding=None): """ Created a chunked array from a full array and a chunk size. Parameters ---------- array : ndarray Array that will be broken into chunks chunk_size : string or tuple, default = '150' Size of each...
[ "def", "chunk", "(", "arr", ",", "chunk_size", "=", "\"150\"", ",", "padding", "=", "None", ")", ":", "plan", ",", "_", "=", "LocalChunks", ".", "getplan", "(", "chunk_size", ",", "arr", ".", "shape", "[", "1", ":", "]", ",", "arr", ".", "dtype", ...
Created a chunked array from a full array and a chunk size. Parameters ---------- array : ndarray Array that will be broken into chunks chunk_size : string or tuple, default = '150' Size of each image chunk. If a str, size of memory footprint in KB. ...
[ "Created", "a", "chunked", "array", "from", "a", "full", "array", "and", "a", "chunk", "size", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/local.py#L121-L178
train
thunder-project/thunder
thunder/base.py
Data.filter
def filter(self, func): """ Filter array along an axis. Applies a function which should evaluate to boolean, along a single axis or multiple axes. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Param...
python
def filter(self, func): """ Filter array along an axis. Applies a function which should evaluate to boolean, along a single axis or multiple axes. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Param...
[ "def", "filter", "(", "self", ",", "func", ")", ":", "if", "self", ".", "mode", "==", "'local'", ":", "reshaped", "=", "self", ".", "_align", "(", "self", ".", "baseaxes", ")", "filtered", "=", "asarray", "(", "list", "(", "filter", "(", "func", ",...
Filter array along an axis. Applies a function which should evaluate to boolean, along a single axis or multiple axes. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- func : func...
[ "Filter", "array", "along", "an", "axis", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/base.py#L372-L410
train
thunder-project/thunder
thunder/base.py
Data.map
def map(self, func, value_shape=None, dtype=None, with_keys=False): """ Apply an array -> array function across an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- func : fu...
python
def map(self, func, value_shape=None, dtype=None, with_keys=False): """ Apply an array -> array function across an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- func : fu...
[ "def", "map", "(", "self", ",", "func", ",", "value_shape", "=", "None", ",", "dtype", "=", "None", ",", "with_keys", "=", "False", ")", ":", "axis", "=", "self", ".", "baseaxes", "if", "self", ".", "mode", "==", "'local'", ":", "axes", "=", "sorte...
Apply an array -> array function across an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- func : function Function of a single array to apply. If with_keys=True, f...
[ "Apply", "an", "array", "-", ">", "array", "function", "across", "an", "axis", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/base.py#L412-L469
train
thunder-project/thunder
thunder/base.py
Data._reduce
def _reduce(self, func, axis=0): """ Reduce an array along an axis. Applies an associative/commutative function of two arguments cumulatively to all arrays along an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose...
python
def _reduce(self, func, axis=0): """ Reduce an array along an axis. Applies an associative/commutative function of two arguments cumulatively to all arrays along an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose...
[ "def", "_reduce", "(", "self", ",", "func", ",", "axis", "=", "0", ")", ":", "if", "self", ".", "mode", "==", "'local'", ":", "axes", "=", "sorted", "(", "tupleize", "(", "axis", ")", ")", "# if the function is a ufunc, it can automatically handle reducing ove...
Reduce an array along an axis. Applies an associative/commutative function of two arguments cumulatively to all arrays along an axis. Array will be aligned so that the desired set of axes are in the keys, which may require a transpose/reshape. Parameters ---------- ...
[ "Reduce", "an", "array", "along", "an", "axis", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/base.py#L471-L508
train
thunder-project/thunder
thunder/base.py
Data.element_wise
def element_wise(self, other, op): """ Apply an elementwise operation to data. Both self and other data must have the same mode. If self is in local mode, other can also be a numpy array. Self and other must have the same shape, or other must be a scalar. Parameters ...
python
def element_wise(self, other, op): """ Apply an elementwise operation to data. Both self and other data must have the same mode. If self is in local mode, other can also be a numpy array. Self and other must have the same shape, or other must be a scalar. Parameters ...
[ "def", "element_wise", "(", "self", ",", "other", ",", "op", ")", ":", "if", "not", "isscalar", "(", "other", ")", "and", "not", "self", ".", "shape", "==", "other", ".", "shape", ":", "raise", "ValueError", "(", "\"shapes %s and %s must be equal\"", "%", ...
Apply an elementwise operation to data. Both self and other data must have the same mode. If self is in local mode, other can also be a numpy array. Self and other must have the same shape, or other must be a scalar. Parameters ---------- other : Data or numpy array ...
[ "Apply", "an", "elementwise", "operation", "to", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/base.py#L510-L549
train
thunder-project/thunder
thunder/base.py
Data.clip
def clip(self, min=None, max=None): """ Clip values above and below. Parameters ---------- min : scalar or array-like Minimum value. If array, will be broadcasted max : scalar or array-like Maximum value. If array, will be broadcasted. ""...
python
def clip(self, min=None, max=None): """ Clip values above and below. Parameters ---------- min : scalar or array-like Minimum value. If array, will be broadcasted max : scalar or array-like Maximum value. If array, will be broadcasted. ""...
[ "def", "clip", "(", "self", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "clip", "(", "min", "=", "min", ",", "max", "=", "max", ")", ")", ".", "__finalize__",...
Clip values above and below. Parameters ---------- min : scalar or array-like Minimum value. If array, will be broadcasted max : scalar or array-like Maximum value. If array, will be broadcasted.
[ "Clip", "values", "above", "and", "below", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/base.py#L575-L588
train
thunder-project/thunder
thunder/series/readers.py
fromrdd
def fromrdd(rdd, nrecords=None, shape=None, index=None, labels=None, dtype=None, ordered=False): """ Load series data from a Spark RDD. Assumes keys are tuples with increasing and unique indices, and values are 1d ndarrays. Will try to infer properties that are not explicitly provided. Paramet...
python
def fromrdd(rdd, nrecords=None, shape=None, index=None, labels=None, dtype=None, ordered=False): """ Load series data from a Spark RDD. Assumes keys are tuples with increasing and unique indices, and values are 1d ndarrays. Will try to infer properties that are not explicitly provided. Paramet...
[ "def", "fromrdd", "(", "rdd", ",", "nrecords", "=", "None", ",", "shape", "=", "None", ",", "index", "=", "None", ",", "labels", "=", "None", ",", "dtype", "=", "None", ",", "ordered", "=", "False", ")", ":", "from", ".", "series", "import", "Serie...
Load series data from a Spark RDD. Assumes keys are tuples with increasing and unique indices, and values are 1d ndarrays. Will try to infer properties that are not explicitly provided. Parameters ---------- rdd : SparkRDD An RDD containing series data. shape : tuple or array, opt...
[ "Load", "series", "data", "from", "a", "Spark", "RDD", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L13-L72
train
thunder-project/thunder
thunder/series/readers.py
fromarray
def fromarray(values, index=None, labels=None, npartitions=None, engine=None): """ Load series data from an array. Assumes that all but final dimension index the records, and the size of the final dimension is the length of each record, e.g. a (2, 3, 4) array will be treated as 2 x 3 records of siz...
python
def fromarray(values, index=None, labels=None, npartitions=None, engine=None): """ Load series data from an array. Assumes that all but final dimension index the records, and the size of the final dimension is the length of each record, e.g. a (2, 3, 4) array will be treated as 2 x 3 records of siz...
[ "def", "fromarray", "(", "values", ",", "index", "=", "None", ",", "labels", "=", "None", ",", "npartitions", "=", "None", ",", "engine", "=", "None", ")", ":", "from", ".", "series", "import", "Series", "import", "bolt", "if", "isinstance", "(", "valu...
Load series data from an array. Assumes that all but final dimension index the records, and the size of the final dimension is the length of each record, e.g. a (2, 3, 4) array will be treated as 2 x 3 records of size (4,) Parameters ---------- values : array-like An array containing t...
[ "Load", "series", "data", "from", "an", "array", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L74-L124
train
thunder-project/thunder
thunder/series/readers.py
fromlist
def fromlist(items, accessor=None, index=None, labels=None, dtype=None, npartitions=None, engine=None): """ Load series data from a list with an optional accessor function. Will call accessor function on each item from the list, providing a generic interface for data loading. Parameters ------...
python
def fromlist(items, accessor=None, index=None, labels=None, dtype=None, npartitions=None, engine=None): """ Load series data from a list with an optional accessor function. Will call accessor function on each item from the list, providing a generic interface for data loading. Parameters ------...
[ "def", "fromlist", "(", "items", ",", "accessor", "=", "None", ",", "index", "=", "None", ",", "labels", "=", "None", ",", "dtype", "=", "None", ",", "npartitions", "=", "None", ",", "engine", "=", "None", ")", ":", "if", "spark", "and", "isinstance"...
Load series data from a list with an optional accessor function. Will call accessor function on each item from the list, providing a generic interface for data loading. Parameters ---------- items : list A list of items to load. accessor : function, optional, default = None A ...
[ "Load", "series", "data", "from", "a", "list", "with", "an", "optional", "accessor", "function", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L126-L173
train
thunder-project/thunder
thunder/series/readers.py
fromtext
def fromtext(path, ext='txt', dtype='float64', skip=0, shape=None, index=None, labels=None, npartitions=None, engine=None, credentials=None): """ Loads series data from text files. Assumes data are formatted as rows, where each record is a row of numbers separated by spaces e.g. 'v v v v v'. You can ...
python
def fromtext(path, ext='txt', dtype='float64', skip=0, shape=None, index=None, labels=None, npartitions=None, engine=None, credentials=None): """ Loads series data from text files. Assumes data are formatted as rows, where each record is a row of numbers separated by spaces e.g. 'v v v v v'. You can ...
[ "def", "fromtext", "(", "path", ",", "ext", "=", "'txt'", ",", "dtype", "=", "'float64'", ",", "skip", "=", "0", ",", "shape", "=", "None", ",", "index", "=", "None", ",", "labels", "=", "None", ",", "npartitions", "=", "None", ",", "engine", "=", ...
Loads series data from text files. Assumes data are formatted as rows, where each record is a row of numbers separated by spaces e.g. 'v v v v v'. You can optionally specify a fixed number of initial items per row to skip / discard. Parameters ---------- path : string Directory to load...
[ "Loads", "series", "data", "from", "text", "files", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L175-L252
train
thunder-project/thunder
thunder/series/readers.py
frombinary
def frombinary(path, ext='bin', conf='conf.json', dtype=None, shape=None, skip=0, index=None, labels=None, engine=None, credentials=None): """ Load series data from flat binary files. Parameters ---------- path : string URI or local filesystem path Directory to load from, can be a URI strin...
python
def frombinary(path, ext='bin', conf='conf.json', dtype=None, shape=None, skip=0, index=None, labels=None, engine=None, credentials=None): """ Load series data from flat binary files. Parameters ---------- path : string URI or local filesystem path Directory to load from, can be a URI strin...
[ "def", "frombinary", "(", "path", ",", "ext", "=", "'bin'", ",", "conf", "=", "'conf.json'", ",", "dtype", "=", "None", ",", "shape", "=", "None", ",", "skip", "=", "0", ",", "index", "=", "None", ",", "labels", "=", "None", ",", "engine", "=", "...
Load series data from flat binary files. Parameters ---------- path : string URI or local filesystem path Directory to load from, can be a URI string with scheme (e.g. 'file://', 's3n://', or 'gs://'), or a single file, or a directory, or a directory with a single wildcard character...
[ "Load", "series", "data", "from", "flat", "binary", "files", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L254-L342
train
thunder-project/thunder
thunder/series/readers.py
_binaryconfig
def _binaryconfig(path, conf, dtype=None, shape=None, credentials=None): """ Collects parameters to use for binary series loading. """ import json from thunder.readers import get_file_reader, FileNotFoundError reader = get_file_reader(path)(credentials=credentials) try: buf = reader...
python
def _binaryconfig(path, conf, dtype=None, shape=None, credentials=None): """ Collects parameters to use for binary series loading. """ import json from thunder.readers import get_file_reader, FileNotFoundError reader = get_file_reader(path)(credentials=credentials) try: buf = reader...
[ "def", "_binaryconfig", "(", "path", ",", "conf", ",", "dtype", "=", "None", ",", "shape", "=", "None", ",", "credentials", "=", "None", ")", ":", "import", "json", "from", "thunder", ".", "readers", "import", "get_file_reader", ",", "FileNotFoundError", "...
Collects parameters to use for binary series loading.
[ "Collects", "parameters", "to", "use", "for", "binary", "series", "loading", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L344-L370
train
thunder-project/thunder
thunder/series/readers.py
fromexample
def fromexample(name=None, engine=None): """ Load example series data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, options include 'iris' | 'mouse' | 'fish'. If not specified will print options. ...
python
def fromexample(name=None, engine=None): """ Load example series data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, options include 'iris' | 'mouse' | 'fish'. If not specified will print options. ...
[ "def", "fromexample", "(", "name", "=", "None", ",", "engine", "=", "None", ")", ":", "import", "os", "import", "tempfile", "import", "shutil", "from", "boto", ".", "s3", ".", "connection", "import", "S3Connection", "datasets", "=", "[", "'iris'", ",", "...
Load example series data. Data are downloaded from S3, so this method requires an internet connection. Parameters ---------- name : str Name of dataset, options include 'iris' | 'mouse' | 'fish'. If not specified will print options. engine : object, default = None Computat...
[ "Load", "example", "series", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/readers.py#L398-L447
train
thunder-project/thunder
thunder/series/writers.py
tobinary
def tobinary(series, path, prefix='series', overwrite=False, credentials=None): """ Writes out data to binary format. Parameters ---------- series : Series The data to write path : string path or URI to directory to be created Output files will be written underneath path. ...
python
def tobinary(series, path, prefix='series', overwrite=False, credentials=None): """ Writes out data to binary format. Parameters ---------- series : Series The data to write path : string path or URI to directory to be created Output files will be written underneath path. ...
[ "def", "tobinary", "(", "series", ",", "path", ",", "prefix", "=", "'series'", ",", "overwrite", "=", "False", ",", "credentials", "=", "None", ")", ":", "from", "six", "import", "BytesIO", "from", "thunder", ".", "utils", "import", "check_path", "from", ...
Writes out data to binary format. Parameters ---------- series : Series The data to write path : string path or URI to directory to be created Output files will be written underneath path. Directory will be created as a result of this call. prefix : str, optional, default ...
[ "Writes", "out", "data", "to", "binary", "format", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/writers.py#L3-L65
train
thunder-project/thunder
thunder/series/writers.py
write_config
def write_config(path, shape=None, dtype=None, name="conf.json", overwrite=True, credentials=None): """ Write a conf.json file with required information to load Series binary data. """ import json from thunder.writers import get_file_writer writer = get_file_writer(path) conf = {'shape': sh...
python
def write_config(path, shape=None, dtype=None, name="conf.json", overwrite=True, credentials=None): """ Write a conf.json file with required information to load Series binary data. """ import json from thunder.writers import get_file_writer writer = get_file_writer(path) conf = {'shape': sh...
[ "def", "write_config", "(", "path", ",", "shape", "=", "None", ",", "dtype", "=", "None", ",", "name", "=", "\"conf.json\"", ",", "overwrite", "=", "True", ",", "credentials", "=", "None", ")", ":", "import", "json", "from", "thunder", ".", "writers", ...
Write a conf.json file with required information to load Series binary data.
[ "Write", "a", "conf", ".", "json", "file", "with", "required", "information", "to", "load", "Series", "binary", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/writers.py#L67-L81
train
thunder-project/thunder
thunder/images/images.py
Images.toblocks
def toblocks(self, chunk_size='auto', padding=None): """ Convert to blocks which represent subdivisions of the images data. Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interpreted as memory size...
python
def toblocks(self, chunk_size='auto', padding=None): """ Convert to blocks which represent subdivisions of the images data. Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interpreted as memory size...
[ "def", "toblocks", "(", "self", ",", "chunk_size", "=", "'auto'", ",", "padding", "=", "None", ")", ":", "from", "thunder", ".", "blocks", ".", "blocks", "import", "Blocks", "from", "thunder", ".", "blocks", ".", "local", "import", "LocalChunks", "if", "...
Convert to blocks which represent subdivisions of the images data. Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interpreted as memory size (in kilobytes, e.g. '64'). The exception is the string 'auto...
[ "Convert", "to", "blocks", "which", "represent", "subdivisions", "of", "the", "images", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L60-L89
train
thunder-project/thunder
thunder/images/images.py
Images.toseries
def toseries(self, chunk_size='auto'): """ Converts to series data. This method is equivalent to images.toblocks(size).toSeries(). Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interprete...
python
def toseries(self, chunk_size='auto'): """ Converts to series data. This method is equivalent to images.toblocks(size).toSeries(). Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interprete...
[ "def", "toseries", "(", "self", ",", "chunk_size", "=", "'auto'", ")", ":", "from", "thunder", ".", "series", ".", "series", "import", "Series", "if", "chunk_size", "is", "'auto'", ":", "chunk_size", "=", "str", "(", "max", "(", "[", "int", "(", "1e5",...
Converts to series data. This method is equivalent to images.toblocks(size).toSeries(). Parameters ---------- chunk_size : str or tuple, size of image chunk used during conversion, default = 'auto' String interpreted as memory size (in kilobytes, e.g. '64'). The...
[ "Converts", "to", "series", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L91-L117
train
thunder-project/thunder
thunder/images/images.py
Images.tospark
def tospark(self, engine=None): """ Convert to distributed spark mode. """ from thunder.images.readers import fromarray if self.mode == 'spark': logging.getLogger('thunder').warn('images already in spark mode') pass if engine is None: ...
python
def tospark(self, engine=None): """ Convert to distributed spark mode. """ from thunder.images.readers import fromarray if self.mode == 'spark': logging.getLogger('thunder').warn('images already in spark mode') pass if engine is None: ...
[ "def", "tospark", "(", "self", ",", "engine", "=", "None", ")", ":", "from", "thunder", ".", "images", ".", "readers", "import", "fromarray", "if", "self", ".", "mode", "==", "'spark'", ":", "logging", ".", "getLogger", "(", "'thunder'", ")", ".", "war...
Convert to distributed spark mode.
[ "Convert", "to", "distributed", "spark", "mode", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L131-L144
train
thunder-project/thunder
thunder/images/images.py
Images.foreach
def foreach(self, func): """ Execute a function on each image. Functions can have side effects. There is no return value. """ if self.mode == 'spark': self.values.tordd().map(lambda kv: (kv[0][0], kv[1])).foreach(func) else: [func(kv) for kv in en...
python
def foreach(self, func): """ Execute a function on each image. Functions can have side effects. There is no return value. """ if self.mode == 'spark': self.values.tordd().map(lambda kv: (kv[0][0], kv[1])).foreach(func) else: [func(kv) for kv in en...
[ "def", "foreach", "(", "self", ",", "func", ")", ":", "if", "self", ".", "mode", "==", "'spark'", ":", "self", ".", "values", ".", "tordd", "(", ")", ".", "map", "(", "lambda", "kv", ":", "(", "kv", "[", "0", "]", "[", "0", "]", ",", "kv", ...
Execute a function on each image. Functions can have side effects. There is no return value.
[ "Execute", "a", "function", "on", "each", "image", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L146-L155
train
thunder-project/thunder
thunder/images/images.py
Images.sample
def sample(self, nsamples=100, seed=None): """ Extract a random sample of images. Parameters ---------- nsamples : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed. """ ...
python
def sample(self, nsamples=100, seed=None): """ Extract a random sample of images. Parameters ---------- nsamples : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed. """ ...
[ "def", "sample", "(", "self", ",", "nsamples", "=", "100", ",", "seed", "=", "None", ")", ":", "if", "nsamples", "<", "1", ":", "raise", "ValueError", "(", "\"Number of samples must be larger than 0, got '%g'\"", "%", "nsamples", ")", "if", "seed", "is", "No...
Extract a random sample of images. Parameters ---------- nsamples : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed.
[ "Extract", "a", "random", "sample", "of", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L157-L182
train
thunder-project/thunder
thunder/images/images.py
Images.var
def var(self): """ Compute the variance across images. """ return self._constructor(self.values.var(axis=0, keepdims=True))
python
def var(self): """ Compute the variance across images. """ return self._constructor(self.values.var(axis=0, keepdims=True))
[ "def", "var", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "var", "(", "axis", "=", "0", ",", "keepdims", "=", "True", ")", ")" ]
Compute the variance across images.
[ "Compute", "the", "variance", "across", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L201-L205
train
thunder-project/thunder
thunder/images/images.py
Images.std
def std(self): """ Compute the standard deviation across images. """ return self._constructor(self.values.std(axis=0, keepdims=True))
python
def std(self): """ Compute the standard deviation across images. """ return self._constructor(self.values.std(axis=0, keepdims=True))
[ "def", "std", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "std", "(", "axis", "=", "0", ",", "keepdims", "=", "True", ")", ")" ]
Compute the standard deviation across images.
[ "Compute", "the", "standard", "deviation", "across", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L207-L211
train
thunder-project/thunder
thunder/images/images.py
Images.squeeze
def squeeze(self): """ Remove single-dimensional axes from images. """ axis = tuple(range(1, len(self.shape) - 1)) if prod(self.shape[1:]) == 1 else None return self.map(lambda x: x.squeeze(axis=axis))
python
def squeeze(self): """ Remove single-dimensional axes from images. """ axis = tuple(range(1, len(self.shape) - 1)) if prod(self.shape[1:]) == 1 else None return self.map(lambda x: x.squeeze(axis=axis))
[ "def", "squeeze", "(", "self", ")", ":", "axis", "=", "tuple", "(", "range", "(", "1", ",", "len", "(", "self", ".", "shape", ")", "-", "1", ")", ")", "if", "prod", "(", "self", ".", "shape", "[", "1", ":", "]", ")", "==", "1", "else", "Non...
Remove single-dimensional axes from images.
[ "Remove", "single", "-", "dimensional", "axes", "from", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L231-L236
train
thunder-project/thunder
thunder/images/images.py
Images.max_projection
def max_projection(self, axis=2): """ Compute maximum projections of images along a dimension. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along. """ if axis >= size(self.value_shape): raise Exc...
python
def max_projection(self, axis=2): """ Compute maximum projections of images along a dimension. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along. """ if axis >= size(self.value_shape): raise Exc...
[ "def", "max_projection", "(", "self", ",", "axis", "=", "2", ")", ":", "if", "axis", ">=", "size", "(", "self", ".", "value_shape", ")", ":", "raise", "Exception", "(", "'Axis for projection (%s) exceeds '", "'image dimensions (%s-%s)'", "%", "(", "axis", ",",...
Compute maximum projections of images along a dimension. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along.
[ "Compute", "maximum", "projections", "of", "images", "along", "a", "dimension", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L258-L273
train
thunder-project/thunder
thunder/images/images.py
Images.max_min_projection
def max_min_projection(self, axis=2): """ Compute maximum-minimum projection along a dimension. This computes the sum of the maximum and minimum values. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along. "...
python
def max_min_projection(self, axis=2): """ Compute maximum-minimum projection along a dimension. This computes the sum of the maximum and minimum values. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along. "...
[ "def", "max_min_projection", "(", "self", ",", "axis", "=", "2", ")", ":", "if", "axis", ">=", "size", "(", "self", ".", "value_shape", ")", ":", "raise", "Exception", "(", "'Axis for projection (%s) exceeds '", "'image dimensions (%s-%s)'", "%", "(", "axis", ...
Compute maximum-minimum projection along a dimension. This computes the sum of the maximum and minimum values. Parameters ---------- axis : int, optional, default = 2 Which axis to compute projection along.
[ "Compute", "maximum", "-", "minimum", "projection", "along", "a", "dimension", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L275-L292
train
thunder-project/thunder
thunder/images/images.py
Images.subsample
def subsample(self, factor): """ Downsample images by an integer factor. Parameters ---------- factor : positive int or tuple of positive ints Stride to use in subsampling. If a single int is passed, each dimension of the image will be downsampled by this...
python
def subsample(self, factor): """ Downsample images by an integer factor. Parameters ---------- factor : positive int or tuple of positive ints Stride to use in subsampling. If a single int is passed, each dimension of the image will be downsampled by this...
[ "def", "subsample", "(", "self", ",", "factor", ")", ":", "value_shape", "=", "self", ".", "value_shape", "ndims", "=", "len", "(", "value_shape", ")", "if", "not", "hasattr", "(", "factor", ",", "'__len__'", ")", ":", "factor", "=", "[", "factor", "]"...
Downsample images by an integer factor. Parameters ---------- factor : positive int or tuple of positive ints Stride to use in subsampling. If a single int is passed, each dimension of the image will be downsampled by this factor. If a tuple is passed, each d...
[ "Downsample", "images", "by", "an", "integer", "factor", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L294-L320
train
thunder-project/thunder
thunder/images/images.py
Images.gaussian_filter
def gaussian_filter(self, sigma=2, order=0): """ Spatially smooth images with a gaussian filter. Filtering will be applied to every image in the collection. Parameters ---------- sigma : scalar or sequence of scalars, default = 2 Size of the filter size as s...
python
def gaussian_filter(self, sigma=2, order=0): """ Spatially smooth images with a gaussian filter. Filtering will be applied to every image in the collection. Parameters ---------- sigma : scalar or sequence of scalars, default = 2 Size of the filter size as s...
[ "def", "gaussian_filter", "(", "self", ",", "sigma", "=", "2", ",", "order", "=", "0", ")", ":", "from", "scipy", ".", "ndimage", ".", "filters", "import", "gaussian_filter", "return", "self", ".", "map", "(", "lambda", "v", ":", "gaussian_filter", "(", ...
Spatially smooth images with a gaussian filter. Filtering will be applied to every image in the collection. Parameters ---------- sigma : scalar or sequence of scalars, default = 2 Size of the filter size as standard deviation in pixels. A sequence is interprete...
[ "Spatially", "smooth", "images", "with", "a", "gaussian", "filter", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L322-L341
train
thunder-project/thunder
thunder/images/images.py
Images._image_filter
def _image_filter(self, filter=None, size=2): """ Generic function for maping a filtering operation over images. Parameters ---------- filter : string Which filter to use. size : int or tuple Size parameter for filter. """ from nu...
python
def _image_filter(self, filter=None, size=2): """ Generic function for maping a filtering operation over images. Parameters ---------- filter : string Which filter to use. size : int or tuple Size parameter for filter. """ from nu...
[ "def", "_image_filter", "(", "self", ",", "filter", "=", "None", ",", "size", "=", "2", ")", ":", "from", "numpy", "import", "isscalar", "from", "scipy", ".", "ndimage", ".", "filters", "import", "median_filter", ",", "uniform_filter", "FILTERS", "=", "{",...
Generic function for maping a filtering operation over images. Parameters ---------- filter : string Which filter to use. size : int or tuple Size parameter for filter.
[ "Generic", "function", "for", "maping", "a", "filtering", "operation", "over", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L373-L414
train
thunder-project/thunder
thunder/images/images.py
Images.localcorr
def localcorr(self, size=2): """ Correlate every pixel in an image sequence to the average of its local neighborhood. This algorithm computes, for every pixel, the correlation coefficient between the sequence of values for that pixel, and the average of all pixels in a local nei...
python
def localcorr(self, size=2): """ Correlate every pixel in an image sequence to the average of its local neighborhood. This algorithm computes, for every pixel, the correlation coefficient between the sequence of values for that pixel, and the average of all pixels in a local nei...
[ "def", "localcorr", "(", "self", ",", "size", "=", "2", ")", ":", "from", "thunder", ".", "images", ".", "readers", "import", "fromarray", ",", "fromrdd", "from", "numpy", "import", "corrcoef", ",", "concatenate", "nimages", "=", "self", ".", "shape", "[...
Correlate every pixel in an image sequence to the average of its local neighborhood. This algorithm computes, for every pixel, the correlation coefficient between the sequence of values for that pixel, and the average of all pixels in a local neighborhood. It does this by blurring the image(s) ...
[ "Correlate", "every", "pixel", "in", "an", "image", "sequence", "to", "the", "average", "of", "its", "local", "neighborhood", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L416-L454
train
thunder-project/thunder
thunder/images/images.py
Images.subtract
def subtract(self, val): """ Subtract a constant value or an image from all images. Parameters ---------- val : int, float, or ndarray Value to subtract. """ if isinstance(val, ndarray): if val.shape != self.value_shape: ra...
python
def subtract(self, val): """ Subtract a constant value or an image from all images. Parameters ---------- val : int, float, or ndarray Value to subtract. """ if isinstance(val, ndarray): if val.shape != self.value_shape: ra...
[ "def", "subtract", "(", "self", ",", "val", ")", ":", "if", "isinstance", "(", "val", ",", "ndarray", ")", ":", "if", "val", ".", "shape", "!=", "self", ".", "value_shape", ":", "raise", "Exception", "(", "'Cannot subtract image with dimensions %s '", "'from...
Subtract a constant value or an image from all images. Parameters ---------- val : int, float, or ndarray Value to subtract.
[ "Subtract", "a", "constant", "value", "or", "an", "image", "from", "all", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L456-L470
train
thunder-project/thunder
thunder/images/images.py
Images.topng
def topng(self, path, prefix='image', overwrite=False): """ Write 2d images as PNG files. Files will be written into a newly-created directory. Three-dimensional data will be treated as RGB channels. Parameters ---------- path : string Path to output...
python
def topng(self, path, prefix='image', overwrite=False): """ Write 2d images as PNG files. Files will be written into a newly-created directory. Three-dimensional data will be treated as RGB channels. Parameters ---------- path : string Path to output...
[ "def", "topng", "(", "self", ",", "path", ",", "prefix", "=", "'image'", ",", "overwrite", "=", "False", ")", ":", "from", "thunder", ".", "images", ".", "writers", "import", "topng", "# TODO add back colormap and vmin/vmax", "topng", "(", "self", ",", "path...
Write 2d images as PNG files. Files will be written into a newly-created directory. Three-dimensional data will be treated as RGB channels. Parameters ---------- path : string Path to output directory, must be one level below an existing directory. prefix :...
[ "Write", "2d", "images", "as", "PNG", "files", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L472-L492
train
thunder-project/thunder
thunder/images/images.py
Images.map_as_series
def map_as_series(self, func, value_size=None, dtype=None, chunk_size='auto'): """ Efficiently apply a function to images as series data. For images data that represent image sequences, this method applies a function to each pixel's series, and then returns to the images format,...
python
def map_as_series(self, func, value_size=None, dtype=None, chunk_size='auto'): """ Efficiently apply a function to images as series data. For images data that represent image sequences, this method applies a function to each pixel's series, and then returns to the images format,...
[ "def", "map_as_series", "(", "self", ",", "func", ",", "value_size", "=", "None", ",", "dtype", "=", "None", ",", "chunk_size", "=", "'auto'", ")", ":", "blocks", "=", "self", ".", "toblocks", "(", "chunk_size", "=", "chunk_size", ")", "if", "value_size"...
Efficiently apply a function to images as series data. For images data that represent image sequences, this method applies a function to each pixel's series, and then returns to the images format, using an efficient intermediate block representation. Parameters --------...
[ "Efficiently", "apply", "a", "function", "to", "images", "as", "series", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/images.py#L536-L577
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.count
def count(self): """ Explicit count of the number of items. For lazy or distributed data, will force a computation. """ if self.mode == 'spark': return self.tordd().count() if self.mode == 'local': return prod(self.values.values.shape)
python
def count(self): """ Explicit count of the number of items. For lazy or distributed data, will force a computation. """ if self.mode == 'spark': return self.tordd().count() if self.mode == 'local': return prod(self.values.values.shape)
[ "def", "count", "(", "self", ")", ":", "if", "self", ".", "mode", "==", "'spark'", ":", "return", "self", ".", "tordd", "(", ")", ".", "count", "(", ")", "if", "self", ".", "mode", "==", "'local'", ":", "return", "prod", "(", "self", ".", "values...
Explicit count of the number of items. For lazy or distributed data, will force a computation.
[ "Explicit", "count", "of", "the", "number", "of", "items", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L30-L40
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.collect_blocks
def collect_blocks(self): """ Collect the blocks in a list """ if self.mode == 'spark': return self.values.tordd().sortByKey().values().collect() if self.mode == 'local': return self.values.values.flatten().tolist()
python
def collect_blocks(self): """ Collect the blocks in a list """ if self.mode == 'spark': return self.values.tordd().sortByKey().values().collect() if self.mode == 'local': return self.values.values.flatten().tolist()
[ "def", "collect_blocks", "(", "self", ")", ":", "if", "self", ".", "mode", "==", "'spark'", ":", "return", "self", ".", "values", ".", "tordd", "(", ")", ".", "sortByKey", "(", ")", ".", "values", "(", ")", ".", "collect", "(", ")", "if", "self", ...
Collect the blocks in a list
[ "Collect", "the", "blocks", "in", "a", "list" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L42-L50
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.map
def map(self, func, value_shape=None, dtype=None): """ Apply an array -> array function to each block """ mapped = self.values.map(func, value_shape=value_shape, dtype=dtype) return self._constructor(mapped).__finalize__(self, noprop=('dtype',))
python
def map(self, func, value_shape=None, dtype=None): """ Apply an array -> array function to each block """ mapped = self.values.map(func, value_shape=value_shape, dtype=dtype) return self._constructor(mapped).__finalize__(self, noprop=('dtype',))
[ "def", "map", "(", "self", ",", "func", ",", "value_shape", "=", "None", ",", "dtype", "=", "None", ")", ":", "mapped", "=", "self", ".", "values", ".", "map", "(", "func", ",", "value_shape", "=", "value_shape", ",", "dtype", "=", "dtype", ")", "r...
Apply an array -> array function to each block
[ "Apply", "an", "array", "-", ">", "array", "function", "to", "each", "block" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L52-L57
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.toimages
def toimages(self): """ Convert blocks to images. """ from thunder.images.images import Images if self.mode == 'spark': values = self.values.values_to_keys((0,)).unchunk() if self.mode == 'local': values = self.values.unchunk() return Im...
python
def toimages(self): """ Convert blocks to images. """ from thunder.images.images import Images if self.mode == 'spark': values = self.values.values_to_keys((0,)).unchunk() if self.mode == 'local': values = self.values.unchunk() return Im...
[ "def", "toimages", "(", "self", ")", ":", "from", "thunder", ".", "images", ".", "images", "import", "Images", "if", "self", ".", "mode", "==", "'spark'", ":", "values", "=", "self", ".", "values", ".", "values_to_keys", "(", "(", "0", ",", ")", ")",...
Convert blocks to images.
[ "Convert", "blocks", "to", "images", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L75-L87
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.toseries
def toseries(self): """ Converts blocks to series. """ from thunder.series.series import Series if self.mode == 'spark': values = self.values.values_to_keys(tuple(range(1, len(self.shape)))).unchunk() if self.mode == 'local': values = self.values...
python
def toseries(self): """ Converts blocks to series. """ from thunder.series.series import Series if self.mode == 'spark': values = self.values.values_to_keys(tuple(range(1, len(self.shape)))).unchunk() if self.mode == 'local': values = self.values...
[ "def", "toseries", "(", "self", ")", ":", "from", "thunder", ".", "series", ".", "series", "import", "Series", "if", "self", ".", "mode", "==", "'spark'", ":", "values", "=", "self", ".", "values", ".", "values_to_keys", "(", "tuple", "(", "range", "("...
Converts blocks to series.
[ "Converts", "blocks", "to", "series", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L89-L102
train
thunder-project/thunder
thunder/blocks/blocks.py
Blocks.toarray
def toarray(self): """ Convert blocks to local ndarray """ if self.mode == 'spark': return self.values.unchunk().toarray() if self.mode == 'local': return self.values.unchunk()
python
def toarray(self): """ Convert blocks to local ndarray """ if self.mode == 'spark': return self.values.unchunk().toarray() if self.mode == 'local': return self.values.unchunk()
[ "def", "toarray", "(", "self", ")", ":", "if", "self", ".", "mode", "==", "'spark'", ":", "return", "self", ".", "values", ".", "unchunk", "(", ")", ".", "toarray", "(", ")", "if", "self", ".", "mode", "==", "'local'", ":", "return", "self", ".", ...
Convert blocks to local ndarray
[ "Convert", "blocks", "to", "local", "ndarray" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/blocks/blocks.py#L104-L112
train
thunder-project/thunder
thunder/series/series.py
Series.flatten
def flatten(self): """ Reshape all dimensions but the last into a single dimension """ size = prod(self.shape[:-1]) return self.reshape(size, self.shape[-1])
python
def flatten(self): """ Reshape all dimensions but the last into a single dimension """ size = prod(self.shape[:-1]) return self.reshape(size, self.shape[-1])
[ "def", "flatten", "(", "self", ")", ":", "size", "=", "prod", "(", "self", ".", "shape", "[", ":", "-", "1", "]", ")", "return", "self", ".", "reshape", "(", "size", ",", "self", ".", "shape", "[", "-", "1", "]", ")" ]
Reshape all dimensions but the last into a single dimension
[ "Reshape", "all", "dimensions", "but", "the", "last", "into", "a", "single", "dimension" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L81-L86
train
thunder-project/thunder
thunder/series/series.py
Series.tospark
def tospark(self, engine=None): """ Convert to spark mode. """ from thunder.series.readers import fromarray if self.mode == 'spark': logging.getLogger('thunder').warn('images already in local mode') pass if engine is None: raise Value...
python
def tospark(self, engine=None): """ Convert to spark mode. """ from thunder.series.readers import fromarray if self.mode == 'spark': logging.getLogger('thunder').warn('images already in local mode') pass if engine is None: raise Value...
[ "def", "tospark", "(", "self", ",", "engine", "=", "None", ")", ":", "from", "thunder", ".", "series", ".", "readers", "import", "fromarray", "if", "self", ".", "mode", "==", "'spark'", ":", "logging", ".", "getLogger", "(", "'thunder'", ")", ".", "war...
Convert to spark mode.
[ "Convert", "to", "spark", "mode", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L122-L135
train
thunder-project/thunder
thunder/series/series.py
Series.sample
def sample(self, n=100, seed=None): """ Extract random sample of records. Parameters ---------- n : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed. """ if n < 1: ...
python
def sample(self, n=100, seed=None): """ Extract random sample of records. Parameters ---------- n : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed. """ if n < 1: ...
[ "def", "sample", "(", "self", ",", "n", "=", "100", ",", "seed", "=", "None", ")", ":", "if", "n", "<", "1", ":", "raise", "ValueError", "(", "\"Number of samples must be larger than 0, got '%g'\"", "%", "n", ")", "if", "seed", "is", "None", ":", "seed",...
Extract random sample of records. Parameters ---------- n : int, optional, default = 100 The number of data points to sample. seed : int, optional, default = None Random seed.
[ "Extract", "random", "sample", "of", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L137-L163
train
thunder-project/thunder
thunder/series/series.py
Series.map
def map(self, func, index=None, value_shape=None, dtype=None, with_keys=False): """ Map an array -> array function over each record. Parameters ---------- func : function A function of a single record. index : array-like, optional, default = None ...
python
def map(self, func, index=None, value_shape=None, dtype=None, with_keys=False): """ Map an array -> array function over each record. Parameters ---------- func : function A function of a single record. index : array-like, optional, default = None ...
[ "def", "map", "(", "self", ",", "func", ",", "index", "=", "None", ",", "value_shape", "=", "None", ",", "dtype", "=", "None", ",", "with_keys", "=", "False", ")", ":", "# if new index is given, can infer missing value_shape", "if", "value_shape", "is", "None"...
Map an array -> array function over each record. Parameters ---------- func : function A function of a single record. index : array-like, optional, default = None If known, the index to be used following function evaluation. value_shape : int, optional,...
[ "Map", "an", "array", "-", ">", "array", "function", "over", "each", "record", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L165-L202
train
thunder-project/thunder
thunder/series/series.py
Series.mean
def mean(self): """ Compute the mean across records """ return self._constructor(self.values.mean(axis=self.baseaxes, keepdims=True))
python
def mean(self): """ Compute the mean across records """ return self._constructor(self.values.mean(axis=self.baseaxes, keepdims=True))
[ "def", "mean", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "mean", "(", "axis", "=", "self", ".", "baseaxes", ",", "keepdims", "=", "True", ")", ")" ]
Compute the mean across records
[ "Compute", "the", "mean", "across", "records" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L215-L219
train
thunder-project/thunder
thunder/series/series.py
Series.sum
def sum(self): """ Compute the sum across records. """ return self._constructor(self.values.sum(axis=self.baseaxes, keepdims=True))
python
def sum(self): """ Compute the sum across records. """ return self._constructor(self.values.sum(axis=self.baseaxes, keepdims=True))
[ "def", "sum", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "sum", "(", "axis", "=", "self", ".", "baseaxes", ",", "keepdims", "=", "True", ")", ")" ]
Compute the sum across records.
[ "Compute", "the", "sum", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L233-L237
train
thunder-project/thunder
thunder/series/series.py
Series.max
def max(self): """ Compute the max across records. """ return self._constructor(self.values.max(axis=self.baseaxes, keepdims=True))
python
def max(self): """ Compute the max across records. """ return self._constructor(self.values.max(axis=self.baseaxes, keepdims=True))
[ "def", "max", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "max", "(", "axis", "=", "self", ".", "baseaxes", ",", "keepdims", "=", "True", ")", ")" ]
Compute the max across records.
[ "Compute", "the", "max", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L239-L243
train
thunder-project/thunder
thunder/series/series.py
Series.min
def min(self): """ Compute the min across records. """ return self._constructor(self.values.min(axis=self.baseaxes, keepdims=True))
python
def min(self): """ Compute the min across records. """ return self._constructor(self.values.min(axis=self.baseaxes, keepdims=True))
[ "def", "min", "(", "self", ")", ":", "return", "self", ".", "_constructor", "(", "self", ".", "values", ".", "min", "(", "axis", "=", "self", ".", "baseaxes", ",", "keepdims", "=", "True", ")", ")" ]
Compute the min across records.
[ "Compute", "the", "min", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L245-L249
train
thunder-project/thunder
thunder/series/series.py
Series.reshape
def reshape(self, *shape): """ Reshape the Series object Cannot change the last dimension. Parameters ---------- shape: one or more ints New shape """ if prod(self.shape) != prod(shape): raise ValueError("Reshaping must leave the ...
python
def reshape(self, *shape): """ Reshape the Series object Cannot change the last dimension. Parameters ---------- shape: one or more ints New shape """ if prod(self.shape) != prod(shape): raise ValueError("Reshaping must leave the ...
[ "def", "reshape", "(", "self", ",", "*", "shape", ")", ":", "if", "prod", "(", "self", ".", "shape", ")", "!=", "prod", "(", "shape", ")", ":", "raise", "ValueError", "(", "\"Reshaping must leave the number of elements unchanged\"", ")", "if", "self", ".", ...
Reshape the Series object Cannot change the last dimension. Parameters ---------- shape: one or more ints New shape
[ "Reshape", "the", "Series", "object" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L251-L273
train
thunder-project/thunder
thunder/series/series.py
Series.between
def between(self, left, right): """ Select subset of values within the given index range. Inclusive on the left; exclusive on the right. Parameters ---------- left : int Left-most index in the desired range. right: int Right-most index i...
python
def between(self, left, right): """ Select subset of values within the given index range. Inclusive on the left; exclusive on the right. Parameters ---------- left : int Left-most index in the desired range. right: int Right-most index i...
[ "def", "between", "(", "self", ",", "left", ",", "right", ")", ":", "crit", "=", "lambda", "x", ":", "left", "<=", "x", "<", "right", "return", "self", ".", "select", "(", "crit", ")" ]
Select subset of values within the given index range. Inclusive on the left; exclusive on the right. Parameters ---------- left : int Left-most index in the desired range. right: int Right-most index in the desired range.
[ "Select", "subset", "of", "values", "within", "the", "given", "index", "range", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L275-L290
train
thunder-project/thunder
thunder/series/series.py
Series.select
def select(self, crit): """ Select subset of values that match a given index criterion. Parameters ---------- crit : function, list, str, int Criterion function to map to indices, specific index value, or list of indices. """ import types ...
python
def select(self, crit): """ Select subset of values that match a given index criterion. Parameters ---------- crit : function, list, str, int Criterion function to map to indices, specific index value, or list of indices. """ import types ...
[ "def", "select", "(", "self", ",", "crit", ")", ":", "import", "types", "# handle lists, strings, and ints", "if", "not", "isinstance", "(", "crit", ",", "types", ".", "FunctionType", ")", ":", "# set(\"foo\") -> {\"f\", \"o\"}; wrap in list to prevent:", "if", "isins...
Select subset of values that match a given index criterion. Parameters ---------- crit : function, list, str, int Criterion function to map to indices, specific index value, or list of indices.
[ "Select", "subset", "of", "values", "that", "match", "a", "given", "index", "criterion", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L292-L348
train
thunder-project/thunder
thunder/series/series.py
Series.center
def center(self, axis=1): """ Subtract the mean either within or across records. Parameters ---------- axis : int, optional, default = 1 Which axis to center along, within (1) or across (0) records. """ if axis == 1: return self.map(lambda...
python
def center(self, axis=1): """ Subtract the mean either within or across records. Parameters ---------- axis : int, optional, default = 1 Which axis to center along, within (1) or across (0) records. """ if axis == 1: return self.map(lambda...
[ "def", "center", "(", "self", ",", "axis", "=", "1", ")", ":", "if", "axis", "==", "1", ":", "return", "self", ".", "map", "(", "lambda", "x", ":", "x", "-", "mean", "(", "x", ")", ")", "elif", "axis", "==", "0", ":", "meanval", "=", "self", ...
Subtract the mean either within or across records. Parameters ---------- axis : int, optional, default = 1 Which axis to center along, within (1) or across (0) records.
[ "Subtract", "the", "mean", "either", "within", "or", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L350-L365
train
thunder-project/thunder
thunder/series/series.py
Series.standardize
def standardize(self, axis=1): """ Divide by standard deviation either within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to standardize along, within (1) or across (0) records """ if axis == 1: re...
python
def standardize(self, axis=1): """ Divide by standard deviation either within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to standardize along, within (1) or across (0) records """ if axis == 1: re...
[ "def", "standardize", "(", "self", ",", "axis", "=", "1", ")", ":", "if", "axis", "==", "1", ":", "return", "self", ".", "map", "(", "lambda", "x", ":", "x", "/", "std", "(", "x", ")", ")", "elif", "axis", "==", "0", ":", "stdval", "=", "self...
Divide by standard deviation either within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to standardize along, within (1) or across (0) records
[ "Divide", "by", "standard", "deviation", "either", "within", "or", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L367-L382
train
thunder-project/thunder
thunder/series/series.py
Series.zscore
def zscore(self, axis=1): """ Subtract the mean and divide by standard deviation within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to zscore along, within (1) or across (0) records """ if axis == 1: ...
python
def zscore(self, axis=1): """ Subtract the mean and divide by standard deviation within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to zscore along, within (1) or across (0) records """ if axis == 1: ...
[ "def", "zscore", "(", "self", ",", "axis", "=", "1", ")", ":", "if", "axis", "==", "1", ":", "return", "self", ".", "map", "(", "lambda", "x", ":", "(", "x", "-", "mean", "(", "x", ")", ")", "/", "std", "(", "x", ")", ")", "elif", "axis", ...
Subtract the mean and divide by standard deviation within or across records. Parameters ---------- axis : int, optional, default = 0 Which axis to zscore along, within (1) or across (0) records
[ "Subtract", "the", "mean", "and", "divide", "by", "standard", "deviation", "within", "or", "across", "records", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L384-L400
train
thunder-project/thunder
thunder/series/series.py
Series.squelch
def squelch(self, threshold): """ Set all records that do not exceed the given threhsold to 0. Parameters ---------- threshold : scalar Level below which to set records to zero """ func = lambda x: zeros(x.shape) if max(x) < threshold else x r...
python
def squelch(self, threshold): """ Set all records that do not exceed the given threhsold to 0. Parameters ---------- threshold : scalar Level below which to set records to zero """ func = lambda x: zeros(x.shape) if max(x) < threshold else x r...
[ "def", "squelch", "(", "self", ",", "threshold", ")", ":", "func", "=", "lambda", "x", ":", "zeros", "(", "x", ".", "shape", ")", "if", "max", "(", "x", ")", "<", "threshold", "else", "x", "return", "self", ".", "map", "(", "func", ")" ]
Set all records that do not exceed the given threhsold to 0. Parameters ---------- threshold : scalar Level below which to set records to zero
[ "Set", "all", "records", "that", "do", "not", "exceed", "the", "given", "threhsold", "to", "0", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L402-L412
train
thunder-project/thunder
thunder/series/series.py
Series.correlate
def correlate(self, signal): """ Correlate records against one or many one-dimensional arrays. Parameters ---------- signal : array-like One or more signals to correlate against. """ s = asarray(signal) if s.ndim == 1: if size(s) ...
python
def correlate(self, signal): """ Correlate records against one or many one-dimensional arrays. Parameters ---------- signal : array-like One or more signals to correlate against. """ s = asarray(signal) if s.ndim == 1: if size(s) ...
[ "def", "correlate", "(", "self", ",", "signal", ")", ":", "s", "=", "asarray", "(", "signal", ")", "if", "s", ".", "ndim", "==", "1", ":", "if", "size", "(", "s", ")", "!=", "self", ".", "shape", "[", "-", "1", "]", ":", "raise", "ValueError", ...
Correlate records against one or many one-dimensional arrays. Parameters ---------- signal : array-like One or more signals to correlate against.
[ "Correlate", "records", "against", "one", "or", "many", "one", "-", "dimensional", "arrays", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L414-L440
train
thunder-project/thunder
thunder/series/series.py
Series._check_panel
def _check_panel(self, length): """ Check that given fixed panel length evenly divides index. Parameters ---------- length : int Fixed length with which to subdivide index """ n = len(self.index) if divmod(n, length)[1] != 0: raise...
python
def _check_panel(self, length): """ Check that given fixed panel length evenly divides index. Parameters ---------- length : int Fixed length with which to subdivide index """ n = len(self.index) if divmod(n, length)[1] != 0: raise...
[ "def", "_check_panel", "(", "self", ",", "length", ")", ":", "n", "=", "len", "(", "self", ".", "index", ")", "if", "divmod", "(", "n", ",", "length", ")", "[", "1", "]", "!=", "0", ":", "raise", "ValueError", "(", "\"Panel length '%g' must evenly divi...
Check that given fixed panel length evenly divides index. Parameters ---------- length : int Fixed length with which to subdivide index
[ "Check", "that", "given", "fixed", "panel", "length", "evenly", "divides", "index", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L442-L457
train
thunder-project/thunder
thunder/series/series.py
Series.mean_by_panel
def mean_by_panel(self, length): """ Compute the mean across fixed sized panels of each record. Splits each record into panels of size `length`, and then computes the mean across panels. Panel length must subdivide record exactly. Parameters ---------- l...
python
def mean_by_panel(self, length): """ Compute the mean across fixed sized panels of each record. Splits each record into panels of size `length`, and then computes the mean across panels. Panel length must subdivide record exactly. Parameters ---------- l...
[ "def", "mean_by_panel", "(", "self", ",", "length", ")", ":", "self", ".", "_check_panel", "(", "length", ")", "func", "=", "lambda", "v", ":", "v", ".", "reshape", "(", "-", "1", ",", "length", ")", ".", "mean", "(", "axis", "=", "0", ")", "newi...
Compute the mean across fixed sized panels of each record. Splits each record into panels of size `length`, and then computes the mean across panels. Panel length must subdivide record exactly. Parameters ---------- length : int Fixed length with which to su...
[ "Compute", "the", "mean", "across", "fixed", "sized", "panels", "of", "each", "record", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L459-L475
train
thunder-project/thunder
thunder/series/series.py
Series._makemasks
def _makemasks(self, index=None, level=0): """ Internal function for generating masks for selecting values based on multi-index values. As all other multi-index functions will call this function, basic type-checking is also performed at this stage. """ if index is None: ...
python
def _makemasks(self, index=None, level=0): """ Internal function for generating masks for selecting values based on multi-index values. As all other multi-index functions will call this function, basic type-checking is also performed at this stage. """ if index is None: ...
[ "def", "_makemasks", "(", "self", ",", "index", "=", "None", ",", "level", "=", "0", ")", ":", "if", "index", "is", "None", ":", "index", "=", "self", ".", "index", "try", ":", "dims", "=", "len", "(", "array", "(", "index", ")", ".", "shape", ...
Internal function for generating masks for selecting values based on multi-index values. As all other multi-index functions will call this function, basic type-checking is also performed at this stage.
[ "Internal", "function", "for", "generating", "masks", "for", "selecting", "values", "based", "on", "multi", "-", "index", "values", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L477-L507
train
thunder-project/thunder
thunder/series/series.py
Series._map_by_index
def _map_by_index(self, function, level=0): """ An internal function for maping a function to groups of values based on a multi-index Elements of each record are grouped according to unique value combinations of the multi- index across the given levels of the multi-index. Then the given...
python
def _map_by_index(self, function, level=0): """ An internal function for maping a function to groups of values based on a multi-index Elements of each record are grouped according to unique value combinations of the multi- index across the given levels of the multi-index. Then the given...
[ "def", "_map_by_index", "(", "self", ",", "function", ",", "level", "=", "0", ")", ":", "if", "type", "(", "level", ")", "is", "int", ":", "level", "=", "[", "level", "]", "masks", ",", "ind", "=", "self", ".", "_makemasks", "(", "index", "=", "s...
An internal function for maping a function to groups of values based on a multi-index Elements of each record are grouped according to unique value combinations of the multi- index across the given levels of the multi-index. Then the given function is applied to to each of these groups separate...
[ "An", "internal", "function", "for", "maping", "a", "function", "to", "groups", "of", "values", "based", "on", "a", "multi", "-", "index" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L509-L528
train
thunder-project/thunder
thunder/series/series.py
Series.aggregate_by_index
def aggregate_by_index(self, function, level=0): """ Aggregrate data in each record, grouping by index values. For each unique value of the index, applies a function to the group indexed by that value. Returns a Series indexed by those unique values. For the result to be a valid...
python
def aggregate_by_index(self, function, level=0): """ Aggregrate data in each record, grouping by index values. For each unique value of the index, applies a function to the group indexed by that value. Returns a Series indexed by those unique values. For the result to be a valid...
[ "def", "aggregate_by_index", "(", "self", ",", "function", ",", "level", "=", "0", ")", ":", "result", "=", "self", ".", "_map_by_index", "(", "function", ",", "level", "=", "level", ")", "return", "result", ".", "map", "(", "lambda", "v", ":", "array"...
Aggregrate data in each record, grouping by index values. For each unique value of the index, applies a function to the group indexed by that value. Returns a Series indexed by those unique values. For the result to be a valid Series object, the aggregating function should return a simp...
[ "Aggregrate", "data", "in", "each", "record", "grouping", "by", "index", "values", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L628-L649
train
thunder-project/thunder
thunder/series/series.py
Series.gramian
def gramian(self): """ Compute gramian of a distributed matrix. The gramian is defined as the product of the matrix with its transpose, i.e. A^T * A. """ if self.mode == 'spark': rdd = self.values.tordd() from pyspark.accumulators import Accumula...
python
def gramian(self): """ Compute gramian of a distributed matrix. The gramian is defined as the product of the matrix with its transpose, i.e. A^T * A. """ if self.mode == 'spark': rdd = self.values.tordd() from pyspark.accumulators import Accumula...
[ "def", "gramian", "(", "self", ")", ":", "if", "self", ".", "mode", "==", "'spark'", ":", "rdd", "=", "self", ".", "values", ".", "tordd", "(", ")", "from", "pyspark", ".", "accumulators", "import", "AccumulatorParam", "class", "MatrixAccumulator", "(", ...
Compute gramian of a distributed matrix. The gramian is defined as the product of the matrix with its transpose, i.e. A^T * A.
[ "Compute", "gramian", "of", "a", "distributed", "matrix", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L731-L763
train
thunder-project/thunder
thunder/series/series.py
Series.times
def times(self, other): """ Multiply a matrix by another one. Other matrix must be a numpy array, a scalar, or another matrix in local mode. Parameters ---------- other : Matrix, scalar, or numpy array A matrix to multiply with """ if...
python
def times(self, other): """ Multiply a matrix by another one. Other matrix must be a numpy array, a scalar, or another matrix in local mode. Parameters ---------- other : Matrix, scalar, or numpy array A matrix to multiply with """ if...
[ "def", "times", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "ScalarType", ")", ":", "other", "=", "asarray", "(", "other", ")", "index", "=", "self", ".", "index", "else", ":", "if", "isinstance", "(", "other", ",", ...
Multiply a matrix by another one. Other matrix must be a numpy array, a scalar, or another matrix in local mode. Parameters ---------- other : Matrix, scalar, or numpy array A matrix to multiply with
[ "Multiply", "a", "matrix", "by", "another", "one", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L765-L805
train
thunder-project/thunder
thunder/series/series.py
Series._makewindows
def _makewindows(self, indices, window): """ Make masks used by windowing functions Given a list of indices specifying window centers, and a window size, construct a list of index arrays, one per window, that index into the target array Parameters ---------- ...
python
def _makewindows(self, indices, window): """ Make masks used by windowing functions Given a list of indices specifying window centers, and a window size, construct a list of index arrays, one per window, that index into the target array Parameters ---------- ...
[ "def", "_makewindows", "(", "self", ",", "indices", ",", "window", ")", ":", "div", "=", "divmod", "(", "window", ",", "2", ")", "before", "=", "div", "[", "0", "]", "after", "=", "div", "[", "0", "]", "+", "div", "[", "1", "]", "index", "=", ...
Make masks used by windowing functions Given a list of indices specifying window centers, and a window size, construct a list of index arrays, one per window, that index into the target array Parameters ---------- indices : array-like List of times specifyin...
[ "Make", "masks", "used", "by", "windowing", "functions" ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L807-L835
train
thunder-project/thunder
thunder/series/series.py
Series.mean_by_window
def mean_by_window(self, indices, window): """ Average series across multiple windows specified by their centers. Parameters ---------- indices : array-like List of times specifying window centers window : int Window size """ mask...
python
def mean_by_window(self, indices, window): """ Average series across multiple windows specified by their centers. Parameters ---------- indices : array-like List of times specifying window centers window : int Window size """ mask...
[ "def", "mean_by_window", "(", "self", ",", "indices", ",", "window", ")", ":", "masks", "=", "self", ".", "_makewindows", "(", "indices", ",", "window", ")", "newindex", "=", "arange", "(", "0", ",", "len", "(", "masks", "[", "0", "]", ")", ")", "r...
Average series across multiple windows specified by their centers. Parameters ---------- indices : array-like List of times specifying window centers window : int Window size
[ "Average", "series", "across", "multiple", "windows", "specified", "by", "their", "centers", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L837-L851
train
thunder-project/thunder
thunder/series/series.py
Series.subsample
def subsample(self, sample_factor=2): """ Subsample series by an integer factor. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling. """ if sample_factor < 0: raise Exception('Factor for sub...
python
def subsample(self, sample_factor=2): """ Subsample series by an integer factor. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling. """ if sample_factor < 0: raise Exception('Factor for sub...
[ "def", "subsample", "(", "self", ",", "sample_factor", "=", "2", ")", ":", "if", "sample_factor", "<", "0", ":", "raise", "Exception", "(", "'Factor for subsampling must be postive, got %g'", "%", "sample_factor", ")", "s", "=", "slice", "(", "0", ",", "len", ...
Subsample series by an integer factor. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling.
[ "Subsample", "series", "by", "an", "integer", "factor", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L853-L866
train
thunder-project/thunder
thunder/series/series.py
Series.downsample
def downsample(self, sample_factor=2): """ Downsample series by an integer factor by averaging. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling. """ if sample_factor < 0: raise Exception(...
python
def downsample(self, sample_factor=2): """ Downsample series by an integer factor by averaging. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling. """ if sample_factor < 0: raise Exception(...
[ "def", "downsample", "(", "self", ",", "sample_factor", "=", "2", ")", ":", "if", "sample_factor", "<", "0", ":", "raise", "Exception", "(", "'Factor for subsampling must be postive, got %g'", "%", "sample_factor", ")", "newlength", "=", "floor", "(", "len", "("...
Downsample series by an integer factor by averaging. Parameters ---------- sample_factor : positive integer, optional, default=2 Factor for downsampling.
[ "Downsample", "series", "by", "an", "integer", "factor", "by", "averaging", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L868-L882
train
thunder-project/thunder
thunder/series/series.py
Series.fourier
def fourier(self, freq=None): """ Compute statistics of a Fourier decomposition on series data. Parameters ---------- freq : int Digital frequency at which to compute coherence and phase """ def get(y, freq): y = y - mean(y) nf...
python
def fourier(self, freq=None): """ Compute statistics of a Fourier decomposition on series data. Parameters ---------- freq : int Digital frequency at which to compute coherence and phase """ def get(y, freq): y = y - mean(y) nf...
[ "def", "fourier", "(", "self", ",", "freq", "=", "None", ")", ":", "def", "get", "(", "y", ",", "freq", ")", ":", "y", "=", "y", "-", "mean", "(", "y", ")", "nframes", "=", "len", "(", "y", ")", "ft", "=", "fft", ".", "fft", "(", "y", ")"...
Compute statistics of a Fourier decomposition on series data. Parameters ---------- freq : int Digital frequency at which to compute coherence and phase
[ "Compute", "statistics", "of", "a", "Fourier", "decomposition", "on", "series", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L884-L912
train
thunder-project/thunder
thunder/series/series.py
Series.convolve
def convolve(self, signal, mode='full'): """ Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'sam...
python
def convolve(self, signal, mode='full'): """ Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'sam...
[ "def", "convolve", "(", "self", ",", "signal", ",", "mode", "=", "'full'", ")", ":", "from", "numpy", "import", "convolve", "s", "=", "asarray", "(", "signal", ")", "n", "=", "size", "(", "self", ".", "index", ")", "m", "=", "size", "(", "s", ")"...
Convolve series data against another signal. Parameters ---------- signal : array Signal to convolve with (must be 1D) mode : str, optional, default='full' Mode of convolution, options are 'full', 'same', and 'valid'
[ "Convolve", "series", "data", "against", "another", "signal", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L914-L943
train
thunder-project/thunder
thunder/series/series.py
Series.crosscorr
def crosscorr(self, signal, lag=0): """ Cross correlate series data against another signal. Parameters ---------- signal : array Signal to correlate against (must be 1D). lag : int Range of lags to consider, will cover (-lag, +lag). """ ...
python
def crosscorr(self, signal, lag=0): """ Cross correlate series data against another signal. Parameters ---------- signal : array Signal to correlate against (must be 1D). lag : int Range of lags to consider, will cover (-lag, +lag). """ ...
[ "def", "crosscorr", "(", "self", ",", "signal", ",", "lag", "=", "0", ")", ":", "from", "scipy", ".", "linalg", "import", "norm", "s", "=", "asarray", "(", "signal", ")", "s", "=", "s", "-", "mean", "(", "s", ")", "s", "=", "s", "/", "norm", ...
Cross correlate series data against another signal. Parameters ---------- signal : array Signal to correlate against (must be 1D). lag : int Range of lags to consider, will cover (-lag, +lag).
[ "Cross", "correlate", "series", "data", "against", "another", "signal", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L945-L994
train
thunder-project/thunder
thunder/series/series.py
Series.detrend
def detrend(self, method='linear', order=5): """ Detrend series data with linear or nonlinear detrending. Preserve intercept so that subsequent operations can adjust the baseline. Parameters ---------- method : str, optional, default = 'linear' Detrending me...
python
def detrend(self, method='linear', order=5): """ Detrend series data with linear or nonlinear detrending. Preserve intercept so that subsequent operations can adjust the baseline. Parameters ---------- method : str, optional, default = 'linear' Detrending me...
[ "def", "detrend", "(", "self", ",", "method", "=", "'linear'", ",", "order", "=", "5", ")", ":", "check_options", "(", "method", ",", "[", "'linear'", ",", "'nonlinear'", "]", ")", "if", "method", "==", "'linear'", ":", "order", "=", "1", "def", "fun...
Detrend series data with linear or nonlinear detrending. Preserve intercept so that subsequent operations can adjust the baseline. Parameters ---------- method : str, optional, default = 'linear' Detrending method order : int, optional, default = 5 Orde...
[ "Detrend", "series", "data", "with", "linear", "or", "nonlinear", "detrending", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L996-L1022
train
thunder-project/thunder
thunder/series/series.py
Series.normalize
def normalize(self, method='percentile', window=None, perc=20, offset=0.1): """ Normalize by subtracting and dividing by a baseline. Baseline can be derived from a global mean or percentile, or a smoothed percentile estimated within a rolling window. Windowed baselines may only ...
python
def normalize(self, method='percentile', window=None, perc=20, offset=0.1): """ Normalize by subtracting and dividing by a baseline. Baseline can be derived from a global mean or percentile, or a smoothed percentile estimated within a rolling window. Windowed baselines may only ...
[ "def", "normalize", "(", "self", ",", "method", "=", "'percentile'", ",", "window", "=", "None", ",", "perc", "=", "20", ",", "offset", "=", "0.1", ")", ":", "check_options", "(", "method", ",", "[", "'mean'", ",", "'percentile'", ",", "'window'", ",",...
Normalize by subtracting and dividing by a baseline. Baseline can be derived from a global mean or percentile, or a smoothed percentile estimated within a rolling window. Windowed baselines may only be well-defined for temporal series data. Parameters ---------- ...
[ "Normalize", "by", "subtracting", "and", "dividing", "by", "a", "baseline", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L1024-L1081
train
thunder-project/thunder
thunder/series/series.py
Series.toimages
def toimages(self, chunk_size='auto'): """ Converts to images data. This method is equivalent to series.toblocks(size).toimages(). Parameters ---------- chunk_size : str or tuple, size of series chunk used during conversion, default = 'auto' String interpret...
python
def toimages(self, chunk_size='auto'): """ Converts to images data. This method is equivalent to series.toblocks(size).toimages(). Parameters ---------- chunk_size : str or tuple, size of series chunk used during conversion, default = 'auto' String interpret...
[ "def", "toimages", "(", "self", ",", "chunk_size", "=", "'auto'", ")", ":", "from", "thunder", ".", "images", ".", "images", "import", "Images", "if", "chunk_size", "is", "'auto'", ":", "chunk_size", "=", "str", "(", "max", "(", "[", "int", "(", "1e5",...
Converts to images data. This method is equivalent to series.toblocks(size).toimages(). Parameters ---------- chunk_size : str or tuple, size of series chunk used during conversion, default = 'auto' String interpreted as memory size (in kilobytes, e.g. '64'). Th...
[ "Converts", "to", "images", "data", "." ]
967ff8f3e7c2fabe1705743d95eb2746d4329786
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L1083-L1108
train