id
int32
0
252k
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
47,400
ternaris/marv
marv/cli.py
marvcli_develop_server
def marvcli_develop_server(port, public): """Run development webserver. ATTENTION: By default it is only served on localhost. To run it within a container and access it from the outside, you need to forward the port and tell it to listen on all IPs instead of only localhost. """ from flask_...
python
def marvcli_develop_server(port, public): """Run development webserver. ATTENTION: By default it is only served on localhost. To run it within a container and access it from the outside, you need to forward the port and tell it to listen on all IPs instead of only localhost. """ from flask_...
[ "def", "marvcli_develop_server", "(", "port", ",", "public", ")", ":", "from", "flask_cors", "import", "CORS", "app", "=", "create_app", "(", "push", "=", "False", ")", "app", ".", "site", ".", "load_for_web", "(", ")", "CORS", "(", "app", ")", "class", ...
Run development webserver. ATTENTION: By default it is only served on localhost. To run it within a container and access it from the outside, you need to forward the port and tell it to listen on all IPs instead of only localhost.
[ "Run", "development", "webserver", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L135-L171
47,401
ternaris/marv
marv/cli.py
marvcli_discard
def marvcli_discard(datasets, all_nodes, nodes, tags, comments, confirm): """Mark DATASETS to be discarded or discard associated data. Without any options the specified datasets are marked to be discarded via `marv cleanup --discarded`. Use `marv undiscard` to undo this operation. Otherwise, selec...
python
def marvcli_discard(datasets, all_nodes, nodes, tags, comments, confirm): """Mark DATASETS to be discarded or discard associated data. Without any options the specified datasets are marked to be discarded via `marv cleanup --discarded`. Use `marv undiscard` to undo this operation. Otherwise, selec...
[ "def", "marvcli_discard", "(", "datasets", ",", "all_nodes", ",", "nodes", ",", "tags", ",", "comments", ",", "confirm", ")", ":", "mark_discarded", "=", "not", "any", "(", "[", "all_nodes", ",", "nodes", ",", "tags", ",", "comments", "]", ")", "site", ...
Mark DATASETS to be discarded or discard associated data. Without any options the specified datasets are marked to be discarded via `marv cleanup --discarded`. Use `marv undiscard` to undo this operation. Otherwise, selected data associated with the specified datasets is discarded right away.
[ "Mark", "DATASETS", "to", "be", "discarded", "or", "discard", "associated", "data", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L182-L229
47,402
ternaris/marv
marv/cli.py
marvcli_undiscard
def marvcli_undiscard(datasets): """Undiscard DATASETS previously discarded.""" create_app() setids = parse_setids(datasets, discarded=True) dataset = Dataset.__table__ stmt = dataset.update()\ .where(dataset.c.setid.in_(setids))\ .values(discarded=False) db....
python
def marvcli_undiscard(datasets): """Undiscard DATASETS previously discarded.""" create_app() setids = parse_setids(datasets, discarded=True) dataset = Dataset.__table__ stmt = dataset.update()\ .where(dataset.c.setid.in_(setids))\ .values(discarded=False) db....
[ "def", "marvcli_undiscard", "(", "datasets", ")", ":", "create_app", "(", ")", "setids", "=", "parse_setids", "(", "datasets", ",", "discarded", "=", "True", ")", "dataset", "=", "Dataset", ".", "__table__", "stmt", "=", "dataset", ".", "update", "(", ")",...
Undiscard DATASETS previously discarded.
[ "Undiscard", "DATASETS", "previously", "discarded", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L234-L244
47,403
ternaris/marv
marv/cli.py
marvcli_restore
def marvcli_restore(file): """Restore previously dumped database""" data = json.load(file) site = create_app().site site.restore_database(**data)
python
def marvcli_restore(file): """Restore previously dumped database""" data = json.load(file) site = create_app().site site.restore_database(**data)
[ "def", "marvcli_restore", "(", "file", ")", ":", "data", "=", "json", ".", "load", "(", "file", ")", "site", "=", "create_app", "(", ")", ".", "site", "site", ".", "restore_database", "(", "*", "*", "data", ")" ]
Restore previously dumped database
[ "Restore", "previously", "dumped", "database" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L249-L253
47,404
ternaris/marv
marv/cli.py
marvcli_query
def marvcli_query(ctx, list_tags, collections, discarded, outdated, path, tags, null): """Query datasets. Use --collection=* to list all datasets across all collections. """ if not any([collections, discarded, list_tags, outdated, path, tags]): click.echo(ctx.get_help()) ctx.exit(1) ...
python
def marvcli_query(ctx, list_tags, collections, discarded, outdated, path, tags, null): """Query datasets. Use --collection=* to list all datasets across all collections. """ if not any([collections, discarded, list_tags, outdated, path, tags]): click.echo(ctx.get_help()) ctx.exit(1) ...
[ "def", "marvcli_query", "(", "ctx", ",", "list_tags", ",", "collections", ",", "discarded", ",", "outdated", ",", "path", ",", "tags", ",", "null", ")", ":", "if", "not", "any", "(", "[", "collections", ",", "discarded", ",", "list_tags", ",", "outdated"...
Query datasets. Use --collection=* to list all datasets across all collections.
[ "Query", "datasets", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L273-L304
47,405
ternaris/marv
marv/cli.py
marvcli_tag
def marvcli_tag(ctx, add, remove, datasets): """Add or remove tags to datasets""" if not any([add, remove]) or not datasets: click.echo(ctx.get_help()) ctx.exit(1) app = create_app() setids = parse_setids(datasets) app.site.tag(setids, add, remove)
python
def marvcli_tag(ctx, add, remove, datasets): """Add or remove tags to datasets""" if not any([add, remove]) or not datasets: click.echo(ctx.get_help()) ctx.exit(1) app = create_app() setids = parse_setids(datasets) app.site.tag(setids, add, remove)
[ "def", "marvcli_tag", "(", "ctx", ",", "add", ",", "remove", ",", "datasets", ")", ":", "if", "not", "any", "(", "[", "add", ",", "remove", "]", ")", "or", "not", "datasets", ":", "click", ".", "echo", "(", "ctx", ".", "get_help", "(", ")", ")", ...
Add or remove tags to datasets
[ "Add", "or", "remove", "tags", "to", "datasets" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L463-L471
47,406
ternaris/marv
marv/cli.py
marvcli_comment_add
def marvcli_comment_add(user, message, datasets): """Add comment as user for one or more datasets""" app = create_app() try: db.session.query(User).filter(User.name==user).one() except NoResultFound: click.echo("ERROR: No such user '{}'".format(user), err=True) sys.exit(1) id...
python
def marvcli_comment_add(user, message, datasets): """Add comment as user for one or more datasets""" app = create_app() try: db.session.query(User).filter(User.name==user).one() except NoResultFound: click.echo("ERROR: No such user '{}'".format(user), err=True) sys.exit(1) id...
[ "def", "marvcli_comment_add", "(", "user", ",", "message", ",", "datasets", ")", ":", "app", "=", "create_app", "(", ")", "try", ":", "db", ".", "session", ".", "query", "(", "User", ")", ".", "filter", "(", "User", ".", "name", "==", "user", ")", ...
Add comment as user for one or more datasets
[ "Add", "comment", "as", "user", "for", "one", "or", "more", "datasets" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L483-L492
47,407
ternaris/marv
marv/cli.py
marvcli_comment_list
def marvcli_comment_list(datasets): """Lists comments for datasets. Output: setid comment_id date time author message """ app = create_app() ids = parse_setids(datasets, dbids=True) comments = db.session.query(Comment)\ .options(db.joinedload(Comment.dataset))\ ...
python
def marvcli_comment_list(datasets): """Lists comments for datasets. Output: setid comment_id date time author message """ app = create_app() ids = parse_setids(datasets, dbids=True) comments = db.session.query(Comment)\ .options(db.joinedload(Comment.dataset))\ ...
[ "def", "marvcli_comment_list", "(", "datasets", ")", ":", "app", "=", "create_app", "(", ")", "ids", "=", "parse_setids", "(", "datasets", ",", "dbids", "=", "True", ")", "comments", "=", "db", ".", "session", ".", "query", "(", "Comment", ")", ".", "o...
Lists comments for datasets. Output: setid comment_id date time author message
[ "Lists", "comments", "for", "datasets", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L497-L510
47,408
ternaris/marv
marv/cli.py
marvcli_comment_rm
def marvcli_comment_rm(ids): """Remove comments. Remove comments by id as given in second column of: marv comment list """ app = create_app() db.session.query(Comment)\ .filter(Comment.id.in_(ids))\ .delete(synchronize_session=False) db.session.commit()
python
def marvcli_comment_rm(ids): """Remove comments. Remove comments by id as given in second column of: marv comment list """ app = create_app() db.session.query(Comment)\ .filter(Comment.id.in_(ids))\ .delete(synchronize_session=False) db.session.commit()
[ "def", "marvcli_comment_rm", "(", "ids", ")", ":", "app", "=", "create_app", "(", ")", "db", ".", "session", ".", "query", "(", "Comment", ")", ".", "filter", "(", "Comment", ".", "id", ".", "in_", "(", "ids", ")", ")", ".", "delete", "(", "synchro...
Remove comments. Remove comments by id as given in second column of: marv comment list
[ "Remove", "comments", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L515-L524
47,409
ternaris/marv
marv/cli.py
marvcli_user_list
def marvcli_user_list(): """List existing users""" app = create_app() for name in db.session.query(User.name).order_by(User.name): click.echo(name[0])
python
def marvcli_user_list(): """List existing users""" app = create_app() for name in db.session.query(User.name).order_by(User.name): click.echo(name[0])
[ "def", "marvcli_user_list", "(", ")", ":", "app", "=", "create_app", "(", ")", "for", "name", "in", "db", ".", "session", ".", "query", "(", "User", ".", "name", ")", ".", "order_by", "(", "User", ".", "name", ")", ":", "click", ".", "echo", "(", ...
List existing users
[ "List", "existing", "users" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L554-L558
47,410
ternaris/marv
marv/cli.py
marvcli_user_rm
def marvcli_user_rm(ctx, username): """Remove a user""" app = create_app() try: app.um.user_rm(username) except ValueError as e: ctx.fail(e.args[0])
python
def marvcli_user_rm(ctx, username): """Remove a user""" app = create_app() try: app.um.user_rm(username) except ValueError as e: ctx.fail(e.args[0])
[ "def", "marvcli_user_rm", "(", "ctx", ",", "username", ")", ":", "app", "=", "create_app", "(", ")", "try", ":", "app", ".", "um", ".", "user_rm", "(", "username", ")", "except", "ValueError", "as", "e", ":", "ctx", ".", "fail", "(", "e", ".", "arg...
Remove a user
[ "Remove", "a", "user" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L578-L584
47,411
originell/sorl-watermark
sorl_watermarker/engines/base.py
WatermarkEngineBase.watermark
def watermark(self, image, options): """ Wrapper for ``_watermark`` Takes care of all the options handling. """ watermark_img = options.get("watermark", settings.THUMBNAIL_WATERMARK) if not watermark_img: raise AttributeError("No THUMBNAIL_WATERMARK defined o...
python
def watermark(self, image, options): """ Wrapper for ``_watermark`` Takes care of all the options handling. """ watermark_img = options.get("watermark", settings.THUMBNAIL_WATERMARK) if not watermark_img: raise AttributeError("No THUMBNAIL_WATERMARK defined o...
[ "def", "watermark", "(", "self", ",", "image", ",", "options", ")", ":", "watermark_img", "=", "options", ".", "get", "(", "\"watermark\"", ",", "settings", ".", "THUMBNAIL_WATERMARK", ")", "if", "not", "watermark_img", ":", "raise", "AttributeError", "(", "...
Wrapper for ``_watermark`` Takes care of all the options handling.
[ "Wrapper", "for", "_watermark" ]
d9ce72a05477158520d70d70a99203b36fb66a30
https://github.com/originell/sorl-watermark/blob/d9ce72a05477158520d70d70a99203b36fb66a30/sorl_watermarker/engines/base.py#L65-L108
47,412
ternaris/marv
marv/config.py
make_funcs
def make_funcs(dataset, setdir, store): """Functions available for listing columns and filters.""" return { 'cat': lambda *lists: [x for lst in lists for x in lst], 'comments': lambda: None, 'detail_route': detail_route, 'format': lambda fmt, *args: fmt.format(*args), 'ge...
python
def make_funcs(dataset, setdir, store): """Functions available for listing columns and filters.""" return { 'cat': lambda *lists: [x for lst in lists for x in lst], 'comments': lambda: None, 'detail_route': detail_route, 'format': lambda fmt, *args: fmt.format(*args), 'ge...
[ "def", "make_funcs", "(", "dataset", ",", "setdir", ",", "store", ")", ":", "return", "{", "'cat'", ":", "lambda", "*", "lists", ":", "[", "x", "for", "lst", "in", "lists", "for", "x", "in", "lst", "]", ",", "'comments'", ":", "lambda", ":", "None"...
Functions available for listing columns and filters.
[ "Functions", "available", "for", "listing", "columns", "and", "filters", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/config.py#L48-L69
47,413
ternaris/marv
marv/config.py
make_summary_funcs
def make_summary_funcs(rows, ids): """Functions available for listing summary fields.""" return { 'len': len, 'list': lambda *x: filter(None, list(x)), 'max': max, 'min': min, 'rows': partial(summary_rows, rows, ids), 'sum': sum, 'trace': print_trace }
python
def make_summary_funcs(rows, ids): """Functions available for listing summary fields.""" return { 'len': len, 'list': lambda *x: filter(None, list(x)), 'max': max, 'min': min, 'rows': partial(summary_rows, rows, ids), 'sum': sum, 'trace': print_trace }
[ "def", "make_summary_funcs", "(", "rows", ",", "ids", ")", ":", "return", "{", "'len'", ":", "len", ",", "'list'", ":", "lambda", "*", "x", ":", "filter", "(", "None", ",", "list", "(", "x", ")", ")", ",", "'max'", ":", "max", ",", "'min'", ":", ...
Functions available for listing summary fields.
[ "Functions", "available", "for", "listing", "summary", "fields", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/config.py#L72-L82
47,414
ternaris/marv
marv/collection.py
cached_property
def cached_property(func): """Create read-only property that caches its function's value""" @functools.wraps(func) def cached_func(self): cacheattr = '_{}'.format(func.func_name) try: return getattr(self, cacheattr) except AttributeError: value = func(self) ...
python
def cached_property(func): """Create read-only property that caches its function's value""" @functools.wraps(func) def cached_func(self): cacheattr = '_{}'.format(func.func_name) try: return getattr(self, cacheattr) except AttributeError: value = func(self) ...
[ "def", "cached_property", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "cached_func", "(", "self", ")", ":", "cacheattr", "=", "'_{}'", ".", "format", "(", "func", ".", "func_name", ")", "try", ":", "return", "getattr...
Create read-only property that caches its function's value
[ "Create", "read", "-", "only", "property", "that", "caches", "its", "function", "s", "value" ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/collection.py#L169-L180
47,415
ternaris/marv
marv_node/io.py
create_stream
def create_stream(name, **header): """Create a stream for publishing messages. All keyword arguments will be used to form the header. """ assert isinstance(name, basestring), name return CreateStream(parent=None, name=name, group=False, header=header)
python
def create_stream(name, **header): """Create a stream for publishing messages. All keyword arguments will be used to form the header. """ assert isinstance(name, basestring), name return CreateStream(parent=None, name=name, group=False, header=header)
[ "def", "create_stream", "(", "name", ",", "*", "*", "header", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", ",", "name", "return", "CreateStream", "(", "parent", "=", "None", ",", "name", "=", "name", ",", "group", "=", "False"...
Create a stream for publishing messages. All keyword arguments will be used to form the header.
[ "Create", "a", "stream", "for", "publishing", "messages", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv_node/io.py#L34-L40
47,416
ternaris/marv
marv_node/io.py
pull
def pull(handle, enumerate=False): """Pulls next message for handle. Args: handle: A :class:`.stream.Handle` or GroupHandle. enumerate (bool): boolean to indicate whether a tuple ``(idx, msg)`` should be returned, not unlike Python's enumerate(). Returns: A :class:`Pull...
python
def pull(handle, enumerate=False): """Pulls next message for handle. Args: handle: A :class:`.stream.Handle` or GroupHandle. enumerate (bool): boolean to indicate whether a tuple ``(idx, msg)`` should be returned, not unlike Python's enumerate(). Returns: A :class:`Pull...
[ "def", "pull", "(", "handle", ",", "enumerate", "=", "False", ")", ":", "assert", "isinstance", "(", "handle", ",", "Handle", ")", ",", "handle", "return", "Pull", "(", "handle", ",", "enumerate", ")" ]
Pulls next message for handle. Args: handle: A :class:`.stream.Handle` or GroupHandle. enumerate (bool): boolean to indicate whether a tuple ``(idx, msg)`` should be returned, not unlike Python's enumerate(). Returns: A :class:`Pull` task to be yielded. Marv will send the ...
[ "Pulls", "next", "message", "for", "handle", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv_node/io.py#L71-L98
47,417
originell/sorl-watermark
sorl_watermarker/parsers.py
parse_geometry
def parse_geometry(geometry, ratio=None): """ Enhanced parse_geometry parser with percentage support. """ if "%" not in geometry: # fall back to old parser return xy_geometry_parser(geometry, ratio) # parse with float so geometry strings like "42.11%" are possible return float(ge...
python
def parse_geometry(geometry, ratio=None): """ Enhanced parse_geometry parser with percentage support. """ if "%" not in geometry: # fall back to old parser return xy_geometry_parser(geometry, ratio) # parse with float so geometry strings like "42.11%" are possible return float(ge...
[ "def", "parse_geometry", "(", "geometry", ",", "ratio", "=", "None", ")", ":", "if", "\"%\"", "not", "in", "geometry", ":", "# fall back to old parser", "return", "xy_geometry_parser", "(", "geometry", ",", "ratio", ")", "# parse with float so geometry strings like \"...
Enhanced parse_geometry parser with percentage support.
[ "Enhanced", "parse_geometry", "parser", "with", "percentage", "support", "." ]
d9ce72a05477158520d70d70a99203b36fb66a30
https://github.com/originell/sorl-watermark/blob/d9ce72a05477158520d70d70a99203b36fb66a30/sorl_watermarker/parsers.py#L4-L12
47,418
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
image
def image(cam): """Extract first image of input stream to jpg file. Args: cam: Input stream of raw rosbag messages. Returns: File instance for first image of input stream. """ # Set output stream title and pull first message yield marv.set_header(title=cam.topic) msg = yiel...
python
def image(cam): """Extract first image of input stream to jpg file. Args: cam: Input stream of raw rosbag messages. Returns: File instance for first image of input stream. """ # Set output stream title and pull first message yield marv.set_header(title=cam.topic) msg = yiel...
[ "def", "image", "(", "cam", ")", ":", "# Set output stream title and pull first message", "yield", "marv", ".", "set_header", "(", "title", "=", "cam", ".", "topic", ")", "msg", "=", "yield", "marv", ".", "pull", "(", "cam", ")", "if", "msg", "is", "None",...
Extract first image of input stream to jpg file. Args: cam: Input stream of raw rosbag messages. Returns: File instance for first image of input stream.
[ "Extract", "first", "image", "of", "input", "stream", "to", "jpg", "file", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L35-L60
47,419
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
image_section
def image_section(image, title): """Create detail section with one image. Args: title (str): Title to be displayed for detail section. image: marv image file. Returns One detail section. """ # pull first image img = yield marv.pull(image) if img is None: ret...
python
def image_section(image, title): """Create detail section with one image. Args: title (str): Title to be displayed for detail section. image: marv image file. Returns One detail section. """ # pull first image img = yield marv.pull(image) if img is None: ret...
[ "def", "image_section", "(", "image", ",", "title", ")", ":", "# pull first image", "img", "=", "yield", "marv", ".", "pull", "(", "image", ")", "if", "img", "is", "None", ":", "return", "# create image widget and section containing it", "widget", "=", "{", "'...
Create detail section with one image. Args: title (str): Title to be displayed for detail section. image: marv image file. Returns One detail section.
[ "Create", "detail", "section", "with", "one", "image", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L66-L84
47,420
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
images
def images(cam): """Extract images from input stream to jpg files. Args: cam: Input stream of raw rosbag messages. Returns: File instances for images of input stream. """ # Set output stream title and pull first message yield marv.set_header(title=cam.topic) # Fetch and pr...
python
def images(cam): """Extract images from input stream to jpg files. Args: cam: Input stream of raw rosbag messages. Returns: File instances for images of input stream. """ # Set output stream title and pull first message yield marv.set_header(title=cam.topic) # Fetch and pr...
[ "def", "images", "(", "cam", ")", ":", "# Set output stream title and pull first message", "yield", "marv", ".", "set_header", "(", "title", "=", "cam", ".", "topic", ")", "# Fetch and process first 20 image messages", "name_template", "=", "'%s-{}.jpg'", "%", "cam", ...
Extract images from input stream to jpg files. Args: cam: Input stream of raw rosbag messages. Returns: File instances for images of input stream.
[ "Extract", "images", "from", "input", "stream", "to", "jpg", "files", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L89-L118
47,421
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
gallery_section
def gallery_section(images, title): """Create detail section with gallery. Args: title (str): Title to be displayed for detail section. images: stream of marv image files Returns One detail section. """ # pull all images imgs = [] while True: img = yield mar...
python
def gallery_section(images, title): """Create detail section with gallery. Args: title (str): Title to be displayed for detail section. images: stream of marv image files Returns One detail section. """ # pull all images imgs = [] while True: img = yield mar...
[ "def", "gallery_section", "(", "images", ",", "title", ")", ":", "# pull all images", "imgs", "=", "[", "]", "while", "True", ":", "img", "=", "yield", "marv", ".", "pull", "(", "images", ")", "if", "img", "is", "None", ":", "break", "imgs", ".", "ap...
Create detail section with gallery. Args: title (str): Title to be displayed for detail section. images: stream of marv image files Returns One detail section.
[ "Create", "detail", "section", "with", "gallery", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L124-L147
47,422
ternaris/marv
docs/tutorial/code/marv_tutorial/__init__.py
filesizes
def filesizes(images): """Stat filesize of files. Args: images: stream of marv image files Returns: Stream of filesizes """ # Pull each image and push its filesize while True: img = yield marv.pull(images) if img is None: break yield marv.pus...
python
def filesizes(images): """Stat filesize of files. Args: images: stream of marv image files Returns: Stream of filesizes """ # Pull each image and push its filesize while True: img = yield marv.pull(images) if img is None: break yield marv.pus...
[ "def", "filesizes", "(", "images", ")", ":", "# Pull each image and push its filesize", "while", "True", ":", "img", "=", "yield", "marv", ".", "pull", "(", "images", ")", "if", "img", "is", "None", ":", "break", "yield", "marv", ".", "push", "(", "img", ...
Stat filesize of files. Args: images: stream of marv image files Returns: Stream of filesizes
[ "Stat", "filesize", "of", "files", "." ]
c221354d912ff869bbdb4f714a86a70be30d823e
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/docs/tutorial/code/marv_tutorial/__init__.py#L152-L166
47,423
kolypto/py-good
good/helpers.py
name
def name(name, validator=None): """ Set a name on a validator callable. Useful for user-friendly reporting when using lambdas to populate the [`Invalid.expected`](#invalid) field: ```python from good import Schema, name Schema(lambda x: int(x))('a') #-> Invalid: invalid literal for int(): exp...
python
def name(name, validator=None): """ Set a name on a validator callable. Useful for user-friendly reporting when using lambdas to populate the [`Invalid.expected`](#invalid) field: ```python from good import Schema, name Schema(lambda x: int(x))('a') #-> Invalid: invalid literal for int(): exp...
[ "def", "name", "(", "name", ",", "validator", "=", "None", ")", ":", "# Decorator mode", "if", "validator", "is", "None", ":", "def", "decorator", "(", "f", ")", ":", "f", ".", "name", "=", "name", "return", "f", "return", "decorator", "# Direct mode", ...
Set a name on a validator callable. Useful for user-friendly reporting when using lambdas to populate the [`Invalid.expected`](#invalid) field: ```python from good import Schema, name Schema(lambda x: int(x))('a') #-> Invalid: invalid literal for int(): expected <lambda>(), got Schema(name('i...
[ "Set", "a", "name", "on", "a", "validator", "callable", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/helpers.py#L255-L297
47,424
kolypto/py-good
good/validators/strings.py
stringmethod
def stringmethod(func): """ Validator factory which call a single method on the string. """ method_name = func() @wraps(func) def factory(): def validator(v): if not isinstance(v, six.string_types): raise Invalid(_(u'Not a string'), get_type_name(six.text_type), get_...
python
def stringmethod(func): """ Validator factory which call a single method on the string. """ method_name = func() @wraps(func) def factory(): def validator(v): if not isinstance(v, six.string_types): raise Invalid(_(u'Not a string'), get_type_name(six.text_type), get_...
[ "def", "stringmethod", "(", "func", ")", ":", "method_name", "=", "func", "(", ")", "@", "wraps", "(", "func", ")", "def", "factory", "(", ")", ":", "def", "validator", "(", "v", ")", ":", "if", "not", "isinstance", "(", "v", ",", "six", ".", "st...
Validator factory which call a single method on the string.
[ "Validator", "factory", "which", "call", "a", "single", "method", "on", "the", "string", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/validators/strings.py#L10-L21
47,425
kolypto/py-good
good/validators/dates.py
FixedOffset.parse_z
def parse_z(cls, offset): """ Parse %z offset into `timedelta` """ assert len(offset) == 5, 'Invalid offset string format, must be "+HHMM"' return timedelta(hours=int(offset[:3]), minutes=int(offset[0] + offset[3:]))
python
def parse_z(cls, offset): """ Parse %z offset into `timedelta` """ assert len(offset) == 5, 'Invalid offset string format, must be "+HHMM"' return timedelta(hours=int(offset[:3]), minutes=int(offset[0] + offset[3:]))
[ "def", "parse_z", "(", "cls", ",", "offset", ")", ":", "assert", "len", "(", "offset", ")", "==", "5", ",", "'Invalid offset string format, must be \"+HHMM\"'", "return", "timedelta", "(", "hours", "=", "int", "(", "offset", "[", ":", "3", "]", ")", ",", ...
Parse %z offset into `timedelta`
[ "Parse", "%z", "offset", "into", "timedelta" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/validators/dates.py#L25-L28
47,426
kolypto/py-good
good/validators/dates.py
FixedOffset.format_z
def format_z(cls, offset): """ Format `timedelta` into %z """ sec = offset.total_seconds() return '{s}{h:02d}{m:02d}'.format(s='-' if sec<0 else '+', h=abs(int(sec/3600)), m=int((sec%3600)/60))
python
def format_z(cls, offset): """ Format `timedelta` into %z """ sec = offset.total_seconds() return '{s}{h:02d}{m:02d}'.format(s='-' if sec<0 else '+', h=abs(int(sec/3600)), m=int((sec%3600)/60))
[ "def", "format_z", "(", "cls", ",", "offset", ")", ":", "sec", "=", "offset", ".", "total_seconds", "(", ")", "return", "'{s}{h:02d}{m:02d}'", ".", "format", "(", "s", "=", "'-'", "if", "sec", "<", "0", "else", "'+'", ",", "h", "=", "abs", "(", "in...
Format `timedelta` into %z
[ "Format", "timedelta", "into", "%z" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/validators/dates.py#L31-L34
47,427
kolypto/py-good
good/validators/dates.py
DateTime.strptime
def strptime(cls, value, format): """ Parse a datetime string using the provided format. This also emulates `%z` support on Python 2. :param value: Datetime string :type value: str :param format: Format to use for parsing :type format: str :rtype: datetime ...
python
def strptime(cls, value, format): """ Parse a datetime string using the provided format. This also emulates `%z` support on Python 2. :param value: Datetime string :type value: str :param format: Format to use for parsing :type format: str :rtype: datetime ...
[ "def", "strptime", "(", "cls", ",", "value", ",", "format", ")", ":", "# Simplest case: direct parsing", "if", "cls", ".", "python_supports_z", "or", "'%z'", "not", "in", "format", ":", "return", "datetime", ".", "strptime", "(", "value", ",", "format", ")",...
Parse a datetime string using the provided format. This also emulates `%z` support on Python 2. :param value: Datetime string :type value: str :param format: Format to use for parsing :type format: str :rtype: datetime :raises ValueError: Invalid format ...
[ "Parse", "a", "datetime", "string", "using", "the", "provided", "format", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/validators/dates.py#L235-L260
47,428
kolypto/py-good
misc/performance/performance.py
generate_random_type
def generate_random_type(valid): """ Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator """ type = choice(['int', 'str']) r = lambda: randrange(-1000000000, 1000000000) if type ...
python
def generate_random_type(valid): """ Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator """ type = choice(['int', 'str']) r = lambda: randrange(-1000000000, 1000000000) if type ...
[ "def", "generate_random_type", "(", "valid", ")", ":", "type", "=", "choice", "(", "[", "'int'", ",", "'str'", "]", ")", "r", "=", "lambda", ":", "randrange", "(", "-", "1000000000", ",", "1000000000", ")", "if", "type", "==", "'int'", ":", "return", ...
Generate a random type and samples for it. :param valid: Generate valid samples? :type valid: bool :return: type, sample-generator :rtype: type, generator
[ "Generate", "a", "random", "type", "and", "samples", "for", "it", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/misc/performance/performance.py#L13-L30
47,429
kolypto/py-good
misc/performance/performance.py
generate_random_schema
def generate_random_schema(valid): """ Generate a random plain schema, and a sample generation function. :param valid: Generate valid samples? :type valid: bool :returns: schema, sample-generator :rtype: *, generator """ schema_type = choice(['literal', 'type']) if schema_type == 'lite...
python
def generate_random_schema(valid): """ Generate a random plain schema, and a sample generation function. :param valid: Generate valid samples? :type valid: bool :returns: schema, sample-generator :rtype: *, generator """ schema_type = choice(['literal', 'type']) if schema_type == 'lite...
[ "def", "generate_random_schema", "(", "valid", ")", ":", "schema_type", "=", "choice", "(", "[", "'literal'", ",", "'type'", "]", ")", "if", "schema_type", "==", "'literal'", ":", "type", ",", "gen", "=", "generate_random_type", "(", "valid", ")", "value", ...
Generate a random plain schema, and a sample generation function. :param valid: Generate valid samples? :type valid: bool :returns: schema, sample-generator :rtype: *, generator
[ "Generate", "a", "random", "plain", "schema", "and", "a", "sample", "generation", "function", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/misc/performance/performance.py#L33-L50
47,430
kolypto/py-good
misc/performance/performance.py
generate_dict_schema
def generate_dict_schema(size, valid): """ Generate a schema dict of size `size` using library `lib`. In addition, it returns samples generator :param size: Schema size :type size: int :param samples: The number of samples to generate :type samples: int :param valid: Generate valid samples...
python
def generate_dict_schema(size, valid): """ Generate a schema dict of size `size` using library `lib`. In addition, it returns samples generator :param size: Schema size :type size: int :param samples: The number of samples to generate :type samples: int :param valid: Generate valid samples...
[ "def", "generate_dict_schema", "(", "size", ",", "valid", ")", ":", "schema", "=", "{", "}", "generator_items", "=", "[", "]", "# Generate schema", "for", "i", "in", "range", "(", "0", ",", "size", ")", ":", "while", "True", ":", "key_schema", ",", "ke...
Generate a schema dict of size `size` using library `lib`. In addition, it returns samples generator :param size: Schema size :type size: int :param samples: The number of samples to generate :type samples: int :param valid: Generate valid samples? :type valid: bool :returns
[ "Generate", "a", "schema", "dict", "of", "size", "size", "using", "library", "lib", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/misc/performance/performance.py#L53-L85
47,431
scot-dev/scot
scot/varbase.py
_calc_q_statistic
def _calc_q_statistic(x, h, nt): """Calculate Portmanteau statistics up to a lag of h. """ t, m, n = x.shape # covariance matrix of x c0 = acm(x, 0) # LU factorization of covariance matrix c0f = sp.linalg.lu_factor(c0, overwrite_a=False, check_finite=True) q = np.zeros((3, h + 1)) ...
python
def _calc_q_statistic(x, h, nt): """Calculate Portmanteau statistics up to a lag of h. """ t, m, n = x.shape # covariance matrix of x c0 = acm(x, 0) # LU factorization of covariance matrix c0f = sp.linalg.lu_factor(c0, overwrite_a=False, check_finite=True) q = np.zeros((3, h + 1)) ...
[ "def", "_calc_q_statistic", "(", "x", ",", "h", ",", "nt", ")", ":", "t", ",", "m", ",", "n", "=", "x", ".", "shape", "# covariance matrix of x", "c0", "=", "acm", "(", "x", ",", "0", ")", "# LU factorization of covariance matrix", "c0f", "=", "sp", "....
Calculate Portmanteau statistics up to a lag of h.
[ "Calculate", "Portmanteau", "statistics", "up", "to", "a", "lag", "of", "h", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L437-L474
47,432
scot-dev/scot
scot/varbase.py
_calc_q_h0
def _calc_q_h0(n, x, h, nt, n_jobs=1, verbose=0, random_state=None): """Calculate q under the null hypothesis of whiteness. """ rng = check_random_state(random_state) par, func = parallel_loop(_calc_q_statistic, n_jobs, verbose) q = par(func(rng.permutation(x.T).T, h, nt) for _ in range(n)) ...
python
def _calc_q_h0(n, x, h, nt, n_jobs=1, verbose=0, random_state=None): """Calculate q under the null hypothesis of whiteness. """ rng = check_random_state(random_state) par, func = parallel_loop(_calc_q_statistic, n_jobs, verbose) q = par(func(rng.permutation(x.T).T, h, nt) for _ in range(n)) ...
[ "def", "_calc_q_h0", "(", "n", ",", "x", ",", "h", ",", "nt", ",", "n_jobs", "=", "1", ",", "verbose", "=", "0", ",", "random_state", "=", "None", ")", ":", "rng", "=", "check_random_state", "(", "random_state", ")", "par", ",", "func", "=", "paral...
Calculate q under the null hypothesis of whiteness.
[ "Calculate", "q", "under", "the", "null", "hypothesis", "of", "whiteness", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L477-L484
47,433
scot-dev/scot
scot/varbase.py
VARBase.copy
def copy(self): """Create a copy of the VAR model.""" other = self.__class__(self.p) other.coef = self.coef.copy() other.residuals = self.residuals.copy() other.rescov = self.rescov.copy() return other
python
def copy(self): """Create a copy of the VAR model.""" other = self.__class__(self.p) other.coef = self.coef.copy() other.residuals = self.residuals.copy() other.rescov = self.rescov.copy() return other
[ "def", "copy", "(", "self", ")", ":", "other", "=", "self", ".", "__class__", "(", "self", ".", "p", ")", "other", ".", "coef", "=", "self", ".", "coef", ".", "copy", "(", ")", "other", ".", "residuals", "=", "self", ".", "residuals", ".", "copy"...
Create a copy of the VAR model.
[ "Create", "a", "copy", "of", "the", "VAR", "model", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L74-L80
47,434
scot-dev/scot
scot/varbase.py
VARBase.from_yw
def from_yw(self, acms): """Determine VAR model from autocorrelation matrices by solving the Yule-Walker equations. Parameters ---------- acms : array, shape (n_lags, n_channels, n_channels) acms[l] contains the autocorrelation matrix at lag l. The highest ...
python
def from_yw(self, acms): """Determine VAR model from autocorrelation matrices by solving the Yule-Walker equations. Parameters ---------- acms : array, shape (n_lags, n_channels, n_channels) acms[l] contains the autocorrelation matrix at lag l. The highest ...
[ "def", "from_yw", "(", "self", ",", "acms", ")", ":", "if", "len", "(", "acms", ")", "!=", "self", ".", "p", "+", "1", ":", "raise", "ValueError", "(", "\"Number of autocorrelation matrices ({}) does not\"", "\" match model order ({}) + 1.\"", ".", "format", "("...
Determine VAR model from autocorrelation matrices by solving the Yule-Walker equations. Parameters ---------- acms : array, shape (n_lags, n_channels, n_channels) acms[l] contains the autocorrelation matrix at lag l. The highest lag must equal the model order. ...
[ "Determine", "VAR", "model", "from", "autocorrelation", "matrices", "by", "solving", "the", "Yule", "-", "Walker", "equations", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L114-L156
47,435
scot-dev/scot
scot/varbase.py
VARBase.predict
def predict(self, data): """Predict samples on actual data. The result of this function is used for calculating the residuals. Parameters ---------- data : array, shape (trials, channels, samples) or (channels, samples) Epoched or continuous data set. Retur...
python
def predict(self, data): """Predict samples on actual data. The result of this function is used for calculating the residuals. Parameters ---------- data : array, shape (trials, channels, samples) or (channels, samples) Epoched or continuous data set. Retur...
[ "def", "predict", "(", "self", ",", "data", ")", ":", "data", "=", "atleast_3d", "(", "data", ")", "t", ",", "m", ",", "l", "=", "data", ".", "shape", "p", "=", "int", "(", "np", ".", "shape", "(", "self", ".", "coef", ")", "[", "1", "]", "...
Predict samples on actual data. The result of this function is used for calculating the residuals. Parameters ---------- data : array, shape (trials, channels, samples) or (channels, samples) Epoched or continuous data set. Returns ------- predicted...
[ "Predict", "samples", "on", "actual", "data", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L212-L248
47,436
scot-dev/scot
scot/varbase.py
VARBase.is_stable
def is_stable(self): """Test if VAR model is stable. This function tests stability of the VAR model as described in [1]_. Returns ------- out : bool True if the model is stable. References ---------- .. [1] H. Lütkepohl, "New Introduction to...
python
def is_stable(self): """Test if VAR model is stable. This function tests stability of the VAR model as described in [1]_. Returns ------- out : bool True if the model is stable. References ---------- .. [1] H. Lütkepohl, "New Introduction to...
[ "def", "is_stable", "(", "self", ")", ":", "m", ",", "mp", "=", "self", ".", "coef", ".", "shape", "p", "=", "mp", "//", "m", "assert", "(", "mp", "==", "m", "*", "p", ")", "# TODO: replace with raise?", "top_block", "=", "[", "]", "for", "i", "i...
Test if VAR model is stable. This function tests stability of the VAR model as described in [1]_. Returns ------- out : bool True if the model is stable. References ---------- .. [1] H. Lütkepohl, "New Introduction to Multiple Time Series ...
[ "Test", "if", "VAR", "model", "is", "stable", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/varbase.py#L250-L282
47,437
scot-dev/scot
scot/datasets.py
fetch
def fetch(dataset="mi", datadir=datadir): """Fetch example dataset. If the requested dataset is not found in the location specified by `datadir`, the function attempts to download it. Parameters ---------- dataset : str Which dataset to load. Currently only 'mi' is supported. datad...
python
def fetch(dataset="mi", datadir=datadir): """Fetch example dataset. If the requested dataset is not found in the location specified by `datadir`, the function attempts to download it. Parameters ---------- dataset : str Which dataset to load. Currently only 'mi' is supported. datad...
[ "def", "fetch", "(", "dataset", "=", "\"mi\"", ",", "datadir", "=", "datadir", ")", ":", "if", "dataset", "not", "in", "datasets", ":", "raise", "ValueError", "(", "\"Example data '{}' not available.\"", ".", "format", "(", "dataset", ")", ")", "else", ":", ...
Fetch example dataset. If the requested dataset is not found in the location specified by `datadir`, the function attempts to download it. Parameters ---------- dataset : str Which dataset to load. Currently only 'mi' is supported. datadir : str Path to the storage location of ...
[ "Fetch", "example", "dataset", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datasets.py#L21-L71
47,438
kolypto/py-good
good/schema/compiler.py
CompiledSchema.supports_undefined
def supports_undefined(self): """ Test whether this schema supports Undefined. A Schema that supports `Undefined`, when given `Undefined`, should return some value (other than `Undefined`) without raising errors. This is designed to support a very special case like that: ```py...
python
def supports_undefined(self): """ Test whether this schema supports Undefined. A Schema that supports `Undefined`, when given `Undefined`, should return some value (other than `Undefined`) without raising errors. This is designed to support a very special case like that: ```py...
[ "def", "supports_undefined", "(", "self", ")", ":", "# Test", "try", ":", "yes", "=", "self", "(", "const", ".", "UNDEFINED", ")", "is", "not", "const", ".", "UNDEFINED", "except", "(", "Invalid", ",", "SchemaError", ")", ":", "yes", "=", "False", "# R...
Test whether this schema supports Undefined. A Schema that supports `Undefined`, when given `Undefined`, should return some value (other than `Undefined`) without raising errors. This is designed to support a very special case like that: ```python Schema(Default(0)).supports_u...
[ "Test", "whether", "this", "schema", "supports", "Undefined", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L85-L113
47,439
kolypto/py-good
good/schema/compiler.py
CompiledSchema.get_schema_type
def get_schema_type(cls, schema): """ Get schema type for the argument :param schema: Schema to analyze :return: COMPILED_TYPE constant :rtype: str|None """ schema_type = type(schema) # Marker if issubclass(schema_type, markers.Marker): retur...
python
def get_schema_type(cls, schema): """ Get schema type for the argument :param schema: Schema to analyze :return: COMPILED_TYPE constant :rtype: str|None """ schema_type = type(schema) # Marker if issubclass(schema_type, markers.Marker): retur...
[ "def", "get_schema_type", "(", "cls", ",", "schema", ")", ":", "schema_type", "=", "type", "(", "schema", ")", "# Marker", "if", "issubclass", "(", "schema_type", ",", "markers", ".", "Marker", ")", ":", "return", "const", ".", "COMPILED_TYPE", ".", "MARKE...
Get schema type for the argument :param schema: Schema to analyze :return: COMPILED_TYPE constant :rtype: str|None
[ "Get", "schema", "type", "for", "the", "argument" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L118-L137
47,440
kolypto/py-good
good/schema/compiler.py
CompiledSchema.priority
def priority(self): """ Get priority for this Schema. Used to sort mapping keys :rtype: int """ # Markers have priority set on the class if self.compiled_type == const.COMPILED_TYPE.MARKER: return self.compiled.priority # Other types have static pri...
python
def priority(self): """ Get priority for this Schema. Used to sort mapping keys :rtype: int """ # Markers have priority set on the class if self.compiled_type == const.COMPILED_TYPE.MARKER: return self.compiled.priority # Other types have static pri...
[ "def", "priority", "(", "self", ")", ":", "# Markers have priority set on the class", "if", "self", ".", "compiled_type", "==", "const", ".", "COMPILED_TYPE", ".", "MARKER", ":", "return", "self", ".", "compiled", ".", "priority", "# Other types have static priority",...
Get priority for this Schema. Used to sort mapping keys :rtype: int
[ "Get", "priority", "for", "this", "Schema", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L140-L152
47,441
kolypto/py-good
good/schema/compiler.py
CompiledSchema.sort_schemas
def sort_schemas(cls, schemas_list): """ Sort the provided list of schemas according to their priority. This also supports markers, and markers of a single type are also sorted according to the priority of the wrapped schema. :type schemas_list: list[CompiledSchema] :rtype: list[Compil...
python
def sort_schemas(cls, schemas_list): """ Sort the provided list of schemas according to their priority. This also supports markers, and markers of a single type are also sorted according to the priority of the wrapped schema. :type schemas_list: list[CompiledSchema] :rtype: list[Compil...
[ "def", "sort_schemas", "(", "cls", ",", "schemas_list", ")", ":", "return", "sorted", "(", "schemas_list", ",", "key", "=", "lambda", "x", ":", "(", "# Top-level priority:", "# priority of the schema itself", "x", ".", "priority", ",", "# Second-level priority (for ...
Sort the provided list of schemas according to their priority. This also supports markers, and markers of a single type are also sorted according to the priority of the wrapped schema. :type schemas_list: list[CompiledSchema] :rtype: list[CompiledSchema]
[ "Sort", "the", "provided", "list", "of", "schemas", "according", "to", "their", "priority", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L155-L171
47,442
kolypto/py-good
good/schema/compiler.py
CompiledSchema.sub_compile
def sub_compile(self, schema, path=None, matcher=False): """ Compile a sub-schema :param schema: Validation schema :type schema: * :param path: Path to this schema, if any :type path: list|None :param matcher: Compile a matcher? :type matcher: bool :rtype...
python
def sub_compile(self, schema, path=None, matcher=False): """ Compile a sub-schema :param schema: Validation schema :type schema: * :param path: Path to this schema, if any :type path: list|None :param matcher: Compile a matcher? :type matcher: bool :rtype...
[ "def", "sub_compile", "(", "self", ",", "schema", ",", "path", "=", "None", ",", "matcher", "=", "False", ")", ":", "return", "type", "(", "self", ")", "(", "schema", ",", "self", ".", "path", "+", "(", "path", "or", "[", "]", ")", ",", "None", ...
Compile a sub-schema :param schema: Validation schema :type schema: * :param path: Path to this schema, if any :type path: list|None :param matcher: Compile a matcher? :type matcher: bool :rtype: CompiledSchema
[ "Compile", "a", "sub", "-", "schema" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L173-L190
47,443
kolypto/py-good
good/schema/compiler.py
CompiledSchema.Invalid
def Invalid(self, message, expected): """ Helper for Invalid errors. Typical use: err_type = self.Invalid(_(u'Message'), self.name) raise err_type(<provided-value>) Note: `provided` and `expected` are unicode-typecasted automatically :type message: unicode :ty...
python
def Invalid(self, message, expected): """ Helper for Invalid errors. Typical use: err_type = self.Invalid(_(u'Message'), self.name) raise err_type(<provided-value>) Note: `provided` and `expected` are unicode-typecasted automatically :type message: unicode :ty...
[ "def", "Invalid", "(", "self", ",", "message", ",", "expected", ")", ":", "def", "InvalidPartial", "(", "provided", ",", "path", "=", "None", ",", "*", "*", "info", ")", ":", "\"\"\" Create an Invalid exception\n\n :type provided: unicode\n :type...
Helper for Invalid errors. Typical use: err_type = self.Invalid(_(u'Message'), self.name) raise err_type(<provided-value>) Note: `provided` and `expected` are unicode-typecasted automatically :type message: unicode :type expected: unicode
[ "Helper", "for", "Invalid", "errors", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L192-L220
47,444
kolypto/py-good
good/schema/compiler.py
CompiledSchema.get_schema_compiler
def get_schema_compiler(self, schema): """ Get compiler method for the provided schema :param schema: Schema to analyze :return: Callable compiled :rtype: callable|None """ # Schema type schema_type = self.get_schema_type(schema) if schema_type is None: ...
python
def get_schema_compiler(self, schema): """ Get compiler method for the provided schema :param schema: Schema to analyze :return: Callable compiled :rtype: callable|None """ # Schema type schema_type = self.get_schema_type(schema) if schema_type is None: ...
[ "def", "get_schema_compiler", "(", "self", ",", "schema", ")", ":", "# Schema type", "schema_type", "=", "self", ".", "get_schema_type", "(", "schema", ")", "if", "schema_type", "is", "None", ":", "return", "None", "# Compiler", "compilers", "=", "{", "const",...
Get compiler method for the provided schema :param schema: Schema to analyze :return: Callable compiled :rtype: callable|None
[ "Get", "compiler", "method", "for", "the", "provided", "schema" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L226-L250
47,445
kolypto/py-good
good/schema/compiler.py
CompiledSchema.compile_schema
def compile_schema(self, schema): """ Compile the current schema into a callable validator :return: Callable validator :rtype: callable :raises SchemaError: Schema compilation error """ compiler = self.get_schema_compiler(schema) if compiler is None: ...
python
def compile_schema(self, schema): """ Compile the current schema into a callable validator :return: Callable validator :rtype: callable :raises SchemaError: Schema compilation error """ compiler = self.get_schema_compiler(schema) if compiler is None: ...
[ "def", "compile_schema", "(", "self", ",", "schema", ")", ":", "compiler", "=", "self", ".", "get_schema_compiler", "(", "schema", ")", "if", "compiler", "is", "None", ":", "raise", "SchemaError", "(", "_", "(", "u'Unsupported schema data type {!r}'", ")", "."...
Compile the current schema into a callable validator :return: Callable validator :rtype: callable :raises SchemaError: Schema compilation error
[ "Compile", "the", "current", "schema", "into", "a", "callable", "validator" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L252-L264
47,446
kolypto/py-good
good/schema/compiler.py
CompiledSchema._compile_schema
def _compile_schema(self, schema): """ Compile another schema """ assert self.matcher == schema.matcher self.name = schema.name self.compiled_type = schema.compiled_type return schema.compiled
python
def _compile_schema(self, schema): """ Compile another schema """ assert self.matcher == schema.matcher self.name = schema.name self.compiled_type = schema.compiled_type return schema.compiled
[ "def", "_compile_schema", "(", "self", ",", "schema", ")", ":", "assert", "self", ".", "matcher", "==", "schema", ".", "matcher", "self", ".", "name", "=", "schema", ".", "name", "self", ".", "compiled_type", "=", "schema", ".", "compiled_type", "return", ...
Compile another schema
[ "Compile", "another", "schema" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/compiler.py#L331-L338
47,447
scot-dev/scot
scot/matfiles.py
loadmat
def loadmat(filename): """This function should be called instead of direct spio.loadmat as it cures the problem of not properly recovering python dictionaries from mat files. It calls the function check keys to cure all entries which are still mat-objects """ data = sploadmat(filename, struct_as...
python
def loadmat(filename): """This function should be called instead of direct spio.loadmat as it cures the problem of not properly recovering python dictionaries from mat files. It calls the function check keys to cure all entries which are still mat-objects """ data = sploadmat(filename, struct_as...
[ "def", "loadmat", "(", "filename", ")", ":", "data", "=", "sploadmat", "(", "filename", ",", "struct_as_record", "=", "False", ",", "squeeze_me", "=", "True", ")", "return", "_check_keys", "(", "data", ")" ]
This function should be called instead of direct spio.loadmat as it cures the problem of not properly recovering python dictionaries from mat files. It calls the function check keys to cure all entries which are still mat-objects
[ "This", "function", "should", "be", "called", "instead", "of", "direct", "spio", ".", "loadmat", "as", "it", "cures", "the", "problem", "of", "not", "properly", "recovering", "python", "dictionaries", "from", "mat", "files", ".", "It", "calls", "the", "funct...
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/matfiles.py#L12-L19
47,448
scot-dev/scot
scot/matfiles.py
_check_keys
def _check_keys(dictionary): """ checks if entries in dictionary are mat-objects. If yes todict is called to change them to nested dictionaries """ for key in dictionary: if isinstance(dictionary[key], matlab.mio5_params.mat_struct): dictionary[key] = _todict(dictionary[key]) ...
python
def _check_keys(dictionary): """ checks if entries in dictionary are mat-objects. If yes todict is called to change them to nested dictionaries """ for key in dictionary: if isinstance(dictionary[key], matlab.mio5_params.mat_struct): dictionary[key] = _todict(dictionary[key]) ...
[ "def", "_check_keys", "(", "dictionary", ")", ":", "for", "key", "in", "dictionary", ":", "if", "isinstance", "(", "dictionary", "[", "key", "]", ",", "matlab", ".", "mio5_params", ".", "mat_struct", ")", ":", "dictionary", "[", "key", "]", "=", "_todict...
checks if entries in dictionary are mat-objects. If yes todict is called to change them to nested dictionaries
[ "checks", "if", "entries", "in", "dictionary", "are", "mat", "-", "objects", ".", "If", "yes", "todict", "is", "called", "to", "change", "them", "to", "nested", "dictionaries" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/matfiles.py#L25-L33
47,449
scot-dev/scot
scot/matfiles.py
_todict
def _todict(matobj): """ a recursive function which constructs from matobjects nested dictionaries """ dictionary = {} #noinspection PyProtectedMember for strg in matobj._fieldnames: elem = matobj.__dict__[strg] if isinstance(elem, matlab.mio5_params.mat_struct): dict...
python
def _todict(matobj): """ a recursive function which constructs from matobjects nested dictionaries """ dictionary = {} #noinspection PyProtectedMember for strg in matobj._fieldnames: elem = matobj.__dict__[strg] if isinstance(elem, matlab.mio5_params.mat_struct): dict...
[ "def", "_todict", "(", "matobj", ")", ":", "dictionary", "=", "{", "}", "#noinspection PyProtectedMember", "for", "strg", "in", "matobj", ".", "_fieldnames", ":", "elem", "=", "matobj", ".", "__dict__", "[", "strg", "]", "if", "isinstance", "(", "elem", ",...
a recursive function which constructs from matobjects nested dictionaries
[ "a", "recursive", "function", "which", "constructs", "from", "matobjects", "nested", "dictionaries" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/matfiles.py#L36-L48
47,450
scot-dev/scot
scot/plainica.py
plainica
def plainica(x, reducedim=0.99, backend=None, random_state=None): """ Source decomposition with ICA. Apply ICA to the data x, with optional PCA dimensionality reduction. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) or (n_channels, n_samples) data set reduced...
python
def plainica(x, reducedim=0.99, backend=None, random_state=None): """ Source decomposition with ICA. Apply ICA to the data x, with optional PCA dimensionality reduction. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) or (n_channels, n_samples) data set reduced...
[ "def", "plainica", "(", "x", ",", "reducedim", "=", "0.99", ",", "backend", "=", "None", ",", "random_state", "=", "None", ")", ":", "x", "=", "atleast_3d", "(", "x", ")", "t", ",", "m", ",", "l", "=", "np", ".", "shape", "(", "x", ")", "if", ...
Source decomposition with ICA. Apply ICA to the data x, with optional PCA dimensionality reduction. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) or (n_channels, n_samples) data set reducedim : {int, float, 'no_pca'}, optional A number of less than 1 in i...
[ "Source", "decomposition", "with", "ICA", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plainica.py#L29-L77
47,451
scot-dev/scot
scot/var.py
_msge_with_gradient_underdetermined
def _msge_with_gradient_underdetermined(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient for underdetermined equation system. """ t, m, l = data.shape d = None j, k = 0, 0 nt = np.ceil(t / skipstep) for trainset, testset in xvschema(t, ...
python
def _msge_with_gradient_underdetermined(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient for underdetermined equation system. """ t, m, l = data.shape d = None j, k = 0, 0 nt = np.ceil(t / skipstep) for trainset, testset in xvschema(t, ...
[ "def", "_msge_with_gradient_underdetermined", "(", "data", ",", "delta", ",", "xvschema", ",", "skipstep", ",", "p", ")", ":", "t", ",", "m", ",", "l", "=", "data", ".", "shape", "d", "=", "None", "j", ",", "k", "=", "0", ",", "0", "nt", "=", "np...
Calculate mean squared generalization error and its gradient for underdetermined equation system.
[ "Calculate", "mean", "squared", "generalization", "error", "and", "its", "gradient", "for", "underdetermined", "equation", "system", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/var.py#L218-L245
47,452
scot-dev/scot
scot/var.py
_msge_with_gradient_overdetermined
def _msge_with_gradient_overdetermined(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient for overdetermined equation system. """ t, m, l = data.shape d = None l, k = 0, 0 nt = np.ceil(t / skipstep) for trainset, testset in xvschema(t, sk...
python
def _msge_with_gradient_overdetermined(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient for overdetermined equation system. """ t, m, l = data.shape d = None l, k = 0, 0 nt = np.ceil(t / skipstep) for trainset, testset in xvschema(t, sk...
[ "def", "_msge_with_gradient_overdetermined", "(", "data", ",", "delta", ",", "xvschema", ",", "skipstep", ",", "p", ")", ":", "t", ",", "m", ",", "l", "=", "data", ".", "shape", "d", "=", "None", "l", ",", "k", "=", "0", ",", "0", "nt", "=", "np"...
Calculate mean squared generalization error and its gradient for overdetermined equation system.
[ "Calculate", "mean", "squared", "generalization", "error", "and", "its", "gradient", "for", "overdetermined", "equation", "system", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/var.py#L248-L272
47,453
scot-dev/scot
scot/var.py
_get_msge_with_gradient
def _get_msge_with_gradient(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient, automatically selecting the best function. """ t, m, l = data.shape n = (l - p) * t underdetermined = n < m * p if underdetermined: return _msge_with_gr...
python
def _get_msge_with_gradient(data, delta, xvschema, skipstep, p): """Calculate mean squared generalization error and its gradient, automatically selecting the best function. """ t, m, l = data.shape n = (l - p) * t underdetermined = n < m * p if underdetermined: return _msge_with_gr...
[ "def", "_get_msge_with_gradient", "(", "data", ",", "delta", ",", "xvschema", ",", "skipstep", ",", "p", ")", ":", "t", ",", "m", ",", "l", "=", "data", ".", "shape", "n", "=", "(", "l", "-", "p", ")", "*", "t", "underdetermined", "=", "n", "<", ...
Calculate mean squared generalization error and its gradient, automatically selecting the best function.
[ "Calculate", "mean", "squared", "generalization", "error", "and", "its", "gradient", "automatically", "selecting", "the", "best", "function", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/var.py#L290-L304
47,454
scot-dev/scot
scot/var.py
VAR.optimize_order
def optimize_order(self, data, min_p=1, max_p=None): """Determine optimal model order by minimizing the mean squared generalization error. Parameters ---------- data : array, shape (n_trials, n_channels, n_samples) Epoched data set on which to optimize the model orde...
python
def optimize_order(self, data, min_p=1, max_p=None): """Determine optimal model order by minimizing the mean squared generalization error. Parameters ---------- data : array, shape (n_trials, n_channels, n_samples) Epoched data set on which to optimize the model orde...
[ "def", "optimize_order", "(", "self", ",", "data", ",", "min_p", "=", "1", ",", "max_p", "=", "None", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "data", ".", "shape", "[", "0", "]", "<", "2", ":", "raise", "ValueError", ...
Determine optimal model order by minimizing the mean squared generalization error. Parameters ---------- data : array, shape (n_trials, n_channels, n_samples) Epoched data set on which to optimize the model order. At least two trials are required. min_p :...
[ "Determine", "optimal", "model", "order", "by", "minimizing", "the", "mean", "squared", "generalization", "error", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/var.py#L84-L131
47,455
scot-dev/scot
scot/eegtopo/geo_spherical.py
Point.fromvector
def fromvector(cls, v): """Initialize from euclidean vector""" w = v.normalized() return cls(w.x, w.y, w.z)
python
def fromvector(cls, v): """Initialize from euclidean vector""" w = v.normalized() return cls(w.x, w.y, w.z)
[ "def", "fromvector", "(", "cls", ",", "v", ")", ":", "w", "=", "v", ".", "normalized", "(", ")", "return", "cls", "(", "w", ".", "x", ",", "w", ".", "y", ",", "w", ".", "z", ")" ]
Initialize from euclidean vector
[ "Initialize", "from", "euclidean", "vector" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_spherical.py#L34-L37
47,456
scot-dev/scot
scot/eegtopo/geo_spherical.py
Point.list
def list(self): """position in 3d space""" return [self._pos3d.x, self._pos3d.y, self._pos3d.z]
python
def list(self): """position in 3d space""" return [self._pos3d.x, self._pos3d.y, self._pos3d.z]
[ "def", "list", "(", "self", ")", ":", "return", "[", "self", ".", "_pos3d", ".", "x", ",", "self", ".", "_pos3d", ".", "y", ",", "self", ".", "_pos3d", ".", "z", "]" ]
position in 3d space
[ "position", "in", "3d", "space" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_spherical.py#L45-L47
47,457
scot-dev/scot
scot/eegtopo/geo_spherical.py
Point.distance
def distance(self, other): """Distance to another point on the sphere""" return math.acos(self._pos3d.dot(other.vector))
python
def distance(self, other): """Distance to another point on the sphere""" return math.acos(self._pos3d.dot(other.vector))
[ "def", "distance", "(", "self", ",", "other", ")", ":", "return", "math", ".", "acos", "(", "self", ".", "_pos3d", ".", "dot", "(", "other", ".", "vector", ")", ")" ]
Distance to another point on the sphere
[ "Distance", "to", "another", "point", "on", "the", "sphere" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_spherical.py#L59-L61
47,458
scot-dev/scot
scot/eegtopo/geo_spherical.py
Point.distances
def distances(self, points): """Distance to other points on the sphere""" return [math.acos(self._pos3d.dot(p.vector)) for p in points]
python
def distances(self, points): """Distance to other points on the sphere""" return [math.acos(self._pos3d.dot(p.vector)) for p in points]
[ "def", "distances", "(", "self", ",", "points", ")", ":", "return", "[", "math", ".", "acos", "(", "self", ".", "_pos3d", ".", "dot", "(", "p", ".", "vector", ")", ")", "for", "p", "in", "points", "]" ]
Distance to other points on the sphere
[ "Distance", "to", "other", "points", "on", "the", "sphere" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_spherical.py#L63-L65
47,459
scot-dev/scot
scot/eegtopo/geo_euclidean.py
Vector.fromiterable
def fromiterable(cls, itr): """Initialize from iterable""" x, y, z = itr return cls(x, y, z)
python
def fromiterable(cls, itr): """Initialize from iterable""" x, y, z = itr return cls(x, y, z)
[ "def", "fromiterable", "(", "cls", ",", "itr", ")", ":", "x", ",", "y", ",", "z", "=", "itr", "return", "cls", "(", "x", ",", "y", ",", "z", ")" ]
Initialize from iterable
[ "Initialize", "from", "iterable" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_euclidean.py#L20-L23
47,460
scot-dev/scot
scot/eegtopo/geo_euclidean.py
Vector.fromvector
def fromvector(cls, v): """Copy another vector""" return cls(v.x, v.y, v.z)
python
def fromvector(cls, v): """Copy another vector""" return cls(v.x, v.y, v.z)
[ "def", "fromvector", "(", "cls", ",", "v", ")", ":", "return", "cls", "(", "v", ".", "x", ",", "v", ".", "y", ",", "v", ".", "z", ")" ]
Copy another vector
[ "Copy", "another", "vector" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_euclidean.py#L26-L28
47,461
scot-dev/scot
scot/eegtopo/geo_euclidean.py
Vector.norm2
def norm2(self): """Squared norm of the vector""" return self.x * self.x + self.y * self.y + self.z * self.z
python
def norm2(self): """Squared norm of the vector""" return self.x * self.x + self.y * self.y + self.z * self.z
[ "def", "norm2", "(", "self", ")", ":", "return", "self", ".", "x", "*", "self", ".", "x", "+", "self", ".", "y", "*", "self", ".", "y", "+", "self", ".", "z", "*", "self", ".", "z" ]
Squared norm of the vector
[ "Squared", "norm", "of", "the", "vector" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_euclidean.py#L127-L129
47,462
scot-dev/scot
scot/eegtopo/geo_euclidean.py
Vector.rotate
def rotate(self, l, u): """rotate l radians around axis u""" cl = math.cos(l) sl = math.sin(l) x = (cl + u.x * u.x * (1 - cl)) * self.x + (u.x * u.y * (1 - cl) - u.z * sl) * self.y + ( u.x * u.z * (1 - cl) + u.y * sl) * self.z y = (u.y * u.x * (1 - cl) + u.z * sl) * self....
python
def rotate(self, l, u): """rotate l radians around axis u""" cl = math.cos(l) sl = math.sin(l) x = (cl + u.x * u.x * (1 - cl)) * self.x + (u.x * u.y * (1 - cl) - u.z * sl) * self.y + ( u.x * u.z * (1 - cl) + u.y * sl) * self.z y = (u.y * u.x * (1 - cl) + u.z * sl) * self....
[ "def", "rotate", "(", "self", ",", "l", ",", "u", ")", ":", "cl", "=", "math", ".", "cos", "(", "l", ")", "sl", "=", "math", ".", "sin", "(", "l", ")", "x", "=", "(", "cl", "+", "u", ".", "x", "*", "u", ".", "x", "*", "(", "1", "-", ...
rotate l radians around axis u
[ "rotate", "l", "radians", "around", "axis", "u" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/geo_euclidean.py#L145-L156
47,463
scot-dev/scot
scot/utils.py
cuthill_mckee
def cuthill_mckee(matrix): """Implementation of the Cuthill-McKee algorithm. Permute a symmetric binary matrix into a band matrix form with a small bandwidth. Parameters ---------- matrix : ndarray, dtype=bool, shape = [n, n] The matrix is internally converted to a symmetric matrix by sett...
python
def cuthill_mckee(matrix): """Implementation of the Cuthill-McKee algorithm. Permute a symmetric binary matrix into a band matrix form with a small bandwidth. Parameters ---------- matrix : ndarray, dtype=bool, shape = [n, n] The matrix is internally converted to a symmetric matrix by sett...
[ "def", "cuthill_mckee", "(", "matrix", ")", ":", "matrix", "=", "np", ".", "atleast_2d", "(", "matrix", ")", "n", ",", "m", "=", "matrix", ".", "shape", "assert", "(", "n", "==", "m", ")", "# make sure the matrix is really symmetric. This is equivalent to", "#...
Implementation of the Cuthill-McKee algorithm. Permute a symmetric binary matrix into a band matrix form with a small bandwidth. Parameters ---------- matrix : ndarray, dtype=bool, shape = [n, n] The matrix is internally converted to a symmetric matrix by setting each element [i,j] to True if ...
[ "Implementation", "of", "the", "Cuthill", "-", "McKee", "algorithm", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/utils.py#L32-L90
47,464
scot-dev/scot
scot/connectivity.py
connectivity
def connectivity(measure_names, b, c=None, nfft=512): """Calculate connectivity measures. Parameters ---------- measure_names : str or list of str Name(s) of the connectivity measure(s) to calculate. See :class:`Connectivity` for supported measures. b : array, shape (n_channels, n_c...
python
def connectivity(measure_names, b, c=None, nfft=512): """Calculate connectivity measures. Parameters ---------- measure_names : str or list of str Name(s) of the connectivity measure(s) to calculate. See :class:`Connectivity` for supported measures. b : array, shape (n_channels, n_c...
[ "def", "connectivity", "(", "measure_names", ",", "b", ",", "c", "=", "None", ",", "nfft", "=", "512", ")", ":", "con", "=", "Connectivity", "(", "b", ",", "c", ",", "nfft", ")", "try", ":", "return", "getattr", "(", "con", ",", "measure_names", ")...
Calculate connectivity measures. Parameters ---------- measure_names : str or list of str Name(s) of the connectivity measure(s) to calculate. See :class:`Connectivity` for supported measures. b : array, shape (n_channels, n_channels * model_order) VAR model coefficients. See :r...
[ "Calculate", "connectivity", "measures", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L16-L55
47,465
scot-dev/scot
scot/connectivity.py
Connectivity.Cinv
def Cinv(self): """Inverse of the noise covariance.""" try: return np.linalg.inv(self.c) except np.linalg.linalg.LinAlgError: print('Warning: non-invertible noise covariance matrix c.') return np.eye(self.c.shape[0])
python
def Cinv(self): """Inverse of the noise covariance.""" try: return np.linalg.inv(self.c) except np.linalg.linalg.LinAlgError: print('Warning: non-invertible noise covariance matrix c.') return np.eye(self.c.shape[0])
[ "def", "Cinv", "(", "self", ")", ":", "try", ":", "return", "np", ".", "linalg", ".", "inv", "(", "self", ".", "c", ")", "except", "np", ".", "linalg", ".", "linalg", ".", "LinAlgError", ":", "print", "(", "'Warning: non-invertible noise covariance matrix ...
Inverse of the noise covariance.
[ "Inverse", "of", "the", "noise", "covariance", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L147-L153
47,466
scot-dev/scot
scot/connectivity.py
Connectivity.A
def A(self): """Spectral VAR coefficients. .. math:: \mathbf{A}(f) = \mathbf{I} - \sum_{k=1}^{p} \mathbf{a}^{(k)} \mathrm{e}^{-2\pi f} """ return fft(np.dstack([np.eye(self.m), -self.b]), self.nfft * 2 - 1)[:, :, :self.nfft]
python
def A(self): """Spectral VAR coefficients. .. math:: \mathbf{A}(f) = \mathbf{I} - \sum_{k=1}^{p} \mathbf{a}^{(k)} \mathrm{e}^{-2\pi f} """ return fft(np.dstack([np.eye(self.m), -self.b]), self.nfft * 2 - 1)[:, :, :self.nfft]
[ "def", "A", "(", "self", ")", ":", "return", "fft", "(", "np", ".", "dstack", "(", "[", "np", ".", "eye", "(", "self", ".", "m", ")", ",", "-", "self", ".", "b", "]", ")", ",", "self", ".", "nfft", "*", "2", "-", "1", ")", "[", ":", ","...
Spectral VAR coefficients. .. math:: \mathbf{A}(f) = \mathbf{I} - \sum_{k=1}^{p} \mathbf{a}^{(k)} \mathrm{e}^{-2\pi f}
[ "Spectral", "VAR", "coefficients", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L156-L163
47,467
scot-dev/scot
scot/connectivity.py
Connectivity.S
def S(self): """Cross-spectral density. .. math:: \mathbf{S}(f) = \mathbf{H}(f) \mathbf{C} \mathbf{H}'(f) """ if self.c is None: raise RuntimeError('Cross-spectral density requires noise ' 'covariance matrix c.') H = self.H() # ...
python
def S(self): """Cross-spectral density. .. math:: \mathbf{S}(f) = \mathbf{H}(f) \mathbf{C} \mathbf{H}'(f) """ if self.c is None: raise RuntimeError('Cross-spectral density requires noise ' 'covariance matrix c.') H = self.H() # ...
[ "def", "S", "(", "self", ")", ":", "if", "self", ".", "c", "is", "None", ":", "raise", "RuntimeError", "(", "'Cross-spectral density requires noise '", "'covariance matrix c.'", ")", "H", "=", "self", ".", "H", "(", ")", "# TODO: can we do that more efficiently?",...
Cross-spectral density. .. math:: \mathbf{S}(f) = \mathbf{H}(f) \mathbf{C} \mathbf{H}'(f)
[ "Cross", "-", "spectral", "density", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L174-L187
47,468
scot-dev/scot
scot/connectivity.py
Connectivity.G
def G(self): """Inverse cross-spectral density. .. math:: \mathbf{G}(f) = \mathbf{A}(f) \mathbf{C}^{-1} \mathbf{A}'(f) """ if self.c is None: raise RuntimeError('Inverse cross spectral density requires ' 'invertible noise covariance matrix c.')...
python
def G(self): """Inverse cross-spectral density. .. math:: \mathbf{G}(f) = \mathbf{A}(f) \mathbf{C}^{-1} \mathbf{A}'(f) """ if self.c is None: raise RuntimeError('Inverse cross spectral density requires ' 'invertible noise covariance matrix c.')...
[ "def", "G", "(", "self", ")", ":", "if", "self", ".", "c", "is", "None", ":", "raise", "RuntimeError", "(", "'Inverse cross spectral density requires '", "'invertible noise covariance matrix c.'", ")", "A", "=", "self", ".", "A", "(", ")", "# TODO: can we do that ...
Inverse cross-spectral density. .. math:: \mathbf{G}(f) = \mathbf{A}(f) \mathbf{C}^{-1} \mathbf{A}'(f)
[ "Inverse", "cross", "-", "spectral", "density", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L206-L218
47,469
scot-dev/scot
scot/connectivity.py
Connectivity.pCOH
def pCOH(self): """Partial coherence. .. math:: \mathrm{pCOH}_{ij}(f) = \\frac{G_{ij}(f)} {\sqrt{G_{ii}(f) G_{jj}(f)}} References ---------- P. J. Franaszczuk, K. J. Blinowska, M. Kowalczyk. The application of parametric m...
python
def pCOH(self): """Partial coherence. .. math:: \mathrm{pCOH}_{ij}(f) = \\frac{G_{ij}(f)} {\sqrt{G_{ii}(f) G_{jj}(f)}} References ---------- P. J. Franaszczuk, K. J. Blinowska, M. Kowalczyk. The application of parametric m...
[ "def", "pCOH", "(", "self", ")", ":", "G", "=", "self", ".", "G", "(", ")", "# TODO: can we do that more efficiently?", "return", "G", "/", "np", ".", "sqrt", "(", "np", ".", "einsum", "(", "'ii..., jj... ->ij...'", ",", "G", ",", "G", ")", ")" ]
Partial coherence. .. math:: \mathrm{pCOH}_{ij}(f) = \\frac{G_{ij}(f)} {\sqrt{G_{ii}(f) G_{jj}(f)}} References ---------- P. J. Franaszczuk, K. J. Blinowska, M. Kowalczyk. The application of parametric multichannel spectral estima...
[ "Partial", "coherence", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L256-L270
47,470
scot-dev/scot
scot/connectivity.py
Connectivity.PDC
def PDC(self): """Partial directed coherence. .. math:: \mathrm{PDC}_{ij}(f) = \\frac{A_{ij}(f)} {\sqrt{A_{:j}'(f) A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in ...
python
def PDC(self): """Partial directed coherence. .. math:: \mathrm{PDC}_{ij}(f) = \\frac{A_{ij}(f)} {\sqrt{A_{:j}'(f) A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in ...
[ "def", "PDC", "(", "self", ")", ":", "A", "=", "self", ".", "A", "(", ")", "return", "np", ".", "abs", "(", "A", "/", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "A", ".", "conj", "(", ")", "*", "A", ",", "axis", "=", "0", ",", "keep...
Partial directed coherence. .. math:: \mathrm{PDC}_{ij}(f) = \\frac{A_{ij}(f)} {\sqrt{A_{:j}'(f) A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in neural structure determina...
[ "Partial", "directed", "coherence", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L273-L286
47,471
scot-dev/scot
scot/connectivity.py
Connectivity.ffPDC
def ffPDC(self): """Full frequency partial directed coherence. .. math:: \mathrm{ffPDC}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{\sum_f A_{:j}'(f) A_{:j}(f)}} """ A = self.A() return np.abs(A * self.nfft / np.sqrt(np.sum(A.conj() * A, axis=(0, 2), ...
python
def ffPDC(self): """Full frequency partial directed coherence. .. math:: \mathrm{ffPDC}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{\sum_f A_{:j}'(f) A_{:j}(f)}} """ A = self.A() return np.abs(A * self.nfft / np.sqrt(np.sum(A.conj() * A, axis=(0, 2), ...
[ "def", "ffPDC", "(", "self", ")", ":", "A", "=", "self", ".", "A", "(", ")", "return", "np", ".", "abs", "(", "A", "*", "self", ".", "nfft", "/", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "A", ".", "conj", "(", ")", "*", "A", ",", ...
Full frequency partial directed coherence. .. math:: \mathrm{ffPDC}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{\sum_f A_{:j}'(f) A_{:j}(f)}}
[ "Full", "frequency", "partial", "directed", "coherence", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L305-L313
47,472
scot-dev/scot
scot/connectivity.py
Connectivity.PDCF
def PDCF(self): """Partial directed coherence factor. .. math:: \mathrm{PDCF}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{A_{:j}'(f) \mathbf{C}^{-1} A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in neural structur...
python
def PDCF(self): """Partial directed coherence factor. .. math:: \mathrm{PDCF}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{A_{:j}'(f) \mathbf{C}^{-1} A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in neural structur...
[ "def", "PDCF", "(", "self", ")", ":", "A", "=", "self", ".", "A", "(", ")", "# TODO: can we do that more efficiently?", "return", "np", ".", "abs", "(", "A", "/", "np", ".", "sqrt", "(", "np", ".", "einsum", "(", "'aj..., ab..., bj... ->j...'", ",", "A",...
Partial directed coherence factor. .. math:: \mathrm{PDCF}_{ij}(f) = \\frac{A_{ij}(f)}{\sqrt{A_{:j}'(f) \mathbf{C}^{-1} A_{:j}(f)}} References ---------- L. A. Baccalá, K. Sameshima. Partial directed coherence: a new concept in neural structure determination. Biol. Cybe...
[ "Partial", "directed", "coherence", "factor", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L316-L331
47,473
scot-dev/scot
scot/connectivity.py
Connectivity.GPDC
def GPDC(self): """Generalized partial directed coherence. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{|A_{ij}(f)|} {\sigma_i \sqrt{A_{:j}'(f) \mathrm{diag}(\mathbf{C})^{-1} A_{:j}(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear ...
python
def GPDC(self): """Generalized partial directed coherence. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{|A_{ij}(f)|} {\sigma_i \sqrt{A_{:j}'(f) \mathrm{diag}(\mathbf{C})^{-1} A_{:j}(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear ...
[ "def", "GPDC", "(", "self", ")", ":", "A", "=", "self", ".", "A", "(", ")", "tmp", "=", "A", "/", "np", ".", "sqrt", "(", "np", ".", "einsum", "(", "'aj..., a..., aj..., ii... ->ij...'", ",", "A", ".", "conj", "(", ")", ",", "1", "/", "np", "."...
Generalized partial directed coherence. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{|A_{ij}(f)|} {\sigma_i \sqrt{A_{:j}'(f) \mathrm{diag}(\mathbf{C})^{-1} A_{:j}(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear multivariate processes:...
[ "Generalized", "partial", "directed", "coherence", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L334-L349
47,474
scot-dev/scot
scot/connectivity.py
Connectivity.DTF
def DTF(self): """Directed transfer function. .. math:: \mathrm{DTF}_{ij}(f) = \\frac{H_{ij}(f)} {\sqrt{H_{i:}(f) H_{i:}'(f)}} References ---------- M. J. Kaminski, K. J. Blinowska. A new method of the description of the in...
python
def DTF(self): """Directed transfer function. .. math:: \mathrm{DTF}_{ij}(f) = \\frac{H_{ij}(f)} {\sqrt{H_{i:}(f) H_{i:}'(f)}} References ---------- M. J. Kaminski, K. J. Blinowska. A new method of the description of the in...
[ "def", "DTF", "(", "self", ")", ":", "H", "=", "self", ".", "H", "(", ")", "return", "np", ".", "abs", "(", "H", "/", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "H", "*", "H", ".", "conj", "(", ")", ",", "axis", "=", "1", ",", "keep...
Directed transfer function. .. math:: \mathrm{DTF}_{ij}(f) = \\frac{H_{ij}(f)} {\sqrt{H_{i:}(f) H_{i:}'(f)}} References ---------- M. J. Kaminski, K. J. Blinowska. A new method of the description of the information flow in the brai...
[ "Directed", "transfer", "function", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L352-L365
47,475
scot-dev/scot
scot/connectivity.py
Connectivity.ffDTF
def ffDTF(self): """Full frequency directed transfer function. .. math:: \mathrm{ffDTF}_{ij}(f) = \\frac{H_{ij}(f)}{\sqrt{\sum_f H_{i:}(f) H_{i:}'(f)}} References ---------- A. Korzeniewska, M. Mańczak, M. Kaminski, K. J. Blinowska, S. Kasicki. Determi...
python
def ffDTF(self): """Full frequency directed transfer function. .. math:: \mathrm{ffDTF}_{ij}(f) = \\frac{H_{ij}(f)}{\sqrt{\sum_f H_{i:}(f) H_{i:}'(f)}} References ---------- A. Korzeniewska, M. Mańczak, M. Kaminski, K. J. Blinowska, S. Kasicki. Determi...
[ "def", "ffDTF", "(", "self", ")", ":", "H", "=", "self", ".", "H", "(", ")", "return", "np", ".", "abs", "(", "H", "*", "self", ".", "nfft", "/", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "H", "*", "H", ".", "conj", "(", ")", ",", ...
Full frequency directed transfer function. .. math:: \mathrm{ffDTF}_{ij}(f) = \\frac{H_{ij}(f)}{\sqrt{\sum_f H_{i:}(f) H_{i:}'(f)}} References ---------- A. Korzeniewska, M. Mańczak, M. Kaminski, K. J. Blinowska, S. Kasicki. Determination of information flow d...
[ "Full", "frequency", "directed", "transfer", "function", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L368-L383
47,476
scot-dev/scot
scot/connectivity.py
Connectivity.GDTF
def GDTF(self): """Generalized directed transfer function. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{\sigma_j |H_{ij}(f)|} {\sqrt{H_{i:}(f) \mathrm{diag}(\mathbf{C}) H_{i:}'(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear ...
python
def GDTF(self): """Generalized directed transfer function. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{\sigma_j |H_{ij}(f)|} {\sqrt{H_{i:}(f) \mathrm{diag}(\mathbf{C}) H_{i:}'(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear ...
[ "def", "GDTF", "(", "self", ")", ":", "H", "=", "self", ".", "H", "(", ")", "tmp", "=", "H", "/", "np", ".", "sqrt", "(", "np", ".", "einsum", "(", "'ia..., aa..., ia..., j... ->ij...'", ",", "H", ".", "conj", "(", ")", ",", "self", ".", "c", "...
Generalized directed transfer function. .. math:: \mathrm{GPDC}_{ij}(f) = \\frac{\sigma_j |H_{ij}(f)|} {\sqrt{H_{i:}(f) \mathrm{diag}(\mathbf{C}) H_{i:}'(f)}} References ---------- L. Faes, S. Erla, G. Nollo. Measuring connectivity in linear multivariate processes: ...
[ "Generalized", "directed", "transfer", "function", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity.py#L402-L418
47,477
kolypto/py-good
good/schema/errors.py
Invalid.enrich
def enrich(self, expected=None, provided=None, path=None, validator=None): """ Enrich this error with additional information. This works with both Invalid and MultipleInvalid (thanks to `Invalid` being iterable): in the latter case, the defaults are applied to all collected errors. The...
python
def enrich(self, expected=None, provided=None, path=None, validator=None): """ Enrich this error with additional information. This works with both Invalid and MultipleInvalid (thanks to `Invalid` being iterable): in the latter case, the defaults are applied to all collected errors. The...
[ "def", "enrich", "(", "self", ",", "expected", "=", "None", ",", "provided", "=", "None", ",", "path", "=", "None", ",", "validator", "=", "None", ")", ":", "for", "e", "in", "self", ":", "# defaults on fields", "if", "e", ".", "expected", "is", "Non...
Enrich this error with additional information. This works with both Invalid and MultipleInvalid (thanks to `Invalid` being iterable): in the latter case, the defaults are applied to all collected errors. The specified arguments are only set on `Invalid` errors which do not have any value on th...
[ "Enrich", "this", "error", "with", "additional", "information", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/errors.py#L101-L150
47,478
kolypto/py-good
good/schema/errors.py
MultipleInvalid.flatten
def flatten(cls, errors): """ Unwind `MultipleErrors` to have a plain list of `Invalid` :type errors: list[Invalid|MultipleInvalid] :rtype: list[Invalid] """ ers = [] for e in errors: if isinstance(e, MultipleInvalid): ers.extend(cls.flatten(e...
python
def flatten(cls, errors): """ Unwind `MultipleErrors` to have a plain list of `Invalid` :type errors: list[Invalid|MultipleInvalid] :rtype: list[Invalid] """ ers = [] for e in errors: if isinstance(e, MultipleInvalid): ers.extend(cls.flatten(e...
[ "def", "flatten", "(", "cls", ",", "errors", ")", ":", "ers", "=", "[", "]", "for", "e", "in", "errors", ":", "if", "isinstance", "(", "e", ",", "MultipleInvalid", ")", ":", "ers", ".", "extend", "(", "cls", ".", "flatten", "(", "e", ".", "errors...
Unwind `MultipleErrors` to have a plain list of `Invalid` :type errors: list[Invalid|MultipleInvalid] :rtype: list[Invalid]
[ "Unwind", "MultipleErrors", "to", "have", "a", "plain", "list", "of", "Invalid" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/errors.py#L208-L220
47,479
scot-dev/scot
scot/eegtopo/warp_layout.py
warp_locations
def warp_locations(locations, y_center=None, return_ellipsoid=False, verbose=False): """ Warp EEG electrode locations to spherical layout. EEG Electrodes are warped to a spherical layout in three steps: 1. An ellipsoid is least-squares-fitted to the electrode locations. 2. Electrodes are displa...
python
def warp_locations(locations, y_center=None, return_ellipsoid=False, verbose=False): """ Warp EEG electrode locations to spherical layout. EEG Electrodes are warped to a spherical layout in three steps: 1. An ellipsoid is least-squares-fitted to the electrode locations. 2. Electrodes are displa...
[ "def", "warp_locations", "(", "locations", ",", "y_center", "=", "None", ",", "return_ellipsoid", "=", "False", ",", "verbose", "=", "False", ")", ":", "locations", "=", "np", ".", "asarray", "(", "locations", ")", "if", "y_center", "is", "None", ":", "c...
Warp EEG electrode locations to spherical layout. EEG Electrodes are warped to a spherical layout in three steps: 1. An ellipsoid is least-squares-fitted to the electrode locations. 2. Electrodes are displaced to the nearest point on the ellipsoid's surface. 3. The ellipsoid is transformed ...
[ "Warp", "EEG", "electrode", "locations", "to", "spherical", "layout", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/warp_layout.py#L15-L68
47,480
scot-dev/scot
scot/eegtopo/warp_layout.py
_project_on_ellipsoid
def _project_on_ellipsoid(c, r, locations): """displace locations to the nearest point on ellipsoid surface""" p0 = locations - c # original locations l2 = 1 / np.sum(p0**2 / r**2, axis=1, keepdims=True) p = p0 * np.sqrt(l2) # initial approximation (projection of points towards center of ellipsoid) ...
python
def _project_on_ellipsoid(c, r, locations): """displace locations to the nearest point on ellipsoid surface""" p0 = locations - c # original locations l2 = 1 / np.sum(p0**2 / r**2, axis=1, keepdims=True) p = p0 * np.sqrt(l2) # initial approximation (projection of points towards center of ellipsoid) ...
[ "def", "_project_on_ellipsoid", "(", "c", ",", "r", ",", "locations", ")", ":", "p0", "=", "locations", "-", "c", "# original locations", "l2", "=", "1", "/", "np", ".", "sum", "(", "p0", "**", "2", "/", "r", "**", "2", ",", "axis", "=", "1", ","...
displace locations to the nearest point on ellipsoid surface
[ "displace", "locations", "to", "the", "nearest", "point", "on", "ellipsoid", "surface" ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/eegtopo/warp_layout.py#L96-L107
47,481
scot-dev/scot
scot/datatools.py
cut_segments
def cut_segments(x2d, tr, start, stop): """Cut continuous signal into segments. Parameters ---------- x2d : array, shape (m, n) Input data with m signals and n samples. tr : list of int Trigger positions. start : int Window start (offset relative to trigger). stop : ...
python
def cut_segments(x2d, tr, start, stop): """Cut continuous signal into segments. Parameters ---------- x2d : array, shape (m, n) Input data with m signals and n samples. tr : list of int Trigger positions. start : int Window start (offset relative to trigger). stop : ...
[ "def", "cut_segments", "(", "x2d", ",", "tr", ",", "start", ",", "stop", ")", ":", "if", "start", "!=", "int", "(", "start", ")", ":", "raise", "ValueError", "(", "\"start index must be an integer\"", ")", "if", "stop", "!=", "int", "(", "stop", ")", "...
Cut continuous signal into segments. Parameters ---------- x2d : array, shape (m, n) Input data with m signals and n samples. tr : list of int Trigger positions. start : int Window start (offset relative to trigger). stop : int Window end (offset relative to trig...
[ "Cut", "continuous", "signal", "into", "segments", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datatools.py#L28-L68
47,482
scot-dev/scot
scot/datatools.py
cat_trials
def cat_trials(x3d): """Concatenate trials along time axis. Parameters ---------- x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samples. Returns ------- x2d : array, shape (m, t * n) Trials are concatenated along the second axis. See...
python
def cat_trials(x3d): """Concatenate trials along time axis. Parameters ---------- x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samples. Returns ------- x2d : array, shape (m, t * n) Trials are concatenated along the second axis. See...
[ "def", "cat_trials", "(", "x3d", ")", ":", "x3d", "=", "atleast_3d", "(", "x3d", ")", "t", "=", "x3d", ".", "shape", "[", "0", "]", "return", "np", ".", "concatenate", "(", "np", ".", "split", "(", "x3d", ",", "t", ",", "0", ")", ",", "axis", ...
Concatenate trials along time axis. Parameters ---------- x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samples. Returns ------- x2d : array, shape (m, t * n) Trials are concatenated along the second axis. See also -------- cut_s...
[ "Concatenate", "trials", "along", "time", "axis", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datatools.py#L71-L97
47,483
scot-dev/scot
scot/datatools.py
dot_special
def dot_special(x2d, x3d): """Segment-wise dot product. This function calculates the dot product of x2d with each trial of x3d. Parameters ---------- x2d : array, shape (p, m) Input argument. x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samp...
python
def dot_special(x2d, x3d): """Segment-wise dot product. This function calculates the dot product of x2d with each trial of x3d. Parameters ---------- x2d : array, shape (p, m) Input argument. x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samp...
[ "def", "dot_special", "(", "x2d", ",", "x3d", ")", ":", "x3d", "=", "atleast_3d", "(", "x3d", ")", "x2d", "=", "np", ".", "atleast_2d", "(", "x2d", ")", "return", "np", ".", "concatenate", "(", "[", "x2d", ".", "dot", "(", "x3d", "[", "i", ",", ...
Segment-wise dot product. This function calculates the dot product of x2d with each trial of x3d. Parameters ---------- x2d : array, shape (p, m) Input argument. x3d : array, shape (t, m, n) Segmented input data with t trials, m signals, and n samples. The dot product with ...
[ "Segment", "-", "wise", "dot", "product", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datatools.py#L100-L129
47,484
scot-dev/scot
scot/datatools.py
randomize_phase
def randomize_phase(data, random_state=None): """Phase randomization. This function randomizes the spectral phase of the input data along the last dimension. Parameters ---------- data : array Input array. Returns ------- out : array Array of same shape as data. ...
python
def randomize_phase(data, random_state=None): """Phase randomization. This function randomizes the spectral phase of the input data along the last dimension. Parameters ---------- data : array Input array. Returns ------- out : array Array of same shape as data. ...
[ "def", "randomize_phase", "(", "data", ",", "random_state", "=", "None", ")", ":", "rng", "=", "check_random_state", "(", "random_state", ")", "data", "=", "np", ".", "asarray", "(", "data", ")", "data_freq", "=", "np", ".", "fft", ".", "rfft", "(", "d...
Phase randomization. This function randomizes the spectral phase of the input data along the last dimension. Parameters ---------- data : array Input array. Returns ------- out : array Array of same shape as data. Notes ----- The algorithm randomizes the p...
[ "Phase", "randomization", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datatools.py#L132-L175
47,485
scot-dev/scot
scot/datatools.py
acm
def acm(x, l): """Compute autocovariance matrix at lag l. This function calculates the autocovariance matrix of `x` at lag `l`. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) Signal data (2D or 3D for multiple trials) l : int Lag Returns -----...
python
def acm(x, l): """Compute autocovariance matrix at lag l. This function calculates the autocovariance matrix of `x` at lag `l`. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) Signal data (2D or 3D for multiple trials) l : int Lag Returns -----...
[ "def", "acm", "(", "x", ",", "l", ")", ":", "x", "=", "atleast_3d", "(", "x", ")", "if", "l", ">", "x", ".", "shape", "[", "2", "]", "-", "1", ":", "raise", "AttributeError", "(", "\"lag exceeds data length\"", ")", "## subtract mean from each trial", ...
Compute autocovariance matrix at lag l. This function calculates the autocovariance matrix of `x` at lag `l`. Parameters ---------- x : array, shape (n_trials, n_channels, n_samples) Signal data (2D or 3D for multiple trials) l : int Lag Returns ------- c : ndarray, sh...
[ "Compute", "autocovariance", "matrix", "at", "lag", "l", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/datatools.py#L178-L215
47,486
scot-dev/scot
scot/connectivity_statistics.py
jackknife_connectivity
def jackknife_connectivity(measures, data, var, nfft=512, leaveout=1, n_jobs=1, verbose=0): """Calculate jackknife estimates of connectivity. For each jackknife estimate a block of trials is left out. This is repeated until each trial was left out exactly once. The number of esti...
python
def jackknife_connectivity(measures, data, var, nfft=512, leaveout=1, n_jobs=1, verbose=0): """Calculate jackknife estimates of connectivity. For each jackknife estimate a block of trials is left out. This is repeated until each trial was left out exactly once. The number of esti...
[ "def", "jackknife_connectivity", "(", "measures", ",", "data", ",", "var", ",", "nfft", "=", "512", ",", "leaveout", "=", "1", ",", "n_jobs", "=", "1", ",", "verbose", "=", "0", ")", ":", "data", "=", "atleast_3d", "(", "data", ")", "t", ",", "m", ...
Calculate jackknife estimates of connectivity. For each jackknife estimate a block of trials is left out. This is repeated until each trial was left out exactly once. The number of estimates depends on the number of trials and the value of `leaveout`. It is calculated by repeats = `n_trials` // `leaveo...
[ "Calculate", "jackknife", "estimates", "of", "connectivity", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity_statistics.py#L67-L123
47,487
scot-dev/scot
scot/connectivity_statistics.py
bootstrap_connectivity
def bootstrap_connectivity(measures, data, var, nfft=512, repeats=100, num_samples=None, n_jobs=1, verbose=0, random_state=None): """Calculate bootstrap estimates of connectivity. To obtain a bootstrap estimate trials are sampled randomly with replacement ...
python
def bootstrap_connectivity(measures, data, var, nfft=512, repeats=100, num_samples=None, n_jobs=1, verbose=0, random_state=None): """Calculate bootstrap estimates of connectivity. To obtain a bootstrap estimate trials are sampled randomly with replacement ...
[ "def", "bootstrap_connectivity", "(", "measures", ",", "data", ",", "var", ",", "nfft", "=", "512", ",", "repeats", "=", "100", ",", "num_samples", "=", "None", ",", "n_jobs", "=", "1", ",", "verbose", "=", "0", ",", "random_state", "=", "None", ")", ...
Calculate bootstrap estimates of connectivity. To obtain a bootstrap estimate trials are sampled randomly with replacement from the data set. .. note:: Parameter `var` will be modified by the function. Treat as undefined after the function returns. Parameters ---------- measures : str or ...
[ "Calculate", "bootstrap", "estimates", "of", "connectivity", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity_statistics.py#L131-L188
47,488
scot-dev/scot
scot/connectivity_statistics.py
significance_fdr
def significance_fdr(p, alpha): """Calculate significance by controlling for the false discovery rate. This function determines which of the p-values in `p` can be considered significant. Correction for multiple comparisons is performed by controlling the false discovery rate (FDR). The FDR is the maxi...
python
def significance_fdr(p, alpha): """Calculate significance by controlling for the false discovery rate. This function determines which of the p-values in `p` can be considered significant. Correction for multiple comparisons is performed by controlling the false discovery rate (FDR). The FDR is the maxi...
[ "def", "significance_fdr", "(", "p", ",", "alpha", ")", ":", "i", "=", "np", ".", "argsort", "(", "p", ",", "axis", "=", "None", ")", "m", "=", "i", ".", "size", "-", "np", ".", "sum", "(", "np", ".", "isnan", "(", "p", ")", ")", "j", "=", ...
Calculate significance by controlling for the false discovery rate. This function determines which of the p-values in `p` can be considered significant. Correction for multiple comparisons is performed by controlling the false discovery rate (FDR). The FDR is the maximum fraction of p-values that are w...
[ "Calculate", "significance", "by", "controlling", "for", "the", "false", "discovery", "rate", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/connectivity_statistics.py#L252-L295
47,489
kolypto/py-good
good/schema/util.py
register_type_name
def register_type_name(t, name): """ Register a human-friendly name for the given type. This will be used in Invalid errors :param t: The type to register :type t: type :param name: Name for the type :type name: unicode """ assert isinstance(t, type) assert isinstance(name, unicode) ...
python
def register_type_name(t, name): """ Register a human-friendly name for the given type. This will be used in Invalid errors :param t: The type to register :type t: type :param name: Name for the type :type name: unicode """ assert isinstance(t, type) assert isinstance(name, unicode) ...
[ "def", "register_type_name", "(", "t", ",", "name", ")", ":", "assert", "isinstance", "(", "t", ",", "type", ")", "assert", "isinstance", "(", "name", ",", "unicode", ")", "__type_names", "[", "t", "]", "=", "name" ]
Register a human-friendly name for the given type. This will be used in Invalid errors :param t: The type to register :type t: type :param name: Name for the type :type name: unicode
[ "Register", "a", "human", "-", "friendly", "name", "for", "the", "given", "type", ".", "This", "will", "be", "used", "in", "Invalid", "errors" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L61-L71
47,490
kolypto/py-good
good/schema/util.py
get_type_name
def get_type_name(t): """ Get a human-friendly name for the given type. :type t: type|None :rtype: unicode """ # Lookup in the mapping try: return __type_names[t] except KeyError: # Specific types if issubclass(t, six.integer_types): return _(u'Integer nu...
python
def get_type_name(t): """ Get a human-friendly name for the given type. :type t: type|None :rtype: unicode """ # Lookup in the mapping try: return __type_names[t] except KeyError: # Specific types if issubclass(t, six.integer_types): return _(u'Integer nu...
[ "def", "get_type_name", "(", "t", ")", ":", "# Lookup in the mapping", "try", ":", "return", "__type_names", "[", "t", "]", "except", "KeyError", ":", "# Specific types", "if", "issubclass", "(", "t", ",", "six", ".", "integer_types", ")", ":", "return", "_"...
Get a human-friendly name for the given type. :type t: type|None :rtype: unicode
[ "Get", "a", "human", "-", "friendly", "name", "for", "the", "given", "type", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L84-L99
47,491
kolypto/py-good
good/schema/util.py
get_callable_name
def get_callable_name(c): """ Get a human-friendly name for the given callable. :param c: The callable to get the name for :type c: callable :rtype: unicode """ if hasattr(c, 'name'): return six.text_type(c.name) elif hasattr(c, '__name__'): return six.text_type(c.__name__) ...
python
def get_callable_name(c): """ Get a human-friendly name for the given callable. :param c: The callable to get the name for :type c: callable :rtype: unicode """ if hasattr(c, 'name'): return six.text_type(c.name) elif hasattr(c, '__name__'): return six.text_type(c.__name__) ...
[ "def", "get_callable_name", "(", "c", ")", ":", "if", "hasattr", "(", "c", ",", "'name'", ")", ":", "return", "six", ".", "text_type", "(", "c", ".", "name", ")", "elif", "hasattr", "(", "c", ",", "'__name__'", ")", ":", "return", "six", ".", "text...
Get a human-friendly name for the given callable. :param c: The callable to get the name for :type c: callable :rtype: unicode
[ "Get", "a", "human", "-", "friendly", "name", "for", "the", "given", "callable", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L102-L114
47,492
kolypto/py-good
good/schema/util.py
get_primitive_name
def get_primitive_name(schema): """ Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode """ try: return { const.COMPILED_TYPE.LITERAL: six.text_type, const.COMPILED_TYPE.TYPE: get_type_name, const.C...
python
def get_primitive_name(schema): """ Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode """ try: return { const.COMPILED_TYPE.LITERAL: six.text_type, const.COMPILED_TYPE.TYPE: get_type_name, const.C...
[ "def", "get_primitive_name", "(", "schema", ")", ":", "try", ":", "return", "{", "const", ".", "COMPILED_TYPE", ".", "LITERAL", ":", "six", ".", "text_type", ",", "const", ".", "COMPILED_TYPE", ".", "TYPE", ":", "get_type_name", ",", "const", ".", "COMPILE...
Get a human-friendly name for the given primitive. :param schema: Schema :type schema: * :rtype: unicode
[ "Get", "a", "human", "-", "friendly", "name", "for", "the", "given", "primitive", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L117-L134
47,493
kolypto/py-good
good/schema/util.py
primitive_type
def primitive_type(schema): """ Get schema type for the primitive argument. Note: it does treats markers & schemas as callables! :param schema: Value of a primitive type :type schema: * :return: const.COMPILED_TYPE.* :rtype: str|None """ schema_type = type(schema) # Literal if...
python
def primitive_type(schema): """ Get schema type for the primitive argument. Note: it does treats markers & schemas as callables! :param schema: Value of a primitive type :type schema: * :return: const.COMPILED_TYPE.* :rtype: str|None """ schema_type = type(schema) # Literal if...
[ "def", "primitive_type", "(", "schema", ")", ":", "schema_type", "=", "type", "(", "schema", ")", "# Literal", "if", "schema_type", "in", "const", ".", "literal_types", ":", "return", "const", ".", "COMPILED_TYPE", ".", "LITERAL", "# Enum", "elif", "Enum", "...
Get schema type for the primitive argument. Note: it does treats markers & schemas as callables! :param schema: Value of a primitive type :type schema: * :return: const.COMPILED_TYPE.* :rtype: str|None
[ "Get", "schema", "type", "for", "the", "primitive", "argument", "." ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L179-L211
47,494
kolypto/py-good
good/schema/util.py
commajoin_as_strings
def commajoin_as_strings(iterable): """ Join the given iterable with ',' """ return _(u',').join((six.text_type(i) for i in iterable))
python
def commajoin_as_strings(iterable): """ Join the given iterable with ',' """ return _(u',').join((six.text_type(i) for i in iterable))
[ "def", "commajoin_as_strings", "(", "iterable", ")", ":", "return", "_", "(", "u','", ")", ".", "join", "(", "(", "six", ".", "text_type", "(", "i", ")", "for", "i", "in", "iterable", ")", ")" ]
Join the given iterable with ','
[ "Join", "the", "given", "iterable", "with" ]
192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/schema/util.py#L213-L215
47,495
scot-dev/scot
scot/plotting.py
prepare_topoplots
def prepare_topoplots(topo, values): """Prepare multiple topo maps for cached plotting. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_values`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` Scalp maps are created w...
python
def prepare_topoplots(topo, values): """Prepare multiple topo maps for cached plotting. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_values`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` Scalp maps are created w...
[ "def", "prepare_topoplots", "(", "topo", ",", "values", ")", ":", "values", "=", "np", ".", "atleast_2d", "(", "values", ")", "topomaps", "=", "[", "]", "for", "i", "in", "range", "(", "values", ".", "shape", "[", "0", "]", ")", ":", "topo", ".", ...
Prepare multiple topo maps for cached plotting. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_values`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` Scalp maps are created with this class values : array, shape = [...
[ "Prepare", "multiple", "topo", "maps", "for", "cached", "plotting", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L35-L61
47,496
scot-dev/scot
scot/plotting.py
plot_topo
def plot_topo(axis, topo, topomap, crange=None, offset=(0,0), plot_locations=True, plot_head=True): """Draw a topoplot in given axis. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- axis : axis ...
python
def plot_topo(axis, topo, topomap, crange=None, offset=(0,0), plot_locations=True, plot_head=True): """Draw a topoplot in given axis. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- axis : axis ...
[ "def", "plot_topo", "(", "axis", ",", "topo", ",", "topomap", ",", "crange", "=", "None", ",", "offset", "=", "(", "0", ",", "0", ")", ",", "plot_locations", "=", "True", ",", "plot_head", "=", "True", ")", ":", "topo", ".", "set_map", "(", "topoma...
Draw a topoplot in given axis. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- axis : axis Axis to draw into. topo : :class:`~eegtopo.topoplot.Topoplot` This object draws the topo plot topomap :...
[ "Draw", "a", "topoplot", "in", "given", "axis", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L64-L99
47,497
scot-dev/scot
scot/plotting.py
plot_sources
def plot_sources(topo, mixmaps, unmixmaps, global_scale=None, fig=None): """Plot all scalp projections of mixing- and unmixing-maps. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- topo : :class:`~eegtopo.topoplot....
python
def plot_sources(topo, mixmaps, unmixmaps, global_scale=None, fig=None): """Plot all scalp projections of mixing- and unmixing-maps. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- topo : :class:`~eegtopo.topoplot....
[ "def", "plot_sources", "(", "topo", ",", "mixmaps", ",", "unmixmaps", ",", "global_scale", "=", "None", ",", "fig", "=", "None", ")", ":", "urange", ",", "mrange", "=", "None", ",", "None", "m", "=", "len", "(", "mixmaps", ")", "if", "global_scale", ...
Plot all scalp projections of mixing- and unmixing-maps. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- topo : :class:`~eegtopo.topoplot.Topoplot` This object draws the topo plot mixmaps : array, shape = [...
[ "Plot", "all", "scalp", "projections", "of", "mixing", "-", "and", "unmixing", "-", "maps", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L102-L167
47,498
scot-dev/scot
scot/plotting.py
plot_connectivity_topos
def plot_connectivity_topos(layout='diagonal', topo=None, topomaps=None, fig=None): """Place topo plots in a figure suitable for connectivity visualization. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- layout : ...
python
def plot_connectivity_topos(layout='diagonal', topo=None, topomaps=None, fig=None): """Place topo plots in a figure suitable for connectivity visualization. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- layout : ...
[ "def", "plot_connectivity_topos", "(", "layout", "=", "'diagonal'", ",", "topo", "=", "None", ",", "topomaps", "=", "None", ",", "fig", "=", "None", ")", ":", "m", "=", "len", "(", "topomaps", ")", "if", "fig", "is", "None", ":", "fig", "=", "new_fig...
Place topo plots in a figure suitable for connectivity visualization. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters ---------- layout : str 'diagonal' -> place topo plots on diagonal. otherwise -> place topo plo...
[ "Place", "topo", "plots", "in", "a", "figure", "suitable", "for", "connectivity", "visualization", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L170-L214
47,499
scot-dev/scot
scot/plotting.py
plot_connectivity_significance
def plot_connectivity_significance(s, fs=2, freq_range=(-np.inf, np.inf), diagonal=0, border=False, fig=None): """Plot significance. Significance is drawn as a background image where dark vertical stripes indicate freuquencies where a evaluates to True. Parameters ---------- a : array, shape (...
python
def plot_connectivity_significance(s, fs=2, freq_range=(-np.inf, np.inf), diagonal=0, border=False, fig=None): """Plot significance. Significance is drawn as a background image where dark vertical stripes indicate freuquencies where a evaluates to True. Parameters ---------- a : array, shape (...
[ "def", "plot_connectivity_significance", "(", "s", ",", "fs", "=", "2", ",", "freq_range", "=", "(", "-", "np", ".", "inf", ",", "np", ".", "inf", ")", ",", "diagonal", "=", "0", ",", "border", "=", "False", ",", "fig", "=", "None", ")", ":", "a"...
Plot significance. Significance is drawn as a background image where dark vertical stripes indicate freuquencies where a evaluates to True. Parameters ---------- a : array, shape (n_channels, n_channels, n_fft), dtype bool Significance fs : float Sampling frequency freq_ran...
[ "Plot", "significance", "." ]
48598b79d4400dad893b134cd2194715511facda
https://github.com/scot-dev/scot/blob/48598b79d4400dad893b134cd2194715511facda/scot/plotting.py#L312-L387