hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
initialize_parser
<not_specific>
def initialize_parser(docstring): """Initialize parser with help showing docstring and defaults.""" return argparse.ArgumentParser( description=docstring, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
Initialize parser with help showing docstring and defaults.
Initialize parser with help showing docstring and defaults.
[ "Initialize", "parser", "with", "help", "showing", "docstring", "and", "defaults", "." ]
def initialize_parser(docstring): return argparse.ArgumentParser( description=docstring, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
[ "def", "initialize_parser", "(", "docstring", ")", ":", "return", "argparse", ".", "ArgumentParser", "(", "description", "=", "docstring", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")" ]
Initialize parser with help showing docstring and defaults.
[ "Initialize", "parser", "with", "help", "showing", "docstring", "and", "defaults", "." ]
[ "\"\"\"Initialize parser with help showing docstring and defaults.\"\"\"" ]
[ { "param": "docstring", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "docstring", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
clean_regions
<not_specific>
def clean_regions(regions): """Check regions input against prepared geopop tables.""" logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}") initialize_logging(logger) client = bq_client() dataset_id = '.'.join([client.project, 'geopop']) regional_tables = [ t.table_i...
Check regions input against prepared geopop tables.
Check regions input against prepared geopop tables.
[ "Check", "regions", "input", "against", "prepared", "geopop", "tables", "." ]
def clean_regions(regions): logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}") initialize_logging(logger) client = bq_client() dataset_id = '.'.join([client.project, 'geopop']) regional_tables = [ t.table_id for t in client.list_tables(dataset_id) if t.table_t...
[ "def", "clean_regions", "(", "regions", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "f\"{__name__}.{sys._getframe().f_code.co_name}\"", ")", "initialize_logging", "(", "logger", ")", "client", "=", "bq_client", "(", ")", "dataset_id", "=", "'.'", "....
Check regions input against prepared geopop tables.
[ "Check", "regions", "input", "against", "prepared", "geopop", "tables", "." ]
[ "\"\"\"Check regions input against prepared geopop tables.\"\"\"" ]
[ { "param": "regions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "regions", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_client
<not_specific>
def bq_client(): """Set up client for Google BigQuery API requests.""" credentials = service_account.Credentials.from_service_account_file( pathlib.Path(__file__).parent / 'google-service-account.json') return bigquery.Client(credentials=credentials)
Set up client for Google BigQuery API requests.
Set up client for Google BigQuery API requests.
[ "Set", "up", "client", "for", "Google", "BigQuery", "API", "requests", "." ]
def bq_client(): credentials = service_account.Credentials.from_service_account_file( pathlib.Path(__file__).parent / 'google-service-account.json') return bigquery.Client(credentials=credentials)
[ "def", "bq_client", "(", ")", ":", "credentials", "=", "service_account", ".", "Credentials", ".", "from_service_account_file", "(", "pathlib", ".", "Path", "(", "__file__", ")", ".", "parent", "/", "'google-service-account.json'", ")", "return", "bigquery", ".", ...
Set up client for Google BigQuery API requests.
[ "Set", "up", "client", "for", "Google", "BigQuery", "API", "requests", "." ]
[ "\"\"\"Set up client for Google BigQuery API requests.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_prep_dataset
<not_specific>
def bq_prep_dataset(dataset_name, list_tables=False, test_dataset=False): """Check that BigQuery project and dataset are ready.""" logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}") initialize_logging(logger) client = bq_client() logger.info("bq project %s ready", client.proj...
Check that BigQuery project and dataset are ready.
Check that BigQuery project and dataset are ready.
[ "Check", "that", "BigQuery", "project", "and", "dataset", "are", "ready", "." ]
def bq_prep_dataset(dataset_name, list_tables=False, test_dataset=False): logger = logging.getLogger(f"{__name__}.{sys._getframe().f_code.co_name}") initialize_logging(logger) client = bq_client() logger.info("bq project %s ready", client.project) if test_dataset: dataset_name += '_test' ...
[ "def", "bq_prep_dataset", "(", "dataset_name", ",", "list_tables", "=", "False", ",", "test_dataset", "=", "False", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "f\"{__name__}.{sys._getframe().f_code.co_name}\"", ")", "initialize_logging", "(", "logger",...
Check that BigQuery project and dataset are ready.
[ "Check", "that", "BigQuery", "project", "and", "dataset", "are", "ready", "." ]
[ "\"\"\"Check that BigQuery project and dataset are ready.\"\"\"" ]
[ { "param": "dataset_name", "type": null }, { "param": "list_tables", "type": null }, { "param": "test_dataset", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dataset_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "list_tables", "type": null, "docstring": null, "docst...
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_create_table
<not_specific>
def bq_create_table(dataset, table_id, schema=None, partition=None, partition_hourly=False, cluster=None, description=None, force_new=False): """Create BigQuery table, forceful...
Create BigQuery table, forcefully if required.
Create BigQuery table, forcefully if required.
[ "Create", "BigQuery", "table", "forcefully", "if", "required", "." ]
def bq_create_table(dataset, table_id, schema=None, partition=None, partition_hourly=False, cluster=None, description=None, force_new=False): client = bq_client() table_id ...
[ "def", "bq_create_table", "(", "dataset", ",", "table_id", ",", "schema", "=", "None", ",", "partition", "=", "None", ",", "partition_hourly", "=", "False", ",", "cluster", "=", "None", ",", "description", "=", "None", ",", "force_new", "=", "False", ")", ...
Create BigQuery table, forcefully if required.
[ "Create", "BigQuery", "table", "forcefully", "if", "required", "." ]
[ "\"\"\"Create BigQuery table, forcefully if required.\"\"\"", "# clean slate" ]
[ { "param": "dataset", "type": null }, { "param": "table_id", "type": null }, { "param": "schema", "type": null }, { "param": "partition", "type": null }, { "param": "partition_hourly", "type": null }, { "param": "cluster", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "dataset", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table_id", "type": null, "docstring": null, "docstring_tok...
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_create_view
<not_specific>
def bq_create_view(dataset, view_id, view_query, force_new=False): """Create BigQuery view forcefully if required.""" client = bq_client() view_id = '.'.join([dataset.project, dataset.dataset_id, view_id]) if force_new: client.delete_table(view_id, not_found_ok=True) # clean slate view = bi...
Create BigQuery view forcefully if required.
Create BigQuery view forcefully if required.
[ "Create", "BigQuery", "view", "forcefully", "if", "required", "." ]
def bq_create_view(dataset, view_id, view_query, force_new=False): client = bq_client() view_id = '.'.join([dataset.project, dataset.dataset_id, view_id]) if force_new: client.delete_table(view_id, not_found_ok=True) view = bigquery.Table(view_id) view.view_query = view_query try: ...
[ "def", "bq_create_view", "(", "dataset", ",", "view_id", ",", "view_query", ",", "force_new", "=", "False", ")", ":", "client", "=", "bq_client", "(", ")", "view_id", "=", "'.'", ".", "join", "(", "[", "dataset", ".", "project", ",", "dataset", ".", "d...
Create BigQuery view forcefully if required.
[ "Create", "BigQuery", "view", "forcefully", "if", "required", "." ]
[ "\"\"\"Create BigQuery view forcefully if required.\"\"\"", "# clean slate" ]
[ { "param": "dataset", "type": null }, { "param": "view_id", "type": null }, { "param": "view_query", "type": null }, { "param": "force_new", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dataset", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "view_id", "type": null, "docstring": null, "docstring_toke...
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_load_table
<not_specific>
def bq_load_table(df, table_id, schema=None, write='WRITE_APPEND'): """Load Pandas dataframe into BigQuery table.""" client = bq_client() job_config = bigquery.LoadJobConfig( schema=schema, write_disposition=write # default append existing ) job = client.load_table_from_dataframe(df...
Load Pandas dataframe into BigQuery table.
Load Pandas dataframe into BigQuery table.
[ "Load", "Pandas", "dataframe", "into", "BigQuery", "table", "." ]
def bq_load_table(df, table_id, schema=None, write='WRITE_APPEND'): client = bq_client() job_config = bigquery.LoadJobConfig( schema=schema, write_disposition=write ) job = client.load_table_from_dataframe(df, table_id, job_config=job_config) result = job.result() return resu...
[ "def", "bq_load_table", "(", "df", ",", "table_id", ",", "schema", "=", "None", ",", "write", "=", "'WRITE_APPEND'", ")", ":", "client", "=", "bq_client", "(", ")", "job_config", "=", "bigquery", ".", "LoadJobConfig", "(", "schema", "=", "schema", ",", "...
Load Pandas dataframe into BigQuery table.
[ "Load", "Pandas", "dataframe", "into", "BigQuery", "table", "." ]
[ "\"\"\"Load Pandas dataframe into BigQuery table.\"\"\"", "# default append existing", "# wait for job to complete" ]
[ { "param": "df", "type": null }, { "param": "table_id", "type": null }, { "param": "schema", "type": null }, { "param": "write", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table_id", "type": null, "docstring": null, "docstring_tokens":...
ccbab2160ad1c6981ed0ae1dd2be5938f0af8ae2
llang629/hexpop
hexpop.py
[ "Apache-2.0" ]
Python
bq_query_table
<not_specific>
def bq_query_table(query, destination=None, write='WRITE_APPEND'): """Query BigQuery table using SQL.""" client = bq_client() job_config = bigquery.QueryJobConfig( destination=destination, write_disposition=write # default append existing ) job = client.query(query=query, job_config...
Query BigQuery table using SQL.
Query BigQuery table using SQL.
[ "Query", "BigQuery", "table", "using", "SQL", "." ]
def bq_query_table(query, destination=None, write='WRITE_APPEND'): client = bq_client() job_config = bigquery.QueryJobConfig( destination=destination, write_disposition=write ) job = client.query(query=query, job_config=job_config) try: result = job.result() except No...
[ "def", "bq_query_table", "(", "query", ",", "destination", "=", "None", ",", "write", "=", "'WRITE_APPEND'", ")", ":", "client", "=", "bq_client", "(", ")", "job_config", "=", "bigquery", ".", "QueryJobConfig", "(", "destination", "=", "destination", ",", "w...
Query BigQuery table using SQL.
[ "Query", "BigQuery", "table", "using", "SQL", "." ]
[ "\"\"\"Query BigQuery table using SQL.\"\"\"", "# default append existing", "# wait for job to complete" ]
[ { "param": "query", "type": null }, { "param": "destination", "type": null }, { "param": "write", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "query", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "destination", "type": null, "docstring": null, "docstring_to...
f1084128d2d65625755b8f41b72607dc98a6d6dd
rcritten/novajoin
novajoin/nova.py
[ "Apache-2.0" ]
Python
_nova_client
<not_specific>
def _nova_client(self): """Instantiate a new novaclient.Client object.""" session = keystone_client.get_session() return client.Client(str(self.version), session=session)
Instantiate a new novaclient.Client object.
Instantiate a new novaclient.Client object.
[ "Instantiate", "a", "new", "novaclient", ".", "Client", "object", "." ]
def _nova_client(self): session = keystone_client.get_session() return client.Client(str(self.version), session=session)
[ "def", "_nova_client", "(", "self", ")", ":", "session", "=", "keystone_client", ".", "get_session", "(", ")", "return", "client", ".", "Client", "(", "str", "(", "self", ".", "version", ")", ",", "session", "=", "session", ")" ]
Instantiate a new novaclient.Client object.
[ "Instantiate", "a", "new", "novaclient", ".", "Client", "object", "." ]
[ "\"\"\"Instantiate a new novaclient.Client object.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
372a2e6a1a8ee668d5e5714fd1e6e5350cc69215
rcritten/novajoin
novajoin/wsgi.py
[ "Apache-2.0" ]
Python
start
null
def start(self): """Start serving this service using loaded configuration. Also, retrieve updated port number in case '0' was passed in, which indicates a random port should be used. :returns: None """ self.server.start() self.port = self.server.port LO...
Start serving this service using loaded configuration. Also, retrieve updated port number in case '0' was passed in, which indicates a random port should be used. :returns: None
Start serving this service using loaded configuration. Also, retrieve updated port number in case '0' was passed in, which indicates a random port should be used.
[ "Start", "serving", "this", "service", "using", "loaded", "configuration", ".", "Also", "retrieve", "updated", "port", "number", "in", "case", "'", "0", "'", "was", "passed", "in", "which", "indicates", "a", "random", "port", "should", "be", "used", "." ]
def start(self): self.server.start() self.port = self.server.port LOG.info("Starting on port %d" % self.port)
[ "def", "start", "(", "self", ")", ":", "self", ".", "server", ".", "start", "(", ")", "self", ".", "port", "=", "self", ".", "server", ".", "port", "LOG", ".", "info", "(", "\"Starting on port %d\"", "%", "self", ".", "port", ")" ]
Start serving this service using loaded configuration.
[ "Start", "serving", "this", "service", "using", "loaded", "configuration", "." ]
[ "\"\"\"Start serving this service using loaded configuration.\n\n Also, retrieve updated port number in case '0' was passed in, which\n indicates a random port should be used.\n\n :returns: None\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
1658337e3cafe6596567b7410ae32e75aa4b40b4
rcritten/novajoin
novajoin/join.py
[ "Apache-2.0" ]
Python
_get_allowed_hostclass
<not_specific>
def _get_allowed_hostclass(self, project_name): """Get the allowed list of hostclass from configuration.""" try: group = CONF[project_name] except cfg.NoSuchOptError: # dynamically add the group into the configuration group = cfg.OptGroup(project_name, 'projec...
Get the allowed list of hostclass from configuration.
Get the allowed list of hostclass from configuration.
[ "Get", "the", "allowed", "list", "of", "hostclass", "from", "configuration", "." ]
def _get_allowed_hostclass(self, project_name): try: group = CONF[project_name] except cfg.NoSuchOptError: group = cfg.OptGroup(project_name, 'project options') CONF.register_group(group) CONF.register_opt(cfg.ListOpt('allowed_classes'), ...
[ "def", "_get_allowed_hostclass", "(", "self", ",", "project_name", ")", ":", "try", ":", "group", "=", "CONF", "[", "project_name", "]", "except", "cfg", ".", "NoSuchOptError", ":", "group", "=", "cfg", ".", "OptGroup", "(", "project_name", ",", "'project op...
Get the allowed list of hostclass from configuration.
[ "Get", "the", "allowed", "list", "of", "hostclass", "from", "configuration", "." ]
[ "\"\"\"Get the allowed list of hostclass from configuration.\"\"\"", "# dynamically add the group into the configuration" ]
[ { "param": "self", "type": null }, { "param": "project_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "project_name", "type": null, "docstring": null, "docstring_to...
1658337e3cafe6596567b7410ae32e75aa4b40b4
rcritten/novajoin
novajoin/join.py
[ "Apache-2.0" ]
Python
create
<not_specific>
def create(self, req, body=None): """Generate the OTP, register it with IPA Options passed in but as yet-unused are and user-data. """ if not body: LOG.error('No body in create request') raise base.Fault(webob.exc.HTTPBadRequest()) instance_id = body.get...
Generate the OTP, register it with IPA Options passed in but as yet-unused are and user-data.
Generate the OTP, register it with IPA Options passed in but as yet-unused are and user-data.
[ "Generate", "the", "OTP", "register", "it", "with", "IPA", "Options", "passed", "in", "but", "as", "yet", "-", "unused", "are", "and", "user", "-", "data", "." ]
def create(self, req, body=None): if not body: LOG.error('No body in create request') raise base.Fault(webob.exc.HTTPBadRequest()) instance_id = body.get('instance-id') image_id = body.get('image-id') project_id = body.get('project-id') hostname = body.get...
[ "def", "create", "(", "self", ",", "req", ",", "body", "=", "None", ")", ":", "if", "not", "body", ":", "LOG", ".", "error", "(", "'No body in create request'", ")", "raise", "base", ".", "Fault", "(", "webob", ".", "exc", ".", "HTTPBadRequest", "(", ...
Generate the OTP, register it with IPA Options passed in but as yet-unused are and user-data.
[ "Generate", "the", "OTP", "register", "it", "with", "IPA", "Options", "passed", "in", "but", "as", "yet", "-", "unused", "are", "and", "user", "-", "data", "." ]
[ "\"\"\"Generate the OTP, register it with IPA\n\n Options passed in but as yet-unused are and user-data.\n \"\"\"", "# Check the image metadata to see if enrollment was requested", "# Ensure this instance exists in nova and retrieve the", "# name of the user that requested it.", "# TODO(rcritt...
[ { "param": "self", "type": null }, { "param": "req", "type": null }, { "param": "body", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "req", "type": null, "docstring": null, "docstring_tokens": []...
bdaa24eb8bad195699039e7541a85b55f96ce9fe
rcritten/novajoin
novajoin/config.py
[ "Apache-2.0" ]
Python
find_config_files
<not_specific>
def find_config_files(): """Return a list of default configuration files. This is loosely based on the oslo.config version but makes it more specific to novajoin. We look for those config files in the following directories: ~/.join/join.conf ~/join.conf /etc/nova/join.conf /et...
Return a list of default configuration files. This is loosely based on the oslo.config version but makes it more specific to novajoin. We look for those config files in the following directories: ~/.join/join.conf ~/join.conf /etc/nova/join.conf /etc/join.conf /etc/join/join...
Return a list of default configuration files. This is loosely based on the oslo.config version but makes it more specific to novajoin. We look for those config files in the following directories.
[ "Return", "a", "list", "of", "default", "configuration", "files", ".", "This", "is", "loosely", "based", "on", "the", "oslo", ".", "config", "version", "but", "makes", "it", "more", "specific", "to", "novajoin", ".", "We", "look", "for", "those", "config",...
def find_config_files(): cfg_dirs = [ _fixpath('~/.join/'), _fixpath('~'), '/etc/nova/', '/etc' '/etc/join/' ] config_files = [] extension = '.conf' config_files.append(_search_dirs(cfg_dirs, 'join', extension)) return list(moves.filter(bool, config_files)...
[ "def", "find_config_files", "(", ")", ":", "cfg_dirs", "=", "[", "_fixpath", "(", "'~/.join/'", ")", ",", "_fixpath", "(", "'~'", ")", ",", "'/etc/nova/'", ",", "'/etc'", "'/etc/join/'", "]", "config_files", "=", "[", "]", "extension", "=", "'.conf'", "con...
Return a list of default configuration files.
[ "Return", "a", "list", "of", "default", "configuration", "files", "." ]
[ "\"\"\"Return a list of default configuration files.\n\n This is loosely based on the oslo.config version but makes it more\n specific to novajoin.\n\n We look for those config files in the following directories:\n\n ~/.join/join.conf\n ~/join.conf\n /etc/nova/join.conf\n /etc/join.conf...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
bc99ad1afb5ed00ea66963b0a5ad3f02b47ef7e4
rcritten/novajoin
novajoin/ipa.py
[ "Apache-2.0" ]
Python
__get_connection
<not_specific>
def __get_connection(self): """Make a connection to IPA or raise an error.""" tries = 0 while tries <= self.ntries: try: api.Backend.rpcclient.connect() except (errors.CCacheError, errors.TicketExpired) as e: LOG.debug("kinit again: %s", e...
Make a connection to IPA or raise an error.
Make a connection to IPA or raise an error.
[ "Make", "a", "connection", "to", "IPA", "or", "raise", "an", "error", "." ]
def __get_connection(self): tries = 0 while tries <= self.ntries: try: api.Backend.rpcclient.connect() except (errors.CCacheError, errors.TicketExpired) as e: LOG.debug("kinit again: %s", e) kinit_keytab(str('nova/%s@%s' % ...
[ "def", "__get_connection", "(", "self", ")", ":", "tries", "=", "0", "while", "tries", "<=", "self", ".", "ntries", ":", "try", ":", "api", ".", "Backend", ".", "rpcclient", ".", "connect", "(", ")", "except", "(", "errors", ".", "CCacheError", ",", ...
Make a connection to IPA or raise an error.
[ "Make", "a", "connection", "to", "IPA", "or", "raise", "an", "error", "." ]
[ "\"\"\"Make a connection to IPA or raise an error.\"\"\"", "# pylint: disable=no-member" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc99ad1afb5ed00ea66963b0a5ad3f02b47ef7e4
rcritten/novajoin
novajoin/ipa.py
[ "Apache-2.0" ]
Python
_call_ipa
null
def _call_ipa(self, command, *args, **kw): """Make an IPA call. Try twice to run the command. One execution may fail if we previously had a connection but the ticket expired. """ if not api.Backend.rpcclient.isconnected(): self.__get_connection() if 'v...
Make an IPA call. Try twice to run the command. One execution may fail if we previously had a connection but the ticket expired.
Make an IPA call. Try twice to run the command. One execution may fail if we previously had a connection but the ticket expired.
[ "Make", "an", "IPA", "call", ".", "Try", "twice", "to", "run", "the", "command", ".", "One", "execution", "may", "fail", "if", "we", "previously", "had", "a", "connection", "but", "the", "ticket", "expired", "." ]
def _call_ipa(self, command, *args, **kw): if not api.Backend.rpcclient.isconnected(): self.__get_connection() if 'version' not in kw: kw['version'] = u'2.146' try: api.Command[command](*args, **kw) except (errors.CCacheError, errors.TicketExpired): ...
[ "def", "_call_ipa", "(", "self", ",", "command", ",", "*", "args", ",", "**", "kw", ")", ":", "if", "not", "api", ".", "Backend", ".", "rpcclient", ".", "isconnected", "(", ")", ":", "self", ".", "__get_connection", "(", ")", "if", "'version'", "not"...
Make an IPA call.
[ "Make", "an", "IPA", "call", "." ]
[ "\"\"\"Make an IPA call.\n\n Try twice to run the command. One execution may fail if we\n previously had a connection but the ticket expired.\n \"\"\"", "# IPA v4.2.0 for compatibility" ]
[ { "param": "self", "type": null }, { "param": "command", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "command", "type": null, "docstring": null, "docstring_tokens"...
bc99ad1afb5ed00ea66963b0a5ad3f02b47ef7e4
rcritten/novajoin
novajoin/ipa.py
[ "Apache-2.0" ]
Python
delete_host
<not_specific>
def delete_host(self, hostname, metadata=None): """Delete a host from IPA and remove all related DNS entries.""" LOG.debug('In IPADeleteInstance') if not self._ipa_client_configured(): LOG.debug('IPA is not configured') return if metadata is None: me...
Delete a host from IPA and remove all related DNS entries.
Delete a host from IPA and remove all related DNS entries.
[ "Delete", "a", "host", "from", "IPA", "and", "remove", "all", "related", "DNS", "entries", "." ]
def delete_host(self, hostname, metadata=None): LOG.debug('In IPADeleteInstance') if not self._ipa_client_configured(): LOG.debug('IPA is not configured') return if metadata is None: metadata = {} params = [hostname] kw = { 'updated...
[ "def", "delete_host", "(", "self", ",", "hostname", ",", "metadata", "=", "None", ")", ":", "LOG", ".", "debug", "(", "'In IPADeleteInstance'", ")", "if", "not", "self", ".", "_ipa_client_configured", "(", ")", ":", "LOG", ".", "debug", "(", "'IPA is not c...
Delete a host from IPA and remove all related DNS entries.
[ "Delete", "a", "host", "from", "IPA", "and", "remove", "all", "related", "DNS", "entries", "." ]
[ "\"\"\"Delete a host from IPA and remove all related DNS entries.\"\"\"", "# TODO(rcrit): lookup instance in nova to get metadata to see if", "# the host was enrolled. For now assume yes." ]
[ { "param": "self", "type": null }, { "param": "hostname", "type": null }, { "param": "metadata", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hostname", "type": null, "docstring": null, "docstring_tokens...
bc99ad1afb5ed00ea66963b0a5ad3f02b47ef7e4
rcritten/novajoin
novajoin/ipa.py
[ "Apache-2.0" ]
Python
add_ip
<not_specific>
def add_ip(self, hostname, floating_ip): """Add a floating IP to a given hostname.""" LOG.debug('In add_ip') if not self._ipa_client_configured(): LOG.debug('IPA is not configured') return params = [{"__dns_name__": CONF.domain + "."}, {"__dns_...
Add a floating IP to a given hostname.
Add a floating IP to a given hostname.
[ "Add", "a", "floating", "IP", "to", "a", "given", "hostname", "." ]
def add_ip(self, hostname, floating_ip): LOG.debug('In add_ip') if not self._ipa_client_configured(): LOG.debug('IPA is not configured') return params = [{"__dns_name__": CONF.domain + "."}, {"__dns_name__": hostname}] kw = {'a_part_ip_address': ...
[ "def", "add_ip", "(", "self", ",", "hostname", ",", "floating_ip", ")", ":", "LOG", ".", "debug", "(", "'In add_ip'", ")", "if", "not", "self", ".", "_ipa_client_configured", "(", ")", ":", "LOG", ".", "debug", "(", "'IPA is not configured'", ")", "return"...
Add a floating IP to a given hostname.
[ "Add", "a", "floating", "IP", "to", "a", "given", "hostname", "." ]
[ "\"\"\"Add a floating IP to a given hostname.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "hostname", "type": null }, { "param": "floating_ip", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hostname", "type": null, "docstring": null, "docstring_tokens...
0d9bd717ebd4ec12c9d1ca1414a96591cf82f7fc
centre-for-humanities-computing/Meme-to-text
TextExtractor.py
[ "MIT" ]
Python
order_boxes
<not_specific>
def order_boxes(boxes): ''' method that orders boxes in a left-to-right, top-to-bottom approach. This has it's faults when it comes to memes, but generally is a safe-approach. ''' boxes.sort(key=lambda b: b[1]) # initially the line bottom is set to be the bottom of the first rect lin...
method that orders boxes in a left-to-right, top-to-bottom approach. This has it's faults when it comes to memes, but generally is a safe-approach.
method that orders boxes in a left-to-right, top-to-bottom approach. This has it's faults when it comes to memes, but generally is a safe-approach.
[ "method", "that", "orders", "boxes", "in", "a", "left", "-", "to", "-", "right", "top", "-", "to", "-", "bottom", "approach", ".", "This", "has", "it", "'", "s", "faults", "when", "it", "comes", "to", "memes", "but", "generally", "is", "a", "safe", ...
def order_boxes(boxes): boxes.sort(key=lambda b: b[1]) line_bottom = boxes[0][1]+boxes[0][3]-1 line_begin_idx = 0 for i in range(len(boxes)): if boxes[i][1] > line_bottom: boxes[line_begin_idx:i] = sorted(boxes[line_begin_idx:i], key=lambda b: b[0]) line_begin_idx = i ...
[ "def", "order_boxes", "(", "boxes", ")", ":", "boxes", ".", "sort", "(", "key", "=", "lambda", "b", ":", "b", "[", "1", "]", ")", "line_bottom", "=", "boxes", "[", "0", "]", "[", "1", "]", "+", "boxes", "[", "0", "]", "[", "3", "]", "-", "1...
method that orders boxes in a left-to-right, top-to-bottom approach.
[ "method", "that", "orders", "boxes", "in", "a", "left", "-", "to", "-", "right", "top", "-", "to", "-", "bottom", "approach", "." ]
[ "''' method that orders boxes in a left-to-right, top-to-bottom\n approach. This has it's faults when it comes to memes,\n but generally is a safe-approach.\n '''", "# initially the line bottom is set to be the bottom of the first rect", "# when a new box's top is below current line's bottom", ...
[ { "param": "boxes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "boxes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
3d3cd77286d689d0dfc092fe5ce6069b50f6a70b
junhahyung/Pytorch-Sketch-RNN
sketch_rnn.py
[ "MIT" ]
Python
purify
<not_specific>
def purify(strokes): """removes to small or too long sequences + removes large gaps""" data = [] for seq in strokes: if seq.shape[0] <= hp.max_seq_length and seq.shape[0] > 10: seq = np.minimum(seq, 1000) seq = np.maximum(seq, -1000) seq = np.array(seq, dtype=np.f...
removes to small or too long sequences + removes large gaps
removes to small or too long sequences + removes large gaps
[ "removes", "to", "small", "or", "too", "long", "sequences", "+", "removes", "large", "gaps" ]
def purify(strokes): data = [] for seq in strokes: if seq.shape[0] <= hp.max_seq_length and seq.shape[0] > 10: seq = np.minimum(seq, 1000) seq = np.maximum(seq, -1000) seq = np.array(seq, dtype=np.float32) data.append(seq) return data
[ "def", "purify", "(", "strokes", ")", ":", "data", "=", "[", "]", "for", "seq", "in", "strokes", ":", "if", "seq", ".", "shape", "[", "0", "]", "<=", "hp", ".", "max_seq_length", "and", "seq", ".", "shape", "[", "0", "]", ">", "10", ":", "seq",...
removes to small or too long sequences + removes large gaps
[ "removes", "to", "small", "or", "too", "long", "sequences", "+", "removes", "large", "gaps" ]
[ "\"\"\"removes to small or too long sequences + removes large gaps\"\"\"" ]
[ { "param": "strokes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "strokes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a80429b411fb1f6b308a26058ce0c818f12a58e3
mrfawy/ModernEnigma
test/testLevelEncryptor.py
[ "MIT" ]
Python
testApplyXor
null
def testApplyXor(self): seq=[1,2,3,4] result=self.levelEncryptor.applyXor(seq,40) self.assertNotEqual(result,seq) "if xored again should return original value" self.assertEqual(seq,self.levelEncryptor.applyXor(result,40))
if xored again should return original value
if xored again should return original value
[ "if", "xored", "again", "should", "return", "original", "value" ]
def testApplyXor(self): seq=[1,2,3,4] result=self.levelEncryptor.applyXor(seq,40) self.assertNotEqual(result,seq) self.assertEqual(seq,self.levelEncryptor.applyXor(result,40))
[ "def", "testApplyXor", "(", "self", ")", ":", "seq", "=", "[", "1", ",", "2", ",", "3", ",", "4", "]", "result", "=", "self", ".", "levelEncryptor", ".", "applyXor", "(", "seq", ",", "40", ")", "self", ".", "assertNotEqual", "(", "result", ",", "...
if xored again should return original value
[ "if", "xored", "again", "should", "return", "original", "value" ]
[ "\"if xored again should return original value\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9cca53b03646a64667acb08e91b22f94b36b334
qthibeault/MAVSDK-Python
mavsdk/telemetry_server_pb2_grpc.py
[ "BSD-3-Clause" ]
Python
PublishHome
null
def PublishHome(self, request, context): """Publish to 'home position' updates. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
Publish to 'home position' updates.
Publish to 'home position' updates.
[ "Publish", "to", "'", "home", "position", "'", "updates", "." ]
def PublishHome(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
[ "def", "PublishHome", "(", "self", ",", "request", ",", "context", ")", ":", "context", ".", "set_code", "(", "grpc", ".", "StatusCode", ".", "UNIMPLEMENTED", ")", "context", ".", "set_details", "(", "'Method not implemented!'", ")", "raise", "NotImplementedErro...
Publish to 'home position' updates.
[ "Publish", "to", "'", "home", "position", "'", "updates", "." ]
[ "\"\"\"Publish to 'home position' updates.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "context", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
a9cca53b03646a64667acb08e91b22f94b36b334
qthibeault/MAVSDK-Python
mavsdk/telemetry_server_pb2_grpc.py
[ "BSD-3-Clause" ]
Python
PublishPositionVelocityNed
null
def PublishPositionVelocityNed(self, request, context): """Publish to 'position velocity' updates. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
Publish to 'position velocity' updates.
Publish to 'position velocity' updates.
[ "Publish", "to", "'", "position", "velocity", "'", "updates", "." ]
def PublishPositionVelocityNed(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
[ "def", "PublishPositionVelocityNed", "(", "self", ",", "request", ",", "context", ")", ":", "context", ".", "set_code", "(", "grpc", ".", "StatusCode", ".", "UNIMPLEMENTED", ")", "context", ".", "set_details", "(", "'Method not implemented!'", ")", "raise", "Not...
Publish to 'position velocity' updates.
[ "Publish", "to", "'", "position", "velocity", "'", "updates", "." ]
[ "\"\"\"Publish to 'position velocity' updates.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "context", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
a9cca53b03646a64667acb08e91b22f94b36b334
qthibeault/MAVSDK-Python
mavsdk/telemetry_server_pb2_grpc.py
[ "BSD-3-Clause" ]
Python
PublishUnixEpochTime
null
def PublishUnixEpochTime(self, request, context): """Publish to 'unix epoch time' updates. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
Publish to 'unix epoch time' updates.
Publish to 'unix epoch time' updates.
[ "Publish", "to", "'", "unix", "epoch", "time", "'", "updates", "." ]
def PublishUnixEpochTime(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
[ "def", "PublishUnixEpochTime", "(", "self", ",", "request", ",", "context", ")", ":", "context", ".", "set_code", "(", "grpc", ".", "StatusCode", ".", "UNIMPLEMENTED", ")", "context", ".", "set_details", "(", "'Method not implemented!'", ")", "raise", "NotImplem...
Publish to 'unix epoch time' updates.
[ "Publish", "to", "'", "unix", "epoch", "time", "'", "updates", "." ]
[ "\"\"\"Publish to 'unix epoch time' updates.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "request", "type": null }, { "param": "context", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
89b2d9b77a6464f0f16eae2f8fc7426dd09308d8
headcode/home-assistant
homeassistant/components/zha/core/gateway.py
[ "Apache-2.0" ]
Python
async_device_initialized
null
async def async_device_initialized(self, device, is_new_join): """Handle device joined and basic information discovered (async).""" zha_device = self._async_get_or_create_device(device, is_new_join) discovery_infos = [] for endpoint_id, endpoint in device.endpoints.items(): ...
Handle device joined and basic information discovered (async).
Handle device joined and basic information discovered (async).
[ "Handle", "device", "joined", "and", "basic", "information", "discovered", "(", "async", ")", "." ]
async def async_device_initialized(self, device, is_new_join): zha_device = self._async_get_or_create_device(device, is_new_join) discovery_infos = [] for endpoint_id, endpoint in device.endpoints.items(): async_process_endpoint( self._hass, self._config, endpoint_id,...
[ "async", "def", "async_device_initialized", "(", "self", ",", "device", ",", "is_new_join", ")", ":", "zha_device", "=", "self", ".", "_async_get_or_create_device", "(", "device", ",", "is_new_join", ")", "discovery_infos", "=", "[", "]", "for", "endpoint_id", "...
Handle device joined and basic information discovered (async).
[ "Handle", "device", "joined", "and", "basic", "information", "discovered", "(", "async", ")", "." ]
[ "\"\"\"Handle device joined and basic information discovered (async).\"\"\"", "# configure the device", "# the device isn't a battery powered device so we should be able", "# to update it now" ]
[ { "param": "self", "type": null }, { "param": "device", "type": null }, { "param": "is_new_join", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": null, "docstring": null, "docstring_tokens":...
d6fa8eaf13854b2b3655a540bad9b0c38def26bb
niketanpansare/model_zoo
caffe/conversion_utils.py
[ "Apache-2.0" ]
Python
convert_caffemodel
null
def convert_caffemodel(network_file, caffemodel_file, output_dir, format='csv'): """ Saves the weights and bias in the caffemodel file to output_dir. This method requires caffe to be installed. Parameters ---------- network_file: string Path to the input network file caffemodel...
Saves the weights and bias in the caffemodel file to output_dir. This method requires caffe to be installed. Parameters ---------- network_file: string Path to the input network file caffemodel_file: string Path to the input caffemodel file output_dir: string ...
Saves the weights and bias in the caffemodel file to output_dir. This method requires caffe to be installed. Parameters string Path to the input network file string Path to the input caffemodel file string Output directory for weights/biases (local filesystem) string Output format for weights/biases (currently supp...
[ "Saves", "the", "weights", "and", "bias", "in", "the", "caffemodel", "file", "to", "output_dir", ".", "This", "method", "requires", "caffe", "to", "be", "installed", ".", "Parameters", "string", "Path", "to", "the", "input", "network", "file", "string", "Pat...
def convert_caffemodel(network_file, caffemodel_file, output_dir, format='csv'): if format != 'csv': raise ValueError('Only csv format supported in this version') net = caffe.Net(network_file, caffemodel_file, caffe.TEST) for layerName in net.params.keys(): num_parameters = len(net.params[layerName...
[ "def", "convert_caffemodel", "(", "network_file", ",", "caffemodel_file", ",", "output_dir", ",", "format", "=", "'csv'", ")", ":", "if", "format", "!=", "'csv'", ":", "raise", "ValueError", "(", "'Only csv format supported in this version'", ")", "net", "=", "caf...
Saves the weights and bias in the caffemodel file to output_dir.
[ "Saves", "the", "weights", "and", "bias", "in", "the", "caffemodel", "file", "to", "output_dir", "." ]
[ "\"\"\"\n Saves the weights and bias in the caffemodel file to output_dir. This method requires caffe to be installed.\n\n Parameters\n ----------\n network_file: string\n Path to the input network file\n \n caffemodel_file: string\n Path to the input caffemodel file\n \n ...
[ { "param": "network_file", "type": null }, { "param": "caffemodel_file", "type": null }, { "param": "output_dir", "type": null }, { "param": "format", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "network_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "caffemodel_file", "type": null, "docstring": null, "d...
d6fa8eaf13854b2b3655a540bad9b0c38def26bb
niketanpansare/model_zoo
caffe/conversion_utils.py
[ "Apache-2.0" ]
Python
save_lmdb
null
def save_lmdb(lmdb_file, output_dir, labels_file): """ Saves the images in the lmdb file to output_dir. This method requires caffe to be installed. Parameters ---------- lmdb_file: string Path to the input lmdb file output_dir: string Output directory for images (local ...
Saves the images in the lmdb file to output_dir. This method requires caffe to be installed. Parameters ---------- lmdb_file: string Path to the input lmdb file output_dir: string Output directory for images (local filesystem) labels_file: string Output fi...
Saves the images in the lmdb file to output_dir. This method requires caffe to be installed. Parameters string Path to the input lmdb file string Output directory for images (local filesystem) string Output file (local filesystem) which saves the file names and associated labels.
[ "Saves", "the", "images", "in", "the", "lmdb", "file", "to", "output_dir", ".", "This", "method", "requires", "caffe", "to", "be", "installed", ".", "Parameters", "string", "Path", "to", "the", "input", "lmdb", "file", "string", "Output", "directory", "for",...
def save_lmdb(lmdb_file, output_dir, labels_file): lmdb_cursor = lmdb.open(lmdb_file, readonly=True).begin().cursor() datum = caffe.proto.caffe_pb2.Datum() i = 1 with open(labels_file, 'w') as file: for _, value in lmdb_cursor: datum.ParseFromString(value) label = datum.l...
[ "def", "save_lmdb", "(", "lmdb_file", ",", "output_dir", ",", "labels_file", ")", ":", "lmdb_cursor", "=", "lmdb", ".", "open", "(", "lmdb_file", ",", "readonly", "=", "True", ")", ".", "begin", "(", ")", ".", "cursor", "(", ")", "datum", "=", "caffe",...
Saves the images in the lmdb file to output_dir.
[ "Saves", "the", "images", "in", "the", "lmdb", "file", "to", "output_dir", "." ]
[ "\"\"\"\n Saves the images in the lmdb file to output_dir. This method requires caffe to be installed.\n\n Parameters\n ----------\n lmdb_file: string\n Path to the input lmdb file\n \n output_dir: string\n Output directory for images (local filesystem)\n \n labels_file: st...
[ { "param": "lmdb_file", "type": null }, { "param": "output_dir", "type": null }, { "param": "labels_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lmdb_file", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "output_dir", "type": null, "docstring": null, "docstring...
41edafb7448d4a5760499cd007a5aca28b35b549
bannsec/pyvex
pyvex/IRExpr/__init__.py
[ "BSD-2-Clause" ]
Python
child_expressions
<not_specific>
def child_expressions(self): ''' A list of all of the expressions that this expression ends up evaluating. ''' expressions = [ ] for _,v in self.__dict__.iteritems(): if isinstance(v, IRExpr): expressions.append(v) expressions.extend(v....
A list of all of the expressions that this expression ends up evaluating.
A list of all of the expressions that this expression ends up evaluating.
[ "A", "list", "of", "all", "of", "the", "expressions", "that", "this", "expression", "ends", "up", "evaluating", "." ]
def child_expressions(self): expressions = [ ] for _,v in self.__dict__.iteritems(): if isinstance(v, IRExpr): expressions.append(v) expressions.extend(v.child_expressions) return expressions
[ "def", "child_expressions", "(", "self", ")", ":", "expressions", "=", "[", "]", "for", "_", ",", "v", "in", "self", ".", "__dict__", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "IRExpr", ")", ":", "expressions", ".", "append"...
A list of all of the expressions that this expression ends up evaluating.
[ "A", "list", "of", "all", "of", "the", "expressions", "that", "this", "expression", "ends", "up", "evaluating", "." ]
[ "'''\n A list of all of the expressions that this expression ends up evaluating.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
41edafb7448d4a5760499cd007a5aca28b35b549
bannsec/pyvex
pyvex/IRExpr/__init__.py
[ "BSD-2-Clause" ]
Python
constants
<not_specific>
def constants(self): ''' A list of all of the constants that this expression ends up using. ''' constants = [ ] for _,v in self.__dict__.iteritems(): if isinstance(v, IRExpr): constants.extend(v.constants) elif isinstance(v, IRConst): ...
A list of all of the constants that this expression ends up using.
A list of all of the constants that this expression ends up using.
[ "A", "list", "of", "all", "of", "the", "constants", "that", "this", "expression", "ends", "up", "using", "." ]
def constants(self): constants = [ ] for _,v in self.__dict__.iteritems(): if isinstance(v, IRExpr): constants.extend(v.constants) elif isinstance(v, IRConst): constants.append(v) return constants
[ "def", "constants", "(", "self", ")", ":", "constants", "=", "[", "]", "for", "_", ",", "v", "in", "self", ".", "__dict__", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "IRExpr", ")", ":", "constants", ".", "extend", "(", "...
A list of all of the constants that this expression ends up using.
[ "A", "list", "of", "all", "of", "the", "constants", "that", "this", "expression", "ends", "up", "using", "." ]
[ "'''\n A list of all of the constants that this expression ends up using.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
expressions
<not_specific>
def expressions(self): ''' All expressions contained in the IRSB. ''' expressions = [ ] for s in self.statements: expressions.extend(s.expressions) expressions.append(self.next) return expressions
All expressions contained in the IRSB.
All expressions contained in the IRSB.
[ "All", "expressions", "contained", "in", "the", "IRSB", "." ]
def expressions(self): expressions = [ ] for s in self.statements: expressions.extend(s.expressions) expressions.append(self.next) return expressions
[ "def", "expressions", "(", "self", ")", ":", "expressions", "=", "[", "]", "for", "s", "in", "self", ".", "statements", ":", "expressions", ".", "extend", "(", "s", ".", "expressions", ")", "expressions", ".", "append", "(", "self", ".", "next", ")", ...
All expressions contained in the IRSB.
[ "All", "expressions", "contained", "in", "the", "IRSB", "." ]
[ "'''\n All expressions contained in the IRSB.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
operations
<not_specific>
def operations(self): ''' All operations done by the IRSB. ''' ops = [ ] for e in self.expressions: if hasattr(e, 'op'): ops.append(e.op) return ops
All operations done by the IRSB.
All operations done by the IRSB.
[ "All", "operations", "done", "by", "the", "IRSB", "." ]
def operations(self): ops = [ ] for e in self.expressions: if hasattr(e, 'op'): ops.append(e.op) return ops
[ "def", "operations", "(", "self", ")", ":", "ops", "=", "[", "]", "for", "e", "in", "self", ".", "expressions", ":", "if", "hasattr", "(", "e", ",", "'op'", ")", ":", "ops", ".", "append", "(", "e", ".", "op", ")", "return", "ops" ]
All operations done by the IRSB.
[ "All", "operations", "done", "by", "the", "IRSB", "." ]
[ "'''\n All operations done by the IRSB.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
all_constants
<not_specific>
def all_constants(self): ''' Returns all constants (including incrementing of the program counter). ''' return sum((e.constants for e in self.expressions), [ ])
Returns all constants (including incrementing of the program counter).
Returns all constants (including incrementing of the program counter).
[ "Returns", "all", "constants", "(", "including", "incrementing", "of", "the", "program", "counter", ")", "." ]
def all_constants(self): return sum((e.constants for e in self.expressions), [ ])
[ "def", "all_constants", "(", "self", ")", ":", "return", "sum", "(", "(", "e", ".", "constants", "for", "e", "in", "self", ".", "expressions", ")", ",", "[", "]", ")" ]
Returns all constants (including incrementing of the program counter).
[ "Returns", "all", "constants", "(", "including", "incrementing", "of", "the", "program", "counter", ")", "." ]
[ "'''\n Returns all constants (including incrementing of the program counter).\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
constants
<not_specific>
def constants(self): ''' The constants (excluding updates of the program counter) in the IRSB. ''' return sum((s.constants for s in self.statements if not (isinstance(s, IRStmt.Put) and s.offset == self.offsIP)), [ ])
The constants (excluding updates of the program counter) in the IRSB.
The constants (excluding updates of the program counter) in the IRSB.
[ "The", "constants", "(", "excluding", "updates", "of", "the", "program", "counter", ")", "in", "the", "IRSB", "." ]
def constants(self): return sum((s.constants for s in self.statements if not (isinstance(s, IRStmt.Put) and s.offset == self.offsIP)), [ ])
[ "def", "constants", "(", "self", ")", ":", "return", "sum", "(", "(", "s", ".", "constants", "for", "s", "in", "self", ".", "statements", "if", "not", "(", "isinstance", "(", "s", ",", "IRStmt", ".", "Put", ")", "and", "s", ".", "offset", "==", "...
The constants (excluding updates of the program counter) in the IRSB.
[ "The", "constants", "(", "excluding", "updates", "of", "the", "program", "counter", ")", "in", "the", "IRSB", "." ]
[ "'''\n The constants (excluding updates of the program counter) in the IRSB.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
constant_jump_targets
<not_specific>
def constant_jump_targets(self): ''' The static jump targets of the basic block. ''' exits = set() for s in self.statements: if isinstance(s, IRStmt.Exit): exits.add(s.dst.value) default_target = self._get_defaultexit_target() if defau...
The static jump targets of the basic block.
The static jump targets of the basic block.
[ "The", "static", "jump", "targets", "of", "the", "basic", "block", "." ]
def constant_jump_targets(self): exits = set() for s in self.statements: if isinstance(s, IRStmt.Exit): exits.add(s.dst.value) default_target = self._get_defaultexit_target() if default_target is not None: exits.add(default_target) return e...
[ "def", "constant_jump_targets", "(", "self", ")", ":", "exits", "=", "set", "(", ")", "for", "s", "in", "self", ".", "statements", ":", "if", "isinstance", "(", "s", ",", "IRStmt", ".", "Exit", ")", ":", "exits", ".", "add", "(", "s", ".", "dst", ...
The static jump targets of the basic block.
[ "The", "static", "jump", "targets", "of", "the", "basic", "block", "." ]
[ "'''\n The static jump targets of the basic block.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bca58ee9596d1b36ad0ec60d253def4194168a23
bannsec/pyvex
pyvex/__init__.py
[ "BSD-2-Clause" ]
Python
_get_defaultexit_target
<not_specific>
def _get_defaultexit_target(self): ''' Retrieves the default exit target, if it is constant. ''' if isinstance(self.next, IRExpr.Const): return self.next.con.value if not isinstance(self.next, IRExpr.RdTmp): raise PyVEXError("unexpected self.next type: %s...
Retrieves the default exit target, if it is constant.
Retrieves the default exit target, if it is constant.
[ "Retrieves", "the", "default", "exit", "target", "if", "it", "is", "constant", "." ]
def _get_defaultexit_target(self): if isinstance(self.next, IRExpr.Const): return self.next.con.value if not isinstance(self.next, IRExpr.RdTmp): raise PyVEXError("unexpected self.next type: %s", self.next.__class__.__name__) tmp_next = self.next.tmp for stmt in r...
[ "def", "_get_defaultexit_target", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "next", ",", "IRExpr", ".", "Const", ")", ":", "return", "self", ".", "next", ".", "con", ".", "value", "if", "not", "isinstance", "(", "self", ".", "next", ...
Retrieves the default exit target, if it is constant.
[ "Retrieves", "the", "default", "exit", "target", "if", "it", "is", "constant", "." ]
[ "'''\n Retrieves the default exit target, if it is constant.\n '''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0b19d61d65adbc68e43dd3b0fa4c7563ee29d54
cirrus-geo/cirrus
src/cirrus/builtins/tasks/add-preview/lambda_function.py
[ "Apache-2.0" ]
Python
create_thumbnail
<not_specific>
def create_thumbnail(filename, logger, scale_percent=5): """ Add a thumbnail to item, generated from filename """ fnout = filename.replace('_preview.tif', '_thumb.png') logger.info(f"Creating thumbnail {fnout} from {filename}") try: gdal.Translate(fnout, filename, format='PNG', widthPct=scale_pe...
Add a thumbnail to item, generated from filename
Add a thumbnail to item, generated from filename
[ "Add", "a", "thumbnail", "to", "item", "generated", "from", "filename" ]
def create_thumbnail(filename, logger, scale_percent=5): fnout = filename.replace('_preview.tif', '_thumb.png') logger.info(f"Creating thumbnail {fnout} from {filename}") try: gdal.Translate(fnout, filename, format='PNG', widthPct=scale_percent, heightPct=scale_percent) return { ...
[ "def", "create_thumbnail", "(", "filename", ",", "logger", ",", "scale_percent", "=", "5", ")", ":", "fnout", "=", "filename", ".", "replace", "(", "'_preview.tif'", ",", "'_thumb.png'", ")", "logger", ".", "info", "(", "f\"Creating thumbnail {fnout} from {filenam...
Add a thumbnail to item, generated from filename
[ "Add", "a", "thumbnail", "to", "item", "generated", "from", "filename" ]
[ "\"\"\" Add a thumbnail to item, generated from filename \"\"\"" ]
[ { "param": "filename", "type": null }, { "param": "logger", "type": null }, { "param": "scale_percent", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "logger", "type": null, "docstring": null, "docstring_toke...
e0b19d61d65adbc68e43dd3b0fa4c7563ee29d54
cirrus-geo/cirrus
src/cirrus/builtins/tasks/add-preview/lambda_function.py
[ "Apache-2.0" ]
Python
calculate_ccc_values
<not_specific>
def calculate_ccc_values(filename, logger, lo=2.0, hi=96.0, bins=1000): """ Determine min and and max values for a Cumulative Count Cut """ ds = gdal.Open(filename) band = ds.GetRasterBand(1) # min, max, mean, std stats = band.GetStatistics(False, True) hist = numpy.array(band.GetHistogram(stats...
Determine min and and max values for a Cumulative Count Cut
Determine min and and max values for a Cumulative Count Cut
[ "Determine", "min", "and", "and", "max", "values", "for", "a", "Cumulative", "Count", "Cut" ]
def calculate_ccc_values(filename, logger, lo=2.0, hi=96.0, bins=1000): ds = gdal.Open(filename) band = ds.GetRasterBand(1) stats = band.GetStatistics(False, True) hist = numpy.array(band.GetHistogram(stats[0], stats[1], buckets=bins, approx_ok=False)) nchist = (hist/hist.sum()).cumsum() * 100 l...
[ "def", "calculate_ccc_values", "(", "filename", ",", "logger", ",", "lo", "=", "2.0", ",", "hi", "=", "96.0", ",", "bins", "=", "1000", ")", ":", "ds", "=", "gdal", ".", "Open", "(", "filename", ")", "band", "=", "ds", ".", "GetRasterBand", "(", "1...
Determine min and and max values for a Cumulative Count Cut
[ "Determine", "min", "and", "and", "max", "values", "for", "a", "Cumulative", "Count", "Cut" ]
[ "\"\"\" Determine min and and max values for a Cumulative Count Cut \"\"\"", "# min, max, mean, std" ]
[ { "param": "filename", "type": null }, { "param": "logger", "type": null }, { "param": "lo", "type": null }, { "param": "hi", "type": null }, { "param": "bins", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "logger", "type": null, "docstring": null, "docstring_toke...
e0b19d61d65adbc68e43dd3b0fa4c7563ee29d54
cirrus-geo/cirrus
src/cirrus/builtins/tasks/add-preview/lambda_function.py
[ "Apache-2.0" ]
Python
cogify
<not_specific>
def cogify(fin, fout, logger, nodata=None): """ Turn a geospatial image into a COG """ logger.info(f"Turning {fin} into COG named {fout}") output_profile = cog_profiles.get('deflate') output_profile.update(dict(BIGTIFF=os.environ.get("BIGTIFF", "IF_SAFER"))) output_profile['blockxsize'] = 256 ou...
Turn a geospatial image into a COG
Turn a geospatial image into a COG
[ "Turn", "a", "geospatial", "image", "into", "a", "COG" ]
def cogify(fin, fout, logger, nodata=None): logger.info(f"Turning {fin} into COG named {fout}") output_profile = cog_profiles.get('deflate') output_profile.update(dict(BIGTIFF=os.environ.get("BIGTIFF", "IF_SAFER"))) output_profile['blockxsize'] = 256 output_profile['blockysize'] = 256 threads = ...
[ "def", "cogify", "(", "fin", ",", "fout", ",", "logger", ",", "nodata", "=", "None", ")", ":", "logger", ".", "info", "(", "f\"Turning {fin} into COG named {fout}\"", ")", "output_profile", "=", "cog_profiles", ".", "get", "(", "'deflate'", ")", "output_profil...
Turn a geospatial image into a COG
[ "Turn", "a", "geospatial", "image", "into", "a", "COG" ]
[ "\"\"\" Turn a geospatial image into a COG \"\"\"" ]
[ { "param": "fin", "type": null }, { "param": "fout", "type": null }, { "param": "logger", "type": null }, { "param": "nodata", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fin", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fout", "type": null, "docstring": null, "docstring_tokens": []...
e0b19d61d65adbc68e43dd3b0fa4c7563ee29d54
cirrus-geo/cirrus
src/cirrus/builtins/tasks/add-preview/lambda_function.py
[ "Apache-2.0" ]
Python
reproject
null
def reproject(fin, fout, logger, crs='EPSG:4326'): """ Reproject file using GCPs into a known projection """ ''' # TODO - combine cogify with warping if possible envs = { "driver": "GTiff", "interleave": "pixel", "tiled": True, "blockxsize": 512, "blockysize": 512...
Reproject file using GCPs into a known projection
Reproject file using GCPs into a known projection
[ "Reproject", "file", "using", "GCPs", "into", "a", "known", "projection" ]
def reproject(fin, fout, logger, crs='EPSG:4326'): logger.debug('Reprojecting to %s: %s into %s' % (crs, fin, fout)) with rasterio.open(fin) as src: if src.crs: transform, width, height = calculate_default_transform( src.crs, crs, src.width, ...
[ "def", "reproject", "(", "fin", ",", "fout", ",", "logger", ",", "crs", "=", "'EPSG:4326'", ")", ":", "'''\n # TODO - combine cogify with warping if possible\n envs = {\n \"driver\": \"GTiff\",\n \"interleave\": \"pixel\",\n \"tiled\": True,\n \"blockxsi...
Reproject file using GCPs into a known projection
[ "Reproject", "file", "using", "GCPs", "into", "a", "known", "projection" ]
[ "\"\"\" Reproject file using GCPs into a known projection \"\"\"", "'''\n # TODO - combine cogify with warping if possible\n envs = {\n \"driver\": \"GTiff\",\n \"interleave\": \"pixel\",\n \"tiled\": True,\n \"blockxsize\": 512,\n \"blockysize\": 512,\n \"compress\...
[ { "param": "fin", "type": null }, { "param": "fout", "type": null }, { "param": "logger", "type": null }, { "param": "crs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fin", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fout", "type": null, "docstring": null, "docstring_tokens": []...
19eaf3611578abf9a78431ca82650ad3b21f39a7
cirrus-geo/cirrus
src/cirrus/builtins/tasks/convert-to-cog/lambda_function.py
[ "Apache-2.0" ]
Python
cogify
<not_specific>
def cogify(fin, fout, nodata=None, web_optimized=False, blocksize=256, overview_blocksize=128, overview_resampling='nearest'): """ Turn a geospatial image into a COG """ output_profile = cog_profiles.get('deflate') output_profile.update({ "BIGTIFF": os.getenv("BIGTIFF", "IF_SAFER"), ...
Turn a geospatial image into a COG
Turn a geospatial image into a COG
[ "Turn", "a", "geospatial", "image", "into", "a", "COG" ]
def cogify(fin, fout, nodata=None, web_optimized=False, blocksize=256, overview_blocksize=128, overview_resampling='nearest'): output_profile = cog_profiles.get('deflate') output_profile.update({ "BIGTIFF": os.getenv("BIGTIFF", "IF_SAFER"), "blockxsize": blocksize, "blockysize...
[ "def", "cogify", "(", "fin", ",", "fout", ",", "nodata", "=", "None", ",", "web_optimized", "=", "False", ",", "blocksize", "=", "256", ",", "overview_blocksize", "=", "128", ",", "overview_resampling", "=", "'nearest'", ")", ":", "output_profile", "=", "c...
Turn a geospatial image into a COG
[ "Turn", "a", "geospatial", "image", "into", "a", "COG" ]
[ "\"\"\" Turn a geospatial image into a COG \"\"\"" ]
[ { "param": "fin", "type": null }, { "param": "fout", "type": null }, { "param": "nodata", "type": null }, { "param": "web_optimized", "type": null }, { "param": "blocksize", "type": null }, { "param": "overview_blocksize", "type": null }, { ...
{ "returns": [], "raises": [], "params": [ { "identifier": "fin", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fout", "type": null, "docstring": null, "docstring_tokens": []...
e8456133aac4d719e2db8ce5cd2e5bbb9846b2a2
cirrus-geo/cirrus
src/cirrus/core/components/base/_lambda.py
[ "Apache-2.0" ]
Python
copy_for_config
<not_specific>
def copy_for_config(self): '''any modifications to config for serverless.yml go here''' lc = copy.deepcopy(self.lambda_config) lc.pop('pythonRequirements', None) return lc
any modifications to config for serverless.yml go here
any modifications to config for serverless.yml go here
[ "any", "modifications", "to", "config", "for", "serverless", ".", "yml", "go", "here" ]
def copy_for_config(self): lc = copy.deepcopy(self.lambda_config) lc.pop('pythonRequirements', None) return lc
[ "def", "copy_for_config", "(", "self", ")", ":", "lc", "=", "copy", ".", "deepcopy", "(", "self", ".", "lambda_config", ")", "lc", ".", "pop", "(", "'pythonRequirements'", ",", "None", ")", "return", "lc" ]
any modifications to config for serverless.yml go here
[ "any", "modifications", "to", "config", "for", "serverless", ".", "yml", "go", "here" ]
[ "'''any modifications to config for serverless.yml go here'''" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cf1e0ba1994b347596038144d1ff83f6053afb3a
bohniti/climate-challenge
Scripts/utils.py
[ "MIT" ]
Python
mip_optimization
<not_specific>
def mip_optimization(cal_df, y, constrain=3, daily_weights=None): """Mixed integer linear programming optimization with constraints. Args: y (numpy.ndarray): sum of daily features (dim=#ofdays) constrain (int): minimum days in office daily_weights (array): weighting of days, e.g. if you ...
Mixed integer linear programming optimization with constraints. Args: y (numpy.ndarray): sum of daily features (dim=#ofdays) constrain (int): minimum days in office daily_weights (array): weighting of days, e.g. if you prefer to come on mondays Return:
Mixed integer linear programming optimization with constraints.
[ "Mixed", "integer", "linear", "programming", "optimization", "with", "constraints", "." ]
def mip_optimization(cal_df, y, constrain=3, daily_weights=None): u = np.ones(len(y)) if daily_weights==None else daily_weights I = range(len(y)) m = Model("knapsack") w = [m.add_var(var_type=BINARY) for i in I] m.objective = maximize(xsum(y[i]* w[i] for i in I)) m += xsum(w[i] * u[i] f...
[ "def", "mip_optimization", "(", "cal_df", ",", "y", ",", "constrain", "=", "3", ",", "daily_weights", "=", "None", ")", ":", "u", "=", "np", ".", "ones", "(", "len", "(", "y", ")", ")", "if", "daily_weights", "==", "None", "else", "daily_weights", "I...
Mixed integer linear programming optimization with constraints.
[ "Mixed", "integer", "linear", "programming", "optimization", "with", "constraints", "." ]
[ "\"\"\"Mixed integer linear programming optimization with constraints.\n Args:\n y (numpy.ndarray): sum of daily features (dim=#ofdays)\n constrain (int): minimum days in office\n daily_weights (array): weighting of days, e.g. if you prefer to come on mondays\n Return:\n \n \"\...
[ { "param": "cal_df", "type": null }, { "param": "y", "type": null }, { "param": "constrain", "type": null }, { "param": "daily_weights", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cal_df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": "sum of daily features (dim=#ofday...
7c7d9b4f1811cbc49d6b1c3a5df15e6a0f03ebe5
carlalmadureira/py_permutation
permutation/mimic.py
[ "Unlicense" ]
Python
numero_permutacoes
int
def numero_permutacoes(self, num:int) -> int: """ retorna a quantidade possivel de permutacoes """ if num == 1: return 1 return num * self.numero_permutacoes(num - 1)
retorna a quantidade possivel de permutacoes
retorna a quantidade possivel de permutacoes
[ "retorna", "a", "quantidade", "possivel", "de", "permutacoes" ]
def numero_permutacoes(self, num:int) -> int: if num == 1: return 1 return num * self.numero_permutacoes(num - 1)
[ "def", "numero_permutacoes", "(", "self", ",", "num", ":", "int", ")", "->", "int", ":", "if", "num", "==", "1", ":", "return", "1", "return", "num", "*", "self", ".", "numero_permutacoes", "(", "num", "-", "1", ")" ]
retorna a quantidade possivel de permutacoes
[ "retorna", "a", "quantidade", "possivel", "de", "permutacoes" ]
[ "\"\"\" retorna a quantidade possivel de permutacoes \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "num", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num", "type": "int", "docstring": null, "docstring_tokens": [...
5d96627502252b7b85ba60849f6f6aa9fe2ddcec
sarisabban/ILMbot
ilm.py
[ "MIT" ]
Python
RSS
<not_specific>
def RSS(RSSURL): ''' Get title and URL from an RSS link ''' data = bs4.BeautifulSoup(requests.get(RSSURL).content, features='xml') items = data.findAll('item') item = items[random.randint(0, 9)] title = item.title.text link = item.link.text return(title, link)
Get title and URL from an RSS link
Get title and URL from an RSS link
[ "Get", "title", "and", "URL", "from", "an", "RSS", "link" ]
def RSS(RSSURL): data = bs4.BeautifulSoup(requests.get(RSSURL).content, features='xml') items = data.findAll('item') item = items[random.randint(0, 9)] title = item.title.text link = item.link.text return(title, link)
[ "def", "RSS", "(", "RSSURL", ")", ":", "data", "=", "bs4", ".", "BeautifulSoup", "(", "requests", ".", "get", "(", "RSSURL", ")", ".", "content", ",", "features", "=", "'xml'", ")", "items", "=", "data", ".", "findAll", "(", "'item'", ")", "item", ...
Get title and URL from an RSS link
[ "Get", "title", "and", "URL", "from", "an", "RSS", "link" ]
[ "''' Get title and URL from an RSS link '''" ]
[ { "param": "RSSURL", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "RSSURL", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5d96627502252b7b85ba60849f6f6aa9fe2ddcec
sarisabban/ILMbot
ilm.py
[ "MIT" ]
Python
main
null
def main(): ''' Run the script with a loop to by pass errors ''' for attempts in range(10): dateSTR = datetime.datetime.now().strftime('%d %B %Y @ %H:%M') try: info = RSS(random.choice(RSSlist)) Tweet(info) print('\x1b[32m[+] Tweeted - {}\x1b[0m'.format(dateSTR)) break except Exception as TheError: ...
Run the script with a loop to by pass errors
Run the script with a loop to by pass errors
[ "Run", "the", "script", "with", "a", "loop", "to", "by", "pass", "errors" ]
def main(): for attempts in range(10): dateSTR = datetime.datetime.now().strftime('%d %B %Y @ %H:%M') try: info = RSS(random.choice(RSSlist)) Tweet(info) print('\x1b[32m[+] Tweeted - {}\x1b[0m'.format(dateSTR)) break except Exception as TheError: print('\x1b[31m[-] ERROR - {} {}\x1b[0m'.format(The...
[ "def", "main", "(", ")", ":", "for", "attempts", "in", "range", "(", "10", ")", ":", "dateSTR", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%d %B %Y @ %H:%M'", ")", "try", ":", "info", "=", "RSS", "(", "random", ...
Run the script with a loop to by pass errors
[ "Run", "the", "script", "with", "a", "loop", "to", "by", "pass", "errors" ]
[ "''' Run the script with a loop to by pass errors '''" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
31bcc3d2065fc336265b0260bc93851188f20752
OlafHaag/bvh-tools
src/bvhtoolbox/manipulate/removeframes.py
[ "MIT" ]
Python
remove_frames
<not_specific>
def remove_frames(file_path, start, end=None, dst_file=None): """Delete frames in BVH file from start to end or to the end of file. :param file_path: BVH file to delete frames from. :type file_path: str :param start: First frame to be deleted. Frame count starts with 1. :type start: int :param ...
Delete frames in BVH file from start to end or to the end of file. :param file_path: BVH file to delete frames from. :type file_path: str :param start: First frame to be deleted. Frame count starts with 1. :type start: int :param end: Last frame to be deleted. If None, all frames after start are re...
Delete frames in BVH file from start to end or to the end of file.
[ "Delete", "frames", "in", "BVH", "file", "from", "start", "to", "end", "or", "to", "the", "end", "of", "file", "." ]
def remove_frames(file_path, start, end=None, dst_file=None): if end and (start >= end): print("First frame to remove is greater than last frame to remove. Aborting.\n" "File: {]".format(file_path)) return False file_type = os.path.splitext(file_path)[1].lower() if file_type !=...
[ "def", "remove_frames", "(", "file_path", ",", "start", ",", "end", "=", "None", ",", "dst_file", "=", "None", ")", ":", "if", "end", "and", "(", "start", ">=", "end", ")", ":", "print", "(", "\"First frame to remove is greater than last frame to remove. Abortin...
Delete frames in BVH file from start to end or to the end of file.
[ "Delete", "frames", "in", "BVH", "file", "from", "start", "to", "end", "or", "to", "the", "end", "of", "file", "." ]
[ "\"\"\"Delete frames in BVH file from start to end or to the end of file.\n\n :param file_path: BVH file to delete frames from.\n :type file_path: str\n :param start: First frame to be deleted. Frame count starts with 1.\n :type start: int\n :param end: Last frame to be deleted. If None, all frames a...
[ { "param": "file_path", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "dst_file", "type": null } ]
{ "returns": [ { "docstring": "Whether the file could be processed and saved.", "docstring_tokens": [ "Whether", "the", "file", "could", "be", "processed", "and", "saved", "." ], "type": "bool" } ], "raises": [...
60f107805270931318f7e68987b1d857a12a4faf
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2egg.py
[ "MIT" ]
Python
close_tables
<not_specific>
def close_tables(egg_string, target_level=0): """ The egg string is hierarchically ordered. This function appends curly brackets to close open tables. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param egg_string: :type egg_string: str ...
The egg string is hierarchically ordered. This function appends curly brackets to close open tables. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param egg_string: :type egg_string: str :param target_level: The level determinates the ta...
The egg string is hierarchically ordered. This function appends curly brackets to close open tables. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.
[ "The", "egg", "string", "is", "hierarchically", "ordered", ".", "This", "function", "appends", "curly", "brackets", "to", "close", "open", "tables", ".", "It", "takes", "the", "indentation", "of", "the", "last", "closed", "bracket", "as", "reference", "for", ...
def close_tables(egg_string, target_level=0): last_level = egg_string[egg_string[:-1].rfind("\n"):].count(" ") diff = last_level - target_level for level in range(diff): egg_string += '{0}}}\n'.format(' ' * (last_level - level - 1)) return egg_string
[ "def", "close_tables", "(", "egg_string", ",", "target_level", "=", "0", ")", ":", "last_level", "=", "egg_string", "[", "egg_string", "[", ":", "-", "1", "]", ".", "rfind", "(", "\"\\n\"", ")", ":", "]", ".", "count", "(", "\" \"", ")", "diff", "="...
The egg string is hierarchically ordered.
[ "The", "egg", "string", "is", "hierarchically", "ordered", "." ]
[ "\"\"\" The egg string is hierarchically ordered. This function appends curly brackets to close open tables.\n It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.\n :param egg_string:\n :type egg_string: str\n :param target_level: The level dete...
[ { "param": "egg_string", "type": null }, { "param": "target_level", "type": null } ]
{ "returns": [ { "docstring": "egg_string with closed tables.", "docstring_tokens": [ "egg_string", "with", "closed", "tables", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "egg_string", "type": null, ...
60f107805270931318f7e68987b1d857a12a4faf
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2egg.py
[ "MIT" ]
Python
bvh2egg
<not_specific>
def bvh2egg(bvh_path, dst_path=None, scale=1.0): """ Converts a BVH file into the Panda3D egg animation file format. When passing keyword arguments, keywords must be used! :param bvh_path: File path(s) for BVH source. :type bvh_path: str|list :param dst_path: File or folder path for destination Pan...
Converts a BVH file into the Panda3D egg animation file format. When passing keyword arguments, keywords must be used! :param bvh_path: File path(s) for BVH source. :type bvh_path: str|list :param dst_path: File or folder path for destination Panda3D Egg file. :type dst_path: str :param scale:...
Converts a BVH file into the Panda3D egg animation file format. When passing keyword arguments, keywords must be used!
[ "Converts", "a", "BVH", "file", "into", "the", "Panda3D", "egg", "animation", "file", "format", ".", "When", "passing", "keyword", "arguments", "keywords", "must", "be", "used!" ]
def bvh2egg(bvh_path, dst_path=None, scale=1.0): with open(bvh_path) as file_handle: mocap = BvhTree(file_handle.read()) coords_up = '<CoordinateSystem> { Z-up }\n' comment = '<Comment> {{ Converted from {0} }}\n'.format(os.path.basename(bvh_path)) init_table_str = '<Table> {\n <Bundle> Armatur...
[ "def", "bvh2egg", "(", "bvh_path", ",", "dst_path", "=", "None", ",", "scale", "=", "1.0", ")", ":", "with", "open", "(", "bvh_path", ")", "as", "file_handle", ":", "mocap", "=", "BvhTree", "(", "file_handle", ".", "read", "(", ")", ")", "coords_up", ...
Converts a BVH file into the Panda3D egg animation file format.
[ "Converts", "a", "BVH", "file", "into", "the", "Panda3D", "egg", "animation", "file", "format", "." ]
[ "\"\"\" Converts a BVH file into the Panda3D egg animation file format.\n When passing keyword arguments, keywords must be used!\n\n :param bvh_path: File path(s) for BVH source.\n :type bvh_path: str|list\n :param dst_path: File or folder path for destination Panda3D Egg file.\n :type dst_path: str\...
[ { "param": "bvh_path", "type": null }, { "param": "dst_path", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": "If the conversion was successful or not.", "docstring_tokens": [ "If", "the", "conversion", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "params": [ { ...
2bc515f523e2ffaab7de60e76f751c1f0f652807
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf.py
[ "MIT" ]
Python
bvh2xaf
<not_specific>
def bvh2xaf(bvh_path, dst_path=None, scale=1.0): """ Converts a BVH file into the Cal3D XAF animation file format. When passing keyword arguments, keywords must be used! :param bvh_path: File path(s) for BVH source. :type bvh_path: str|list :param dst_path: File or folder path for destination Cal3D...
Converts a BVH file into the Cal3D XAF animation file format. When passing keyword arguments, keywords must be used! :param bvh_path: File path(s) for BVH source. :type bvh_path: str|list :param dst_path: File or folder path for destination Cal3D animation file (XAF). :type dst_path: str :para...
Converts a BVH file into the Cal3D XAF animation file format. When passing keyword arguments, keywords must be used!
[ "Converts", "a", "BVH", "file", "into", "the", "Cal3D", "XAF", "animation", "file", "format", ".", "When", "passing", "keyword", "arguments", "keywords", "must", "be", "used!" ]
def bvh2xaf(bvh_path, dst_path=None, scale=1.0): with open(bvh_path) as file_handle: mocap = BvhTree(file_handle.read()) duration = (mocap.nframes - 1) * mocap.frame_time joint_names = mocap.get_joints_names() n_tracks = len(joint_names) xml_root = XmlTree.Element("ANIMATION") xml_root.s...
[ "def", "bvh2xaf", "(", "bvh_path", ",", "dst_path", "=", "None", ",", "scale", "=", "1.0", ")", ":", "with", "open", "(", "bvh_path", ")", "as", "file_handle", ":", "mocap", "=", "BvhTree", "(", "file_handle", ".", "read", "(", ")", ")", "duration", ...
Converts a BVH file into the Cal3D XAF animation file format.
[ "Converts", "a", "BVH", "file", "into", "the", "Cal3D", "XAF", "animation", "file", "format", "." ]
[ "\"\"\" Converts a BVH file into the Cal3D XAF animation file format.\n When passing keyword arguments, keywords must be used!\n\n :param bvh_path: File path(s) for BVH source.\n :type bvh_path: str|list\n :param dst_path: File or folder path for destination Cal3D animation file (XAF).\n :type dst_pa...
[ { "param": "bvh_path", "type": null }, { "param": "dst_path", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": "If the conversion was successful or not.", "docstring_tokens": [ "If", "the", "conversion", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "params": [ { ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_update_children
null
def _update_children(nodes): """ Fills the children property of joints. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict """ for node, properties in nodes.items(): parent = properties['parent'] try: p_props = nodes[parent] except KeyError: ...
Fills the children property of joints. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict
Fills the children property of joints.
[ "Fills", "the", "children", "property", "of", "joints", "." ]
def _update_children(nodes): for node, properties in nodes.items(): parent = properties['parent'] try: p_props = nodes[parent] except KeyError: if not parent: continue raise ValueError("ERROR: Parent of {} cannot be found in the hierarchy...
[ "def", "_update_children", "(", "nodes", ")", ":", "for", "node", ",", "properties", "in", "nodes", ".", "items", "(", ")", ":", "parent", "=", "properties", "[", "'parent'", "]", "try", ":", "p_props", "=", "nodes", "[", "parent", "]", "except", "KeyE...
Fills the children property of joints.
[ "Fills", "the", "children", "property", "of", "joints", "." ]
[ "\"\"\" Fills the children property of joints.\n \n :param nodes: Dictionary with skeleton hierarchy.\n :type nodes: dict\n \"\"\"", "# Root has no parent." ]
[ { "param": "nodes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nodes", "type": null, "docstring": "Dictionary with skeleton hierarchy.", "docstring_tokens": [ "Dictionary", "with", "skeleton", "hierarchy", "." ], "default": null, "...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_update_channels
null
def _update_channels(nodes, root_pos_channels, rot_channels): """ Add information about channels in root position and joint rotations to nodes. :param nodes: Dictionary with skeleton hierarchy to update. :param root_pos_channels: Which position channels the root has. :type root_pos_channels: list ...
Add information about channels in root position and joint rotations to nodes. :param nodes: Dictionary with skeleton hierarchy to update. :param root_pos_channels: Which position channels the root has. :type root_pos_channels: list :param rot_channels: Dictionary with mapping of joint name to list...
Add information about channels in root position and joint rotations to nodes.
[ "Add", "information", "about", "channels", "in", "root", "position", "and", "joint", "rotations", "to", "nodes", "." ]
def _update_channels(nodes, root_pos_channels, rot_channels): for node, properties in nodes.items(): if not properties['children']: continue if not properties['parent']: properties['channels'] = root_pos_channels + rot_channels[node] else: properties['chan...
[ "def", "_update_channels", "(", "nodes", ",", "root_pos_channels", ",", "rot_channels", ")", ":", "for", "node", ",", "properties", "in", "nodes", ".", "items", "(", ")", ":", "if", "not", "properties", "[", "'children'", "]", ":", "continue", "if", "not",...
Add information about channels in root position and joint rotations to nodes.
[ "Add", "information", "about", "channels", "in", "root", "position", "and", "joint", "rotations", "to", "nodes", "." ]
[ "\"\"\" Add information about channels in root position and joint rotations to nodes.\n \n :param nodes: Dictionary with skeleton hierarchy to update.\n :param root_pos_channels: Which position channels the root has.\n :type root_pos_channels: list\n :param rot_channels: Dictionary with mapping of jo...
[ { "param": "nodes", "type": null }, { "param": "root_pos_channels", "type": null }, { "param": "rot_channels", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nodes", "type": null, "docstring": "Dictionary with skeleton hierarchy to update.", "docstring_tokens": [ "Dictionary", "with", "skeleton", "hierarchy", "to", "update", "...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
hierarchy_sanity_check
<not_specific>
def hierarchy_sanity_check(nodes): """ Checks for errors in the skeleton's hierarchy. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :return: True if no error occurred. :rtype: bool """ found_root = False for node, properties in nodes.items(): parent = p...
Checks for errors in the skeleton's hierarchy. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :return: True if no error occurred. :rtype: bool
Checks for errors in the skeleton's hierarchy.
[ "Checks", "for", "errors", "in", "the", "skeleton", "'", "s", "hierarchy", "." ]
def hierarchy_sanity_check(nodes): found_root = False for node, properties in nodes.items(): parent = properties['parent'] if not parent: if found_root: raise ValueError("ERROR: Hierarchy can't have more than 1 root!") else: found_root = Tr...
[ "def", "hierarchy_sanity_check", "(", "nodes", ")", ":", "found_root", "=", "False", "for", "node", ",", "properties", "in", "nodes", ".", "items", "(", ")", ":", "parent", "=", "properties", "[", "'parent'", "]", "if", "not", "parent", ":", "if", "found...
Checks for errors in the skeleton's hierarchy.
[ "Checks", "for", "errors", "in", "the", "skeleton", "'", "s", "hierarchy", "." ]
[ "\"\"\" Checks for errors in the skeleton's hierarchy.\n \n :param nodes: Dictionary with skeleton hierarchy.\n :type nodes: dict\n :return: True if no error occurred.\n :rtype: bool\n \"\"\"", "# Would probably be caught before.", "# No error occurred." ]
[ { "param": "nodes", "type": null } ]
{ "returns": [ { "docstring": "True if no error occurred.", "docstring_tokens": [ "True", "if", "no", "error", "occurred", "." ], "type": "bool" } ], "raises": [], "params": [ { "identifier": "nodes", "type": null, ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
df_to_joints
<not_specific>
def df_to_joints(df): """ Return joint names from list of degrees of freedom. List of joint names is sorted alphabetically. :param df: List of degrees of freedom like ["joint.x",]. :type df: list :return: Joint names. :rtype: list """ joints = sorted(set((x.split('.')[0] for x in df if ...
Return joint names from list of degrees of freedom. List of joint names is sorted alphabetically. :param df: List of degrees of freedom like ["joint.x",]. :type df: list :return: Joint names. :rtype: list
Return joint names from list of degrees of freedom. List of joint names is sorted alphabetically.
[ "Return", "joint", "names", "from", "list", "of", "degrees", "of", "freedom", ".", "List", "of", "joint", "names", "is", "sorted", "alphabetically", "." ]
def df_to_joints(df): joints = sorted(set((x.split('.')[0] for x in df if x != 'time'))) return joints
[ "def", "df_to_joints", "(", "df", ")", ":", "joints", "=", "sorted", "(", "set", "(", "(", "x", ".", "split", "(", "'.'", ")", "[", "0", "]", "for", "x", "in", "df", "if", "x", "!=", "'time'", ")", ")", ")", "return", "joints" ]
Return joint names from list of degrees of freedom.
[ "Return", "joint", "names", "from", "list", "of", "degrees", "of", "freedom", "." ]
[ "\"\"\" Return joint names from list of degrees of freedom. List of joint names is sorted alphabetically.\n \n :param df: List of degrees of freedom like [\"joint.x\",].\n :type df: list\n :return: Joint names.\n :rtype: list\n \"\"\"" ]
[ { "param": "df", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "list" } ], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": "List of degrees of freedom like [\"joint.x\",].", "docstring_tokens": [ ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_df_to_channels
<not_specific>
def _df_to_channels(df): """ Map channels from degrees of freedom to joint names. :param df: These are the columns names of the rotations.csv. :type df: list :return: Dictionary with joint names as keys and list of rotation channels as values. :rtype: dict """ # Get a version of df that...
Map channels from degrees of freedom to joint names. :param df: These are the columns names of the rotations.csv. :type df: list :return: Dictionary with joint names as keys and list of rotation channels as values. :rtype: dict
Map channels from degrees of freedom to joint names.
[ "Map", "channels", "from", "degrees", "of", "freedom", "to", "joint", "names", "." ]
def _df_to_channels(df): dof = df.copy() dof.remove('time') joints = df_to_joints(df) joint_channels = dict() try: for joint in joints: joint_channels[joint] = [ch.split('.')[1].upper() + "rotation" for ch in dof if joint == ch.split('.')[0]] except IndexError: raise ...
[ "def", "_df_to_channels", "(", "df", ")", ":", "dof", "=", "df", ".", "copy", "(", ")", "dof", ".", "remove", "(", "'time'", ")", "joints", "=", "df_to_joints", "(", "df", ")", "joint_channels", "=", "dict", "(", ")", "try", ":", "for", "joint", "i...
Map channels from degrees of freedom to joint names.
[ "Map", "channels", "from", "degrees", "of", "freedom", "to", "joint", "names", "." ]
[ "\"\"\" Map channels from degrees of freedom to joint names.\n \n :param df: These are the columns names of the rotations.csv.\n :type df: list\n :return: Dictionary with joint names as keys and list of rotation channels as values.\n :rtype: dict\n \"\"\"", "# Get a version of df that does not c...
[ { "param": "df", "type": null } ]
{ "returns": [ { "docstring": "Dictionary with joint names as keys and list of rotation channels as values.", "docstring_tokens": [ "Dictionary", "with", "joint", "names", "as", "keys", "and", "list", "of", "rotation", ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_get_joint_string
<not_specific>
def _get_joint_string(nodes, joint): """ Compose bvh string representation of a joint in hierarchy with indentation according to its depth. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :param joint: Name of the joint in question. :type joint: str :return: The joints p...
Compose bvh string representation of a joint in hierarchy with indentation according to its depth. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :param joint: Name of the joint in question. :type joint: str :return: The joints part of the bvh hierarchy section. :rtype...
Compose bvh string representation of a joint in hierarchy with indentation according to its depth.
[ "Compose", "bvh", "string", "representation", "of", "a", "joint", "in", "hierarchy", "with", "indentation", "according", "to", "its", "depth", "." ]
def _get_joint_string(nodes, joint): depth = _get_joint_depth(nodes, joint) properties = nodes[joint] if not properties['parent']: s = '{0}ROOT {1}\n'.format(' ' * depth, str(joint)) elif not properties['children']: s = '{0}{1}\n'.format(' ' * depth, 'End Site') else: s = '...
[ "def", "_get_joint_string", "(", "nodes", ",", "joint", ")", ":", "depth", "=", "_get_joint_depth", "(", "nodes", ",", "joint", ")", "properties", "=", "nodes", "[", "joint", "]", "if", "not", "properties", "[", "'parent'", "]", ":", "s", "=", "'{0}ROOT ...
Compose bvh string representation of a joint in hierarchy with indentation according to its depth.
[ "Compose", "bvh", "string", "representation", "of", "a", "joint", "in", "hierarchy", "with", "indentation", "according", "to", "its", "depth", "." ]
[ "\"\"\" Compose bvh string representation of a joint in hierarchy with indentation according to its depth.\n \n :param nodes: Dictionary with skeleton hierarchy.\n :type nodes: dict\n :param joint: Name of the joint in question.\n :type joint: str\n :return: The joints part of the bvh hierarchy se...
[ { "param": "nodes", "type": null }, { "param": "joint", "type": null } ]
{ "returns": [ { "docstring": "The joints part of the bvh hierarchy section.", "docstring_tokens": [ "The", "joints", "part", "of", "the", "bvh", "hierarchy", "section", "." ], "type": "str" } ], "raises": [], ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_close_scopes
<not_specific>
def _close_scopes(hierarchy_string, target_depth=0): """ The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param hierarchy_string: :type hierarch...
The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param hierarchy_string: :type hierarchy_string: str :param target_depth: The depth determines ...
The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.
[ "The", "string", "is", "hierarchically", "ordered", ".", "This", "function", "appends", "curly", "brackets", "to", "close", "open", "scopes", ".", "It", "takes", "the", "indentation", "of", "the", "last", "closed", "bracket", "as", "reference", "for", "the", ...
def _close_scopes(hierarchy_string, target_depth=0): last_depth = hierarchy_string[hierarchy_string[:-1].rfind("\n"):].count(" ") diff = last_depth - target_depth for depth in range(diff): hierarchy_string += '{0}}}\n'.format(' ' * (last_depth - depth - 1)) return hierarchy_string
[ "def", "_close_scopes", "(", "hierarchy_string", ",", "target_depth", "=", "0", ")", ":", "last_depth", "=", "hierarchy_string", "[", "hierarchy_string", "[", ":", "-", "1", "]", ".", "rfind", "(", "\"\\n\"", ")", ":", "]", ".", "count", "(", "\" \"", "...
The string is hierarchically ordered.
[ "The", "string", "is", "hierarchically", "ordered", "." ]
[ "\"\"\" The string is hierarchically ordered. This function appends curly brackets to close open scopes.\n It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.\n :param hierarchy_string:\n :type hierarchy_string: str\n :param target_depth: The de...
[ { "param": "hierarchy_string", "type": null }, { "param": "target_depth", "type": null } ]
{ "returns": [ { "docstring": "string with closed scopes.", "docstring_tokens": [ "string", "with", "closed", "scopes", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "hierarchy_string", "type": null, ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_get_hierarchy_string
<not_specific>
def _get_hierarchy_string(nodes): """ Compose the hierarchy part of a bvh file. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :return: Hierarchy as bvh string representation. :rtype: str """ s = 'HIERARCHY\n' for joint in nodes: s = _close_scopes(s, _ge...
Compose the hierarchy part of a bvh file. :param nodes: Dictionary with skeleton hierarchy. :type nodes: dict :return: Hierarchy as bvh string representation. :rtype: str
Compose the hierarchy part of a bvh file.
[ "Compose", "the", "hierarchy", "part", "of", "a", "bvh", "file", "." ]
def _get_hierarchy_string(nodes): s = 'HIERARCHY\n' for joint in nodes: s = _close_scopes(s, _get_joint_depth(nodes, joint)) s += _get_joint_string(nodes, joint) s = _close_scopes(s) return s
[ "def", "_get_hierarchy_string", "(", "nodes", ")", ":", "s", "=", "'HIERARCHY\\n'", "for", "joint", "in", "nodes", ":", "s", "=", "_close_scopes", "(", "s", ",", "_get_joint_depth", "(", "nodes", ",", "joint", ")", ")", "s", "+=", "_get_joint_string", "(",...
Compose the hierarchy part of a bvh file.
[ "Compose", "the", "hierarchy", "part", "of", "a", "bvh", "file", "." ]
[ "\"\"\" Compose the hierarchy part of a bvh file.\n \n :param nodes: Dictionary with skeleton hierarchy.\n :type nodes: dict\n :return: Hierarchy as bvh string representation.\n :rtype: str\n \"\"\"" ]
[ { "param": "nodes", "type": null } ]
{ "returns": [ { "docstring": "Hierarchy as bvh string representation.", "docstring_tokens": [ "Hierarchy", "as", "bvh", "string", "representation", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "node...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
_get_motion_string
<not_specific>
def _get_motion_string(n_frames, frame_time, frames): """ Compose the motion part of a bvh file. :param n_frames: Number of frames. :type n_frames: int :param frame_time: Time in seconds it takes to advance 1 frame. :type frame_time: float :param frames: The motion data for channels of all ...
Compose the motion part of a bvh file. :param n_frames: Number of frames. :type n_frames: int :param frame_time: Time in seconds it takes to advance 1 frame. :type frame_time: float :param frames: The motion data for channels of all joints. :type frames: numpy.ndarray :return: Motion a...
Compose the motion part of a bvh file.
[ "Compose", "the", "motion", "part", "of", "a", "bvh", "file", "." ]
def _get_motion_string(n_frames, frame_time, frames): s = 'MOTION\n' s += 'Frames: {}\n'.format(n_frames) s += 'Frame Time: {}\n'.format(frame_time) for frame in frames.astype(str): s += ' '.join(frame) s += '\n' return s
[ "def", "_get_motion_string", "(", "n_frames", ",", "frame_time", ",", "frames", ")", ":", "s", "=", "'MOTION\\n'", "s", "+=", "'Frames: {}\\n'", ".", "format", "(", "n_frames", ")", "s", "+=", "'Frame Time: {}\\n'", ".", "format", "(", "frame_time", ")", "fo...
Compose the motion part of a bvh file.
[ "Compose", "the", "motion", "part", "of", "a", "bvh", "file", "." ]
[ "\"\"\" Compose the motion part of a bvh file.\n \n :param n_frames: Number of frames.\n :type n_frames: int\n :param frame_time: Time in seconds it takes to advance 1 frame.\n :type frame_time: float\n :param frames: The motion data for channels of all joints.\n :type frames: numpy.ndarray\n ...
[ { "param": "n_frames", "type": null }, { "param": "frame_time", "type": null }, { "param": "frames", "type": null } ]
{ "returns": [ { "docstring": "Motion as string representation.", "docstring_tokens": [ "Motion", "as", "string", "representation", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "n_frames", "type": null...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
csv2bvh_string
<not_specific>
def csv2bvh_string(hierarchy_file, position_file, rotation_file, scale=1.0): """ Compose the contents of a bvh file from CSV files. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z :type hierarchy_file: str :param position_file: CSV fil...
Compose the contents of a bvh file from CSV files. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z :type hierarchy_file: str :param position_file: CSV file path to positions. :type position_file: str :param rotation_file:CSV file ...
Compose the contents of a bvh file from CSV files.
[ "Compose", "the", "contents", "of", "a", "bvh", "file", "from", "CSV", "files", "." ]
def csv2bvh_string(hierarchy_file, position_file, rotation_file, scale=1.0): joint_info = get_hierarchy_data(hierarchy_file) root_name = get_root_name(joint_info) pos_df, positions = get_transform_data(position_file) positions *= scale root_pos_df = [channel for channel in pos_df if root_name == cha...
[ "def", "csv2bvh_string", "(", "hierarchy_file", ",", "position_file", ",", "rotation_file", ",", "scale", "=", "1.0", ")", ":", "joint_info", "=", "get_hierarchy_data", "(", "hierarchy_file", ")", "root_name", "=", "get_root_name", "(", "joint_info", ")", "pos_df"...
Compose the contents of a bvh file from CSV files.
[ "Compose", "the", "contents", "of", "a", "bvh", "file", "from", "CSV", "files", "." ]
[ "\"\"\" Compose the contents of a bvh file from CSV files.\n \n :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z\n :type hierarchy_file: str\n :param position_file: CSV file path to positions.\n :type position_file: str\n :param rotati...
[ { "param": "hierarchy_file", "type": null }, { "param": "position_file", "type": null }, { "param": "rotation_file", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": "String that can be written to BVH file or build BvhTree from.", "docstring_tokens": [ "String", "that", "can", "be", "written", "to", "BVH", "file", "or", "build", "BvhTree", ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
csv2bvhtree
<not_specific>
def csv2bvhtree(hierarchy_file, position_file, rotation_file, scale=1.0): """ Get a BvhTree instance from input CSV files. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z :type hierarchy_file: str :param position_file: CSV file path to pos...
Get a BvhTree instance from input CSV files. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z :type hierarchy_file: str :param position_file: CSV file path to positions. :type position_file: str :param rotation_file:CSV file path to ro...
Get a BvhTree instance from input CSV files.
[ "Get", "a", "BvhTree", "instance", "from", "input", "CSV", "files", "." ]
def csv2bvhtree(hierarchy_file, position_file, rotation_file, scale=1.0): data = csv2bvh_string(hierarchy_file, position_file, rotation_file, scale) bvh_tree = BvhTree(data) return bvh_tree
[ "def", "csv2bvhtree", "(", "hierarchy_file", ",", "position_file", ",", "rotation_file", ",", "scale", "=", "1.0", ")", ":", "data", "=", "csv2bvh_string", "(", "hierarchy_file", ",", "position_file", ",", "rotation_file", ",", "scale", ")", "bvh_tree", "=", "...
Get a BvhTree instance from input CSV files.
[ "Get", "a", "BvhTree", "instance", "from", "input", "CSV", "files", "." ]
[ "\"\"\" Get a BvhTree instance from input CSV files.\n\n :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z\n :type hierarchy_file: str\n :param position_file: CSV file path to positions.\n :type position_file: str\n :param rotation_file:CS...
[ { "param": "hierarchy_file", "type": null }, { "param": "position_file", "type": null }, { "param": "rotation_file", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "bvh.BvhTree" } ], "raises": [], "params": [ { "identifier": "hierarchy_file", "type": null, "docstring": "CSV file path containing hierarchy.", "docstring_tokens": [ ...
1abf238d73f05e43154ee039ed120e2e6bac5869
OlafHaag/bvh-tools
src/bvhtoolbox/convert/csv2bvh.py
[ "MIT" ]
Python
csv2bvh_file
<not_specific>
def csv2bvh_file(hierarchy_file, position_file, rotation_file, destination_file=None, scale=1.0): """ Composes BVH file from CSV input files. If no destination path is given, CSV file path is used. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset...
Composes BVH file from CSV input files. If no destination path is given, CSV file path is used. :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z :type hierarchy_file: str :param position_file: CSV file path to positions. :type position...
Composes BVH file from CSV input files. If no destination path is given, CSV file path is used.
[ "Composes", "BVH", "file", "from", "CSV", "input", "files", ".", "If", "no", "destination", "path", "is", "given", "CSV", "file", "path", "is", "used", "." ]
def csv2bvh_file(hierarchy_file, position_file, rotation_file, destination_file=None, scale=1.0): if not destination_file: bvh_file = os.path.basename(hierarchy_file).replace('_hierarchy', '').replace('.csv', '.bvh') destination_file = os.path.join(os.path.dirname(hierarchy_file), bvh_file) else...
[ "def", "csv2bvh_file", "(", "hierarchy_file", ",", "position_file", ",", "rotation_file", ",", "destination_file", "=", "None", ",", "scale", "=", "1.0", ")", ":", "if", "not", "destination_file", ":", "bvh_file", "=", "os", ".", "path", ".", "basename", "("...
Composes BVH file from CSV input files.
[ "Composes", "BVH", "file", "from", "CSV", "input", "files", "." ]
[ "\"\"\" Composes BVH file from CSV input files. If no destination path is given, CSV file path is used.\n \n :param hierarchy_file: CSV file path containing hierarchy. Columns: joint, parent, offset.x, offset.y, offset.z\n :type hierarchy_file: str\n :param position_file: CSV file path to positions.\n ...
[ { "param": "hierarchy_file", "type": null }, { "param": "position_file", "type": null }, { "param": "rotation_file", "type": null }, { "param": "destination_file", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": "Whether writing to file was successful or not.", "docstring_tokens": [ "Whether", "writing", "to", "file", "was", "successful", "or", "not", "." ], "type": null } ], "raises": [],...
e67fb9b63d25cf6223695f5a50663c1d97cc3db7
OlafHaag/bvh-tools
src/bvhtoolbox/bvhtransforms.py
[ "MIT" ]
Python
prune
null
def prune(a, epsilon=0.00000001): """Sets absolute values smaller than epsilon to 0. It does this in-place on the input array. :param a: array :type a: numpy.ndarray :param epsilon: threshold :type epsilon: float """ a[np.abs(a) < epsilon] = 0.0
Sets absolute values smaller than epsilon to 0. It does this in-place on the input array. :param a: array :type a: numpy.ndarray :param epsilon: threshold :type epsilon: float
Sets absolute values smaller than epsilon to 0. It does this in-place on the input array.
[ "Sets", "absolute", "values", "smaller", "than", "epsilon", "to", "0", ".", "It", "does", "this", "in", "-", "place", "on", "the", "input", "array", "." ]
def prune(a, epsilon=0.00000001): a[np.abs(a) < epsilon] = 0.0
[ "def", "prune", "(", "a", ",", "epsilon", "=", "0.00000001", ")", ":", "a", "[", "np", ".", "abs", "(", "a", ")", "<", "epsilon", "]", "=", "0.0" ]
Sets absolute values smaller than epsilon to 0.
[ "Sets", "absolute", "values", "smaller", "than", "epsilon", "to", "0", "." ]
[ "\"\"\"Sets absolute values smaller than epsilon to 0.\n It does this in-place on the input array.\n\n :param a: array\n :type a: numpy.ndarray\n :param epsilon: threshold\n :type epsilon: float\n \"\"\"" ]
[ { "param": "a", "type": null }, { "param": "epsilon", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "a", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null }, { "identifier": "epsilon", "type": null, "docstring": null, ...
e67fb9b63d25cf6223695f5a50663c1d97cc3db7
OlafHaag/bvh-tools
src/bvhtoolbox/bvhtransforms.py
[ "MIT" ]
Python
reorder_axes
<not_specific>
def reorder_axes(xyz, axes='zxy'): """Takes an input array in xyz order and re-arranges it to given axes order. :param xyz: array with x,y,z order. :param axes: output order for Euler conversions respective to axes. :return: array in axes order. :rtype: numpy.ndarray """ if xyz.shape[-1] !=...
Takes an input array in xyz order and re-arranges it to given axes order. :param xyz: array with x,y,z order. :param axes: output order for Euler conversions respective to axes. :return: array in axes order. :rtype: numpy.ndarray
Takes an input array in xyz order and re-arranges it to given axes order.
[ "Takes", "an", "input", "array", "in", "xyz", "order", "and", "re", "-", "arranges", "it", "to", "given", "axes", "order", "." ]
def reorder_axes(xyz, axes='zxy'): if xyz.shape[-1] != 3 or len(xyz.shape) > 2: print("ERROR: Frames must be 1D or 2D array with 3 columns for x,y,z axes!") raise ValueError if axes == 'xyz': return xyz i, j, k = _get_reordered_indices(axes) if len(xyz.shape) == 1: res = ...
[ "def", "reorder_axes", "(", "xyz", ",", "axes", "=", "'zxy'", ")", ":", "if", "xyz", ".", "shape", "[", "-", "1", "]", "!=", "3", "or", "len", "(", "xyz", ".", "shape", ")", ">", "2", ":", "print", "(", "\"ERROR: Frames must be 1D or 2D array with 3 co...
Takes an input array in xyz order and re-arranges it to given axes order.
[ "Takes", "an", "input", "array", "in", "xyz", "order", "and", "re", "-", "arranges", "it", "to", "given", "axes", "order", "." ]
[ "\"\"\"Takes an input array in xyz order and re-arranges it to given axes order.\n\n :param xyz: array with x,y,z order.\n :param axes: output order for Euler conversions respective to axes.\n :return: array in axes order.\n :rtype: numpy.ndarray\n \"\"\"", "# If the output order is the same as the...
[ { "param": "xyz", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": "array in axes order.", "docstring_tokens": [ "array", "in", "axes", "order", "." ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "xyz", "type": null, "docstring"...
e67fb9b63d25cf6223695f5a50663c1d97cc3db7
OlafHaag/bvh-tools
src/bvhtoolbox/bvhtransforms.py
[ "MIT" ]
Python
_get_reordered_indices
<not_specific>
def _get_reordered_indices(rotation_order): """Returns indices for converting 'xyz' rotation order to given rotation order. :param rotation_order: Rotation order to convert to. :type rotation_order: str :return: Indices for getting from xyz to given axes rotation order. :rtype: tuple """ ...
Returns indices for converting 'xyz' rotation order to given rotation order. :param rotation_order: Rotation order to convert to. :type rotation_order: str :return: Indices for getting from xyz to given axes rotation order. :rtype: tuple
Returns indices for converting 'xyz' rotation order to given rotation order.
[ "Returns", "indices", "for", "converting", "'", "xyz", "'", "rotation", "order", "to", "given", "rotation", "order", "." ]
def _get_reordered_indices(rotation_order): try: firstaxis, parity = _AXES2TUPLE[rotation_order] except KeyError: print("Rotation order must be one of {}.".format(', '.join(_AXES2TUPLE.keys()))) raise i = firstaxis j = _NEXT_AXIS[i + parity] k = _NEXT_AXIS[i - parity + 1] ...
[ "def", "_get_reordered_indices", "(", "rotation_order", ")", ":", "try", ":", "firstaxis", ",", "parity", "=", "_AXES2TUPLE", "[", "rotation_order", "]", "except", "KeyError", ":", "print", "(", "\"Rotation order must be one of {}.\"", ".", "format", "(", "', '", ...
Returns indices for converting 'xyz' rotation order to given rotation order.
[ "Returns", "indices", "for", "converting", "'", "xyz", "'", "rotation", "order", "to", "given", "rotation", "order", "." ]
[ "\"\"\"Returns indices for converting 'xyz' rotation order to given rotation order.\n \n :param rotation_order: Rotation order to convert to.\n :type rotation_order: str\n :return: Indices for getting from xyz to given axes rotation order.\n :rtype: tuple\n \"\"\"" ]
[ { "param": "rotation_order", "type": null } ]
{ "returns": [ { "docstring": "Indices for getting from xyz to given axes rotation order.", "docstring_tokens": [ "Indices", "for", "getting", "from", "xyz", "to", "given", "axes", "rotation", "order", "." ],...
a7fcbabc1c42dd272424b53515bec01828430f65
OlafHaag/bvh-tools
src/bvhtoolbox/manipulate/offsetjointangles.py
[ "MIT" ]
Python
add_angle_offsets
<not_specific>
def add_angle_offsets(bvh_tree, angle_offsets): """Add rotation to joints in bvh_tree. :param bvh_tree: BVH structure :type bvh_tree: bvhtree.BvhTree :param angle_offsets: A dictionary containing joint names as keys and euler angles in degrees as values. The order of the euler angles needs to be th...
Add rotation to joints in bvh_tree. :param bvh_tree: BVH structure :type bvh_tree: bvhtree.BvhTree :param angle_offsets: A dictionary containing joint names as keys and euler angles in degrees as values. The order of the euler angles needs to be the same as the channel order for this joint in the BVH f...
Add rotation to joints in bvh_tree.
[ "Add", "rotation", "to", "joints", "in", "bvh_tree", "." ]
def add_angle_offsets(bvh_tree, angle_offsets): if not angle_offsets: print("WARNING: No rotation offsets. Aborting.") return frames = get_motion_data(bvh_tree) for joint_name, angle_values in angle_offsets.items(): try: joint = bvh_tree.get_joint(joint_name) exce...
[ "def", "add_angle_offsets", "(", "bvh_tree", ",", "angle_offsets", ")", ":", "if", "not", "angle_offsets", ":", "print", "(", "\"WARNING: No rotation offsets. Aborting.\"", ")", "return", "frames", "=", "get_motion_data", "(", "bvh_tree", ")", "for", "joint_name", "...
Add rotation to joints in bvh_tree.
[ "Add", "rotation", "to", "joints", "in", "bvh_tree", "." ]
[ "\"\"\"Add rotation to joints in bvh_tree.\n\n :param bvh_tree: BVH structure\n :type bvh_tree: bvhtree.BvhTree\n :param angle_offsets: A dictionary containing joint names as keys and euler angles in degrees as values.\n The order of the euler angles needs to be the same as the channel order for this jo...
[ { "param": "bvh_tree", "type": null }, { "param": "angle_offsets", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bvh_tree", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null }, { "identifier": "angle_offsets", "type": null, "docstring"...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
reorder_axes
<not_specific>
def reorder_axes(xyz, axes='xyz'): """Takes an input array in xyz order and re-arranges it to given axes order. :param xyz: array with x,y,z order. :param axes: output order for Euler conversions respective to axes. :return: array in axes order. :rtype: numpy.ndarray """ firstaxis, pari...
Takes an input array in xyz order and re-arranges it to given axes order. :param xyz: array with x,y,z order. :param axes: output order for Euler conversions respective to axes. :return: array in axes order. :rtype: numpy.ndarray
Takes an input array in xyz order and re-arranges it to given axes order.
[ "Takes", "an", "input", "array", "in", "xyz", "order", "and", "re", "-", "arranges", "it", "to", "given", "axes", "order", "." ]
def reorder_axes(xyz, axes='xyz'): firstaxis, parity = _AXES2TUPLE[axes] i = firstaxis j = _NEXT_AXIS[i + parity] k = _NEXT_AXIS[i - parity + 1] return np.array([xyz[i], xyz[j], xyz[k]])
[ "def", "reorder_axes", "(", "xyz", ",", "axes", "=", "'xyz'", ")", ":", "firstaxis", ",", "parity", "=", "_AXES2TUPLE", "[", "axes", "]", "i", "=", "firstaxis", "j", "=", "_NEXT_AXIS", "[", "i", "+", "parity", "]", "k", "=", "_NEXT_AXIS", "[", "i", ...
Takes an input array in xyz order and re-arranges it to given axes order.
[ "Takes", "an", "input", "array", "in", "xyz", "order", "and", "re", "-", "arranges", "it", "to", "given", "axes", "order", "." ]
[ "\"\"\"Takes an input array in xyz order and re-arranges it to given axes order.\n \n :param xyz: array with x,y,z order.\n :param axes: output order for Euler conversions respective to axes.\n :return: array in axes order.\n :rtype: numpy.ndarray\n \"\"\"" ]
[ { "param": "xyz", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": "array in axes order.", "docstring_tokens": [ "array", "in", "axes", "order", "." ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "xyz", "type": null, "docstring"...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
string2quat
<not_specific>
def string2quat(xaf_str): """Takes quaternion string (xyzw) and converts it to quaternion array (wxyz). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :return: quaternion (wxyz) :rtype: numpy.ndarray """ quat = np.fromstring(xaf_str, sep=' ') quat = np.roll...
Takes quaternion string (xyzw) and converts it to quaternion array (wxyz). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :return: quaternion (wxyz) :rtype: numpy.ndarray
Takes quaternion string (xyzw) and converts it to quaternion array (wxyz).
[ "Takes", "quaternion", "string", "(", "xyzw", ")", "and", "converts", "it", "to", "quaternion", "array", "(", "wxyz", ")", "." ]
def string2quat(xaf_str): quat = np.fromstring(xaf_str, sep=' ') quat = np.roll(quat, shift=1) prune(quat) return quat
[ "def", "string2quat", "(", "xaf_str", ")", ":", "quat", "=", "np", ".", "fromstring", "(", "xaf_str", ",", "sep", "=", "' '", ")", "quat", "=", "np", ".", "roll", "(", "quat", ",", "shift", "=", "1", ")", "prune", "(", "quat", ")", "return", "qua...
Takes quaternion string (xyzw) and converts it to quaternion array (wxyz).
[ "Takes", "quaternion", "string", "(", "xyzw", ")", "and", "converts", "it", "to", "quaternion", "array", "(", "wxyz", ")", "." ]
[ "\"\"\"Takes quaternion string (xyzw) and converts it to quaternion array (wxyz).\n \n :param xaf_string: space delimited xyzw quaternion\n :type xaf_string: str\n :return: quaternion (wxyz)\n :rtype: numpy.ndarray\n \"\"\"" ]
[ { "param": "xaf_str", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "xaf_str", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_opti...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
quat2string
<not_specific>
def quat2string(quat): """Takes quaternion (wxyz) and outputs string in xyzw order. :param quat: quaternion in wxyz order. :type quat: numpy.ndarray :return: string representation :rtype: str """ quat = np.roll(quat, shift=-1) s = np.array_str(quat)[1:-1] return s
Takes quaternion (wxyz) and outputs string in xyzw order. :param quat: quaternion in wxyz order. :type quat: numpy.ndarray :return: string representation :rtype: str
Takes quaternion (wxyz) and outputs string in xyzw order.
[ "Takes", "quaternion", "(", "wxyz", ")", "and", "outputs", "string", "in", "xyzw", "order", "." ]
def quat2string(quat): quat = np.roll(quat, shift=-1) s = np.array_str(quat)[1:-1] return s
[ "def", "quat2string", "(", "quat", ")", ":", "quat", "=", "np", ".", "roll", "(", "quat", ",", "shift", "=", "-", "1", ")", "s", "=", "np", ".", "array_str", "(", "quat", ")", "[", "1", ":", "-", "1", "]", "return", "s" ]
Takes quaternion (wxyz) and outputs string in xyzw order.
[ "Takes", "quaternion", "(", "wxyz", ")", "and", "outputs", "string", "in", "xyzw", "order", "." ]
[ "\"\"\"Takes quaternion (wxyz) and outputs string in xyzw order.\n \n :param quat: quaternion in wxyz order.\n :type quat: numpy.ndarray\n :return: string representation\n :rtype: str\n \"\"\"" ]
[ { "param": "quat", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "str" } ], "raises": [], "params": [ { "identifier": "quat", "type": null, "docstring": "quaternion in wxyz order.", "docstring_tokens": [ "quaternion", ...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
string2mat
<not_specific>
def string2mat(xaf_string): """Returns rotation matrix for a string of quaternions (xyzw). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :return: rotation matrix (3x3) :rtype: numpy.ndarray """ quat = string2quat(xaf_string) rot_mat = t3d.quaternions.quat2...
Returns rotation matrix for a string of quaternions (xyzw). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :return: rotation matrix (3x3) :rtype: numpy.ndarray
Returns rotation matrix for a string of quaternions (xyzw).
[ "Returns", "rotation", "matrix", "for", "a", "string", "of", "quaternions", "(", "xyzw", ")", "." ]
def string2mat(xaf_string): quat = string2quat(xaf_string) rot_mat = t3d.quaternions.quat2mat(quat) return rot_mat
[ "def", "string2mat", "(", "xaf_string", ")", ":", "quat", "=", "string2quat", "(", "xaf_string", ")", "rot_mat", "=", "t3d", ".", "quaternions", ".", "quat2mat", "(", "quat", ")", "return", "rot_mat" ]
Returns rotation matrix for a string of quaternions (xyzw).
[ "Returns", "rotation", "matrix", "for", "a", "string", "of", "quaternions", "(", "xyzw", ")", "." ]
[ "\"\"\"Returns rotation matrix for a string of quaternions (xyzw).\n \n :param xaf_string: space delimited xyzw quaternion\n :type xaf_string: str\n :return: rotation matrix (3x3)\n :rtype: numpy.ndarray\n \"\"\"" ]
[ { "param": "xaf_string", "type": null } ]
{ "returns": [ { "docstring": "rotation matrix (3x3)", "docstring_tokens": [ "rotation", "matrix", "(", "3x3", ")" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "xaf_string", "type": null, "...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
mat2string
<not_specific>
def mat2string(rot_mat): """Converts a rotation matrix to string representation of a quaternion (xyzw). :param rot_mat: rotation matrix :type rot_mat: numpy.ndarray :return: quaternion string representation of rotation matrix :rtype: str """ quat = t3d.quaternions.mat2quat(rot_mat) ...
Converts a rotation matrix to string representation of a quaternion (xyzw). :param rot_mat: rotation matrix :type rot_mat: numpy.ndarray :return: quaternion string representation of rotation matrix :rtype: str
Converts a rotation matrix to string representation of a quaternion (xyzw).
[ "Converts", "a", "rotation", "matrix", "to", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "." ]
def mat2string(rot_mat): quat = t3d.quaternions.mat2quat(rot_mat) s = quat2string(quat) return s
[ "def", "mat2string", "(", "rot_mat", ")", ":", "quat", "=", "t3d", ".", "quaternions", ".", "mat2quat", "(", "rot_mat", ")", "s", "=", "quat2string", "(", "quat", ")", "return", "s" ]
Converts a rotation matrix to string representation of a quaternion (xyzw).
[ "Converts", "a", "rotation", "matrix", "to", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "." ]
[ "\"\"\"Converts a rotation matrix to string representation of a quaternion (xyzw).\n \n :param rot_mat: rotation matrix\n :type rot_mat: numpy.ndarray\n :return: quaternion string representation of rotation matrix\n :rtype: str\n \"\"\"" ]
[ { "param": "rot_mat", "type": null } ]
{ "returns": [ { "docstring": "quaternion string representation of rotation matrix", "docstring_tokens": [ "quaternion", "string", "representation", "of", "rotation", "matrix" ], "type": "str" } ], "raises": [], "params": [ { ...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
mat2affine
<not_specific>
def mat2affine(rot_mat, translation=None): """Converts a rotation matrix to string representation of a quaternion (xyzw). :param rot_mat: rotation matrix (3x3) :type rot_mat: numpy.ndarray :param translation: translation with x,y,z components :type translation: numpy.ndarray :return: affine...
Converts a rotation matrix to string representation of a quaternion (xyzw). :param rot_mat: rotation matrix (3x3) :type rot_mat: numpy.ndarray :param translation: translation with x,y,z components :type translation: numpy.ndarray :return: affine matrix with scaling 1. (4x4) :rtype: numpy.nd...
Converts a rotation matrix to string representation of a quaternion (xyzw).
[ "Converts", "a", "rotation", "matrix", "to", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "." ]
def mat2affine(rot_mat, translation=None): if not translation: translation = np.zeros(3) affine = t3d.affines.compose(translation, rot_mat, np.ones(3)) return affine
[ "def", "mat2affine", "(", "rot_mat", ",", "translation", "=", "None", ")", ":", "if", "not", "translation", ":", "translation", "=", "np", ".", "zeros", "(", "3", ")", "affine", "=", "t3d", ".", "affines", ".", "compose", "(", "translation", ",", "rot_...
Converts a rotation matrix to string representation of a quaternion (xyzw).
[ "Converts", "a", "rotation", "matrix", "to", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "." ]
[ "\"\"\"Converts a rotation matrix to string representation of a quaternion (xyzw).\n \n :param rot_mat: rotation matrix (3x3)\n :type rot_mat: numpy.ndarray\n :param translation: translation with x,y,z components\n :type translation: numpy.ndarray\n :return: affine matrix with scaling 1. (4x4)\n ...
[ { "param": "rot_mat", "type": null }, { "param": "translation", "type": null } ]
{ "returns": [ { "docstring": "affine matrix with scaling 1. (4x4)", "docstring_tokens": [ "affine", "matrix", "with", "scaling", "1", ".", "(", "4x4", ")" ], "type": "numpy.ndarray" } ], "raises": [], "param...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
mat2euler
<not_specific>
def mat2euler(rot_mat, axes='rzxz'): """Return rotation matrix as Euler angles in order of axes. """ return np.degrees(t3d.euler.mat2euler(rot_mat, axes=axes))
Return rotation matrix as Euler angles in order of axes.
Return rotation matrix as Euler angles in order of axes.
[ "Return", "rotation", "matrix", "as", "Euler", "angles", "in", "order", "of", "axes", "." ]
def mat2euler(rot_mat, axes='rzxz'): return np.degrees(t3d.euler.mat2euler(rot_mat, axes=axes))
[ "def", "mat2euler", "(", "rot_mat", ",", "axes", "=", "'rzxz'", ")", ":", "return", "np", ".", "degrees", "(", "t3d", ".", "euler", ".", "mat2euler", "(", "rot_mat", ",", "axes", "=", "axes", ")", ")" ]
Return rotation matrix as Euler angles in order of axes.
[ "Return", "rotation", "matrix", "as", "Euler", "angles", "in", "order", "of", "axes", "." ]
[ "\"\"\"Return rotation matrix as Euler angles in order of axes.\n \n \n \"\"\"" ]
[ { "param": "rot_mat", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rot_mat", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "axes", "type": null, "docstring": null, "docstring_tokens"...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
string2euler
<not_specific>
def string2euler(xaf_string, axes='rzxz'): """Convert XAF quaternion string to Euler angles. :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :param axes: The order in which to return the angles. Usually that's the joint's channel order. :type axes: str :return: Eule...
Convert XAF quaternion string to Euler angles. :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :param axes: The order in which to return the angles. Usually that's the joint's channel order. :type axes: str :return: Euler angles :rtype: numpy.ndarray
Convert XAF quaternion string to Euler angles.
[ "Convert", "XAF", "quaternion", "string", "to", "Euler", "angles", "." ]
def string2euler(xaf_string, axes='rzxz'): mat = string2mat(xaf_string) euler = mat2euler(mat, axes) return euler
[ "def", "string2euler", "(", "xaf_string", ",", "axes", "=", "'rzxz'", ")", ":", "mat", "=", "string2mat", "(", "xaf_string", ")", "euler", "=", "mat2euler", "(", "mat", ",", "axes", ")", "return", "euler" ]
Convert XAF quaternion string to Euler angles.
[ "Convert", "XAF", "quaternion", "string", "to", "Euler", "angles", "." ]
[ "\"\"\"Convert XAF quaternion string to Euler angles.\n \n :param xaf_string: space delimited xyzw quaternion\n :type xaf_string: str\n :param axes: The order in which to return the angles. Usually that's the joint's channel order.\n :type axes: str\n :return: Euler angles\n :rtype: numpy.ndarr...
[ { "param": "xaf_string", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "xaf_string", "type": null, "docstring": "space delimited xyzw quaternion", "docstring_tokens": [ ...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
string2affine
<not_specific>
def string2affine(xaf_string, translation_str=None): """Converts a string representation of a quaternion (xyzw) to an affine matrix (4x4). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :param translation_str: translation string with x y z components :type translation_...
Converts a string representation of a quaternion (xyzw) to an affine matrix (4x4). :param xaf_string: space delimited xyzw quaternion :type xaf_string: str :param translation_str: translation string with x y z components :type translation_str: str :return: affine matrix with scaling 1. (4x4) ...
Converts a string representation of a quaternion (xyzw) to an affine matrix (4x4).
[ "Converts", "a", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "to", "an", "affine", "matrix", "(", "4x4", ")", "." ]
def string2affine(xaf_string, translation_str=None): if not translation_str: t = np.zeros(0) else: t = np.fromstring(translation_str, sep=' ') rot_mat = string2mat(xaf_string) affine = mat2affine(rot_mat, t) return affine
[ "def", "string2affine", "(", "xaf_string", ",", "translation_str", "=", "None", ")", ":", "if", "not", "translation_str", ":", "t", "=", "np", ".", "zeros", "(", "0", ")", "else", ":", "t", "=", "np", ".", "fromstring", "(", "translation_str", ",", "se...
Converts a string representation of a quaternion (xyzw) to an affine matrix (4x4).
[ "Converts", "a", "string", "representation", "of", "a", "quaternion", "(", "xyzw", ")", "to", "an", "affine", "matrix", "(", "4x4", ")", "." ]
[ "\"\"\"Converts a string representation of a quaternion (xyzw) to an affine matrix (4x4).\n \n :param xaf_string: space delimited xyzw quaternion\n :type xaf_string: str\n :param translation_str: translation string with x y z components\n :type translation_str: str\n :return: affine matrix with sc...
[ { "param": "xaf_string", "type": null }, { "param": "translation_str", "type": null } ]
{ "returns": [ { "docstring": "affine matrix with scaling 1. (4x4)", "docstring_tokens": [ "affine", "matrix", "with", "scaling", "1", ".", "(", "4x4", ")" ], "type": "numpy.ndarray" } ], "raises": [], "param...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
channels2axes
<not_specific>
def channels2axes(bvh_tree, joint_name): """Get the channels/rotation axes order for a joint and return it as a string.""" channels = bvh_tree.joint_channels(joint_name) axes = ''.join([s[0] for s in channels if 'rotation' in s.lower()]).lower() return axes
Get the channels/rotation axes order for a joint and return it as a string.
Get the channels/rotation axes order for a joint and return it as a string.
[ "Get", "the", "channels", "/", "rotation", "axes", "order", "for", "a", "joint", "and", "return", "it", "as", "a", "string", "." ]
def channels2axes(bvh_tree, joint_name): channels = bvh_tree.joint_channels(joint_name) axes = ''.join([s[0] for s in channels if 'rotation' in s.lower()]).lower() return axes
[ "def", "channels2axes", "(", "bvh_tree", ",", "joint_name", ")", ":", "channels", "=", "bvh_tree", ".", "joint_channels", "(", "joint_name", ")", "axes", "=", "''", ".", "join", "(", "[", "s", "[", "0", "]", "for", "s", "in", "channels", "if", "'rotati...
Get the channels/rotation axes order for a joint and return it as a string.
[ "Get", "the", "channels", "/", "rotation", "axes", "order", "for", "a", "joint", "and", "return", "it", "as", "a", "string", "." ]
[ "\"\"\"Get the channels/rotation axes order for a joint and return it as a string.\"\"\"" ]
[ { "param": "bvh_tree", "type": null }, { "param": "joint_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bvh_tree", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "joint_name", "type": null, "docstring": null, "docstring_...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
euler_str2quat
<not_specific>
def euler_str2quat(euler_string, in_order='zxy', conversion_order='rzxz'): """Takes a space delinmited string of Euler angles and converts it to quaternion representation. :param euler_string: 3 space delimited values for angles :param in_order: Channel order in BVH file. The order of the values coming...
Takes a space delinmited string of Euler angles and converts it to quaternion representation. :param euler_string: 3 space delimited values for angles :param in_order: Channel order in BVH file. The order of the values coming in. :param conversion_order: The order that the angles are meant to represent...
Takes a space delinmited string of Euler angles and converts it to quaternion representation.
[ "Takes", "a", "space", "delinmited", "string", "of", "Euler", "angles", "and", "converts", "it", "to", "quaternion", "representation", "." ]
def euler_str2quat(euler_string, in_order='zxy', conversion_order='rzxz'): eulers_deg = np.fromstring(euler_string, sep=' ') eulers_xyz = np.array([eulers_deg[in_order.lower().index(i)] for i in 'xyz']) ordered_euler = reorder_axes(eulers_xyz, axes=conversion_order[1:]) eulers_rad = np.radians(ordered_e...
[ "def", "euler_str2quat", "(", "euler_string", ",", "in_order", "=", "'zxy'", ",", "conversion_order", "=", "'rzxz'", ")", ":", "eulers_deg", "=", "np", ".", "fromstring", "(", "euler_string", ",", "sep", "=", "' '", ")", "eulers_xyz", "=", "np", ".", "arra...
Takes a space delinmited string of Euler angles and converts it to quaternion representation.
[ "Takes", "a", "space", "delinmited", "string", "of", "Euler", "angles", "and", "converts", "it", "to", "quaternion", "representation", "." ]
[ "\"\"\"Takes a space delinmited string of Euler angles and converts it to quaternion representation.\n \n :param euler_string: 3 space delimited values for angles\n :param in_order: Channel order in BVH file. The order of the values coming in.\n :param conversion_order: The order that the angles are mea...
[ { "param": "euler_string", "type": null }, { "param": "in_order", "type": null }, { "param": "conversion_order", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "euler_string", "type": null, "docstring": "3 space delimited values for angles", "docstring_tokens": [ ...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
joint2quat
<not_specific>
def joint2quat(bvh_tree, joint_name, frame=0, axes='rzxz'): """Read the Euler angles of a joint in order given by axes and return it as quaternions. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :param frame: The ...
Read the Euler angles of a joint in order given by axes and return it as quaternions. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :param frame: The frame to return. :type frame: int :param axes: The order in...
Read the Euler angles of a joint in order given by axes and return it as quaternions.
[ "Read", "the", "Euler", "angles", "of", "a", "joint", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "quaternions", "." ]
def joint2quat(bvh_tree, joint_name, frame=0, axes='rzxz'): euler_ordered = np.radians(get_euler(bvh_tree, joint_name, frame, axes[1:])) quat = t3d.euler.euler2quat(*euler_ordered, axes=axes) return quat
[ "def", "joint2quat", "(", "bvh_tree", ",", "joint_name", ",", "frame", "=", "0", ",", "axes", "=", "'rzxz'", ")", ":", "euler_ordered", "=", "np", ".", "radians", "(", "get_euler", "(", "bvh_tree", ",", "joint_name", ",", "frame", ",", "axes", "[", "1"...
Read the Euler angles of a joint in order given by axes and return it as quaternions.
[ "Read", "the", "Euler", "angles", "of", "a", "joint", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "quaternions", "." ]
[ "\"\"\"Read the Euler angles of a joint in order given by axes and return it as quaternions.\n \n :param bvh_tree: BVH structure.\n :type bvh_tree: bvhtree.BvhTree\n :param joint_name: Name of the joint.\n :type joint_name: str\n :param frame: The frame to return.\n :type frame: int\n :param...
[ { "param": "bvh_tree", "type": null }, { "param": "joint_name", "type": null }, { "param": "frame", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "bvh_tree", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
joint2mat
<not_specific>
def joint2mat(bvh_tree, joint_name, frame=0, axes='rzxz'): """Read the Euler angles of a joint in order given by axes and return it as rotation matrix. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :param frame: The f...
Read the Euler angles of a joint in order given by axes and return it as rotation matrix. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :param frame: The frame to return. :type frame: int :param axes: The order in...
Read the Euler angles of a joint in order given by axes and return it as rotation matrix.
[ "Read", "the", "Euler", "angles", "of", "a", "joint", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "rotation", "matrix", "." ]
def joint2mat(bvh_tree, joint_name, frame=0, axes='rzxz'): euler_ordered = np.radians(get_euler(bvh_tree, joint_name, frame, axes[1:])) mat = t3d.euler.euler2mat(*euler_ordered, axes=axes) return mat
[ "def", "joint2mat", "(", "bvh_tree", ",", "joint_name", ",", "frame", "=", "0", ",", "axes", "=", "'rzxz'", ")", ":", "euler_ordered", "=", "np", ".", "radians", "(", "get_euler", "(", "bvh_tree", ",", "joint_name", ",", "frame", ",", "axes", "[", "1",...
Read the Euler angles of a joint in order given by axes and return it as rotation matrix.
[ "Read", "the", "Euler", "angles", "of", "a", "joint", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "rotation", "matrix", "." ]
[ "\"\"\"Read the Euler angles of a joint in order given by axes and return it as rotation matrix.\n\n :param bvh_tree: BVH structure.\n :type bvh_tree: bvhtree.BvhTree\n :param joint_name: Name of the joint.\n :type joint_name: str\n :param frame: The frame to return.\n :type frame: int\n :param...
[ { "param": "bvh_tree", "type": null }, { "param": "joint_name", "type": null }, { "param": "frame", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": "rotation matrix (3x3)", "docstring_tokens": [ "rotation", "matrix", "(", "3x3", ")" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "bvh_tree", "type": null, "do...
6b4352419c77addf960a34cfe35734d90b1bdabe
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xaf_helpers.py
[ "MIT" ]
Python
joint2affine
<not_specific>
def joint2affine(bvh_tree, joint_name, frame=0, axes='rzxz'): """Read the tranforms of a joint with rotation in order given by axes and return it as an affine matrix. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :par...
Read the tranforms of a joint with rotation in order given by axes and return it as an affine matrix. :param bvh_tree: BVH structure. :type bvh_tree: bvhtree.BvhTree :param joint_name: Name of the joint. :type joint_name: str :param frame: The frame to return. :type frame: int :param axes: ...
Read the tranforms of a joint with rotation in order given by axes and return it as an affine matrix.
[ "Read", "the", "tranforms", "of", "a", "joint", "with", "rotation", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "an", "affine", "matrix", "." ]
def joint2affine(bvh_tree, joint_name, frame=0, axes='rzxz'): translation = np.array(bvh_tree.frame_joint_channels(frame, joint_name, ['Xposition', 'Yposition', 'Zposition'], value=0.0)) euler_ordered = np.radians(get_euler(bvh_tree, joint_name, frame, ...
[ "def", "joint2affine", "(", "bvh_tree", ",", "joint_name", ",", "frame", "=", "0", ",", "axes", "=", "'rzxz'", ")", ":", "translation", "=", "np", ".", "array", "(", "bvh_tree", ".", "frame_joint_channels", "(", "frame", ",", "joint_name", ",", "[", "'Xp...
Read the tranforms of a joint with rotation in order given by axes and return it as an affine matrix.
[ "Read", "the", "tranforms", "of", "a", "joint", "with", "rotation", "in", "order", "given", "by", "axes", "and", "return", "it", "as", "an", "affine", "matrix", "." ]
[ "\"\"\"Read the tranforms of a joint with rotation in order given by axes and return it as an affine matrix.\n\n :param bvh_tree: BVH structure.\n :type bvh_tree: bvhtree.BvhTree\n :param joint_name: Name of the joint.\n :type joint_name: str\n :param frame: The frame to return.\n :type frame: int...
[ { "param": "bvh_tree", "type": null }, { "param": "joint_name", "type": null }, { "param": "frame", "type": null }, { "param": "axes", "type": null } ]
{ "returns": [ { "docstring": "affine matrix (4x4)", "docstring_tokens": [ "affine", "matrix", "(", "4x4", ")" ], "type": "numpy.ndarray" } ], "raises": [], "params": [ { "identifier": "bvh_tree", "type": null, "docstr...
7d555171e7b8809dcbda55998809effe3a182360
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2xsf.py
[ "MIT" ]
Python
bvh2xsf
<not_specific>
def bvh2xsf(bvh_filepath, dst_filepath=None, scale=1.0): """Converts a BVH file into the Cal3D XSF skeleton file format. :param bvh_filepath: File path for BVH source. :type bvh_filepath: str :param dst_filepath: File path for destination Cal3D skeleton file (XSF). :type dst_filepath: str :para...
Converts a BVH file into the Cal3D XSF skeleton file format. :param bvh_filepath: File path for BVH source. :type bvh_filepath: str :param dst_filepath: File path for destination Cal3D skeleton file (XSF). :type dst_filepath: str :param scale: Scale factor for root translation and offset values. ...
Converts a BVH file into the Cal3D XSF skeleton file format.
[ "Converts", "a", "BVH", "file", "into", "the", "Cal3D", "XSF", "skeleton", "file", "format", "." ]
def bvh2xsf(bvh_filepath, dst_filepath=None, scale=1.0): try: with open(bvh_filepath) as file_handle: mocap = BvhTree(file_handle.read()) except OSError as e: print("ERROR:", e) return False joints = mocap.get_joints_names(end_sites=True) xml_root = XmlTree.Element("S...
[ "def", "bvh2xsf", "(", "bvh_filepath", ",", "dst_filepath", "=", "None", ",", "scale", "=", "1.0", ")", ":", "try", ":", "with", "open", "(", "bvh_filepath", ")", "as", "file_handle", ":", "mocap", "=", "BvhTree", "(", "file_handle", ".", "read", "(", ...
Converts a BVH file into the Cal3D XSF skeleton file format.
[ "Converts", "a", "BVH", "file", "into", "the", "Cal3D", "XSF", "skeleton", "file", "format", "." ]
[ "\"\"\"Converts a BVH file into the Cal3D XSF skeleton file format.\n\n :param bvh_filepath: File path for BVH source.\n :type bvh_filepath: str\n :param dst_filepath: File path for destination Cal3D skeleton file (XSF).\n :type dst_filepath: str\n :param scale: Scale factor for root translation and ...
[ { "param": "bvh_filepath", "type": null }, { "param": "dst_filepath", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bvh_filepath", "type": null, "docstring": "File path for BVH source.", "docstring_tokens": [ "File", "path", "for", "BVH", "source", "." ], "default": null, "is...
4bc508dd939864b09c2e90e26a509742066a3dc4
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2csv.py
[ "MIT" ]
Python
write_joint_rotations
<not_specific>
def write_joint_rotations(bvh_tree, filepath): """Write joints' rotation data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :return: If the write process was successful or not. :...
Write joints' rotation data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :return: If the write process was successful or not. :rtype: bool
Write joints' rotation data to a CSV file.
[ "Write", "joints", "'", "rotation", "data", "to", "a", "CSV", "file", "." ]
def write_joint_rotations(bvh_tree, filepath): time_col = np.arange(0, bvh_tree.nframes*bvh_tree.frame_time, bvh_tree.frame_time)[:, None] data_list = [time_col] header = ['time'] for joint in bvh_tree.get_joints(): channels = [channel for channel in bvh_tree.joint_channels(joint.name) if channe...
[ "def", "write_joint_rotations", "(", "bvh_tree", ",", "filepath", ")", ":", "time_col", "=", "np", ".", "arange", "(", "0", ",", "bvh_tree", ".", "nframes", "*", "bvh_tree", ".", "frame_time", ",", "bvh_tree", ".", "frame_time", ")", "[", ":", ",", "None...
Write joints' rotation data to a CSV file.
[ "Write", "joints", "'", "rotation", "data", "to", "a", "CSV", "file", "." ]
[ "\"\"\"Write joints' rotation data to a CSV file.\n\n :param bvh_tree: BVH tree that holds the data.\n :type bvh_tree: BvhTree\n :param filepath: Destination file path for CSV file.\n :type filepath: str\n :return: If the write process was successful or not.\n :rtype: bool\n \"\"\"" ]
[ { "param": "bvh_tree", "type": null }, { "param": "filepath", "type": null } ]
{ "returns": [ { "docstring": "If the write process was successful or not.", "docstring_tokens": [ "If", "the", "write", "process", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "...
4bc508dd939864b09c2e90e26a509742066a3dc4
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2csv.py
[ "MIT" ]
Python
write_joint_positions
<not_specific>
def write_joint_positions(bvh_tree, filepath, scale=1.0, end_sites=False): """Write joints' world positional data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :param scale: Scal...
Write joints' world positional data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :param scale: Scale factor for root position and offset values. :type scale: float :param en...
Write joints' world positional data to a CSV file.
[ "Write", "joints", "'", "world", "positional", "data", "to", "a", "CSV", "file", "." ]
def write_joint_positions(bvh_tree, filepath, scale=1.0, end_sites=False): time_col = np.arange(0, bvh_tree.nframes * bvh_tree.frame_time, bvh_tree.frame_time)[:, None] data_list = [time_col] header = ['time'] root = next(bvh_tree.root.filter('ROOT')) def get_world_positions(joint): if joint...
[ "def", "write_joint_positions", "(", "bvh_tree", ",", "filepath", ",", "scale", "=", "1.0", ",", "end_sites", "=", "False", ")", ":", "time_col", "=", "np", ".", "arange", "(", "0", ",", "bvh_tree", ".", "nframes", "*", "bvh_tree", ".", "frame_time", ","...
Write joints' world positional data to a CSV file.
[ "Write", "joints", "'", "world", "positional", "data", "to", "a", "CSV", "file", "." ]
[ "\"\"\"Write joints' world positional data to a CSV file.\n \n :param bvh_tree: BVH tree that holds the data.\n :type bvh_tree: BvhTree\n :param filepath: Destination file path for CSV file.\n :type filepath: str\n :param scale: Scale factor for root position and offset values.\n :type scale: f...
[ { "param": "bvh_tree", "type": null }, { "param": "filepath", "type": null }, { "param": "scale", "type": null }, { "param": "end_sites", "type": null } ]
{ "returns": [ { "docstring": "If the write process was successful or not.", "docstring_tokens": [ "If", "the", "write", "process", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "...
4bc508dd939864b09c2e90e26a509742066a3dc4
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2csv.py
[ "MIT" ]
Python
write_joint_hierarchy
<not_specific>
def write_joint_hierarchy(bvh_tree, filepath, scale=1.0): """Write joints' world positional data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :param scale: Scale factor for offset v...
Write joints' world positional data to a CSV file. :param bvh_tree: BVH tree that holds the data. :type bvh_tree: BvhTree :param filepath: Destination file path for CSV file. :type filepath: str :param scale: Scale factor for offset values. :type scale: float :return: If the write process w...
Write joints' world positional data to a CSV file.
[ "Write", "joints", "'", "world", "positional", "data", "to", "a", "CSV", "file", "." ]
def write_joint_hierarchy(bvh_tree, filepath, scale=1.0): data = list() for joint in bvh_tree.get_joints(end_sites=True): joint_name = joint.name parent_name = bvh_tree.joint_parent(joint_name).name if bvh_tree.joint_parent(joint_name) else '' row = [joint_name, parent_name] row....
[ "def", "write_joint_hierarchy", "(", "bvh_tree", ",", "filepath", ",", "scale", "=", "1.0", ")", ":", "data", "=", "list", "(", ")", "for", "joint", "in", "bvh_tree", ".", "get_joints", "(", "end_sites", "=", "True", ")", ":", "joint_name", "=", "joint",...
Write joints' world positional data to a CSV file.
[ "Write", "joints", "'", "world", "positional", "data", "to", "a", "CSV", "file", "." ]
[ "\"\"\"Write joints' world positional data to a CSV file.\n\n :param bvh_tree: BVH tree that holds the data.\n :type bvh_tree: BvhTree\n :param filepath: Destination file path for CSV file.\n :type filepath: str\n :param scale: Scale factor for offset values.\n :type scale: float\n :return: If ...
[ { "param": "bvh_tree", "type": null }, { "param": "filepath", "type": null }, { "param": "scale", "type": null } ]
{ "returns": [ { "docstring": "If the write process was successful or not.", "docstring_tokens": [ "If", "the", "write", "process", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "...
4bc508dd939864b09c2e90e26a509742066a3dc4
OlafHaag/bvh-tools
src/bvhtoolbox/convert/bvh2csv.py
[ "MIT" ]
Python
bvh2csv
<not_specific>
def bvh2csv(bvh_path, dst_dirpath=None, scale=1.0, export_rotation=True, export_position=True, export_hierarchy=True, end_sites=True): """Converts a BVH file into CSV file format. When passing keyword arguments, keywords must be used! ...
Converts a BVH file into CSV file format. When passing keyword arguments, keywords must be used! :param bvh_path: File path(s) for BVH source. :type bvh_path: str|list :param dst_dirpath: Folder path for destination CSV files. :type dst_dirpath: str :param scale: Scale factor for root position ...
Converts a BVH file into CSV file format. When passing keyword arguments, keywords must be used!
[ "Converts", "a", "BVH", "file", "into", "CSV", "file", "format", ".", "When", "passing", "keyword", "arguments", "keywords", "must", "be", "used!" ]
def bvh2csv(bvh_path, dst_dirpath=None, scale=1.0, export_rotation=True, export_position=True, export_hierarchy=True, end_sites=True): try: with open(bvh_path) as file_handle: mocap = BvhTree(file_handle.read()) except I...
[ "def", "bvh2csv", "(", "bvh_path", ",", "dst_dirpath", "=", "None", ",", "scale", "=", "1.0", ",", "export_rotation", "=", "True", ",", "export_position", "=", "True", ",", "export_hierarchy", "=", "True", ",", "end_sites", "=", "True", ")", ":", "try", ...
Converts a BVH file into CSV file format.
[ "Converts", "a", "BVH", "file", "into", "CSV", "file", "format", "." ]
[ "\"\"\"Converts a BVH file into CSV file format.\n When passing keyword arguments, keywords must be used!\n\n :param bvh_path: File path(s) for BVH source.\n :type bvh_path: str|list\n :param dst_dirpath: Folder path for destination CSV files.\n :type dst_dirpath: str\n :param scale: Scale factor ...
[ { "param": "bvh_path", "type": null }, { "param": "dst_dirpath", "type": null }, { "param": "scale", "type": null }, { "param": "export_rotation", "type": null }, { "param": "export_position", "type": null }, { "param": "export_hierarchy", "type": ...
{ "returns": [ { "docstring": "If the conversion was successful or not.", "docstring_tokens": [ "If", "the", "conversion", "was", "successful", "or", "not", "." ], "type": "bool" } ], "raises": [], "params": [ { ...
5f1391aefdd8ccbf25c0363776dbae782619174d
OlafHaag/bvh-tools
src/bvhtoolbox/bvhtree.py
[ "MIT" ]
Python
joint_children
<not_specific>
def joint_children(self, name): """Return direct child joints or End Site.""" joint = self.get_joint(name) children = list() for child in joint.filter('JOINT'): children.append(child) for child in joint.filter('End'): # There's maximum 1 End Site as child. ...
Return direct child joints or End Site.
Return direct child joints or End Site.
[ "Return", "direct", "child", "joints", "or", "End", "Site", "." ]
def joint_children(self, name): joint = self.get_joint(name) children = list() for child in joint.filter('JOINT'): children.append(child) for child in joint.filter('End'): children.append(child) return children
[ "def", "joint_children", "(", "self", ",", "name", ")", ":", "joint", "=", "self", ".", "get_joint", "(", "name", ")", "children", "=", "list", "(", ")", "for", "child", "in", "joint", ".", "filter", "(", "'JOINT'", ")", ":", "children", ".", "append...
Return direct child joints or End Site.
[ "Return", "direct", "child", "joints", "or", "End", "Site", "." ]
[ "\"\"\"Return direct child joints or End Site.\"\"\"", "# There's maximum 1 End Site as child." ]
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
5f1391aefdd8ccbf25c0363776dbae782619174d
OlafHaag/bvh-tools
src/bvhtoolbox/bvhtree.py
[ "MIT" ]
Python
_close_scopes
<not_specific>
def _close_scopes(self, hierarchy_string, target_depth=0): """ The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param hierarchy_string: ...
The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy. :param hierarchy_string: :type hierarchy_string: str :param target_depth: The d...
The string is hierarchically ordered. This function appends curly brackets to close open scopes. It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.
[ "The", "string", "is", "hierarchically", "ordered", ".", "This", "function", "appends", "curly", "brackets", "to", "close", "open", "scopes", ".", "It", "takes", "the", "indentation", "of", "the", "last", "closed", "bracket", "as", "reference", "for", "the", ...
def _close_scopes(self, hierarchy_string, target_depth=0): last_depth = hierarchy_string[hierarchy_string[:-1].rfind("\n"):].count(" ") diff = last_depth - target_depth for depth in range(diff): hierarchy_string += '{0}}}\n'.format(' ' * (last_depth - depth - 1)) return hie...
[ "def", "_close_scopes", "(", "self", ",", "hierarchy_string", ",", "target_depth", "=", "0", ")", ":", "last_depth", "=", "hierarchy_string", "[", "hierarchy_string", "[", ":", "-", "1", "]", ".", "rfind", "(", "\"\\n\"", ")", ":", "]", ".", "count", "("...
The string is hierarchically ordered.
[ "The", "string", "is", "hierarchically", "ordered", "." ]
[ "\"\"\" The string is hierarchically ordered. This function appends curly brackets to close open scopes.\n It takes the indentation of the last closed bracket as reference for the current level/depth of the hierarchy.\n :param hierarchy_string:\n :type hierarchy_string: str\n :param targ...
[ { "param": "self", "type": null }, { "param": "hierarchy_string", "type": null }, { "param": "target_depth", "type": null } ]
{ "returns": [ { "docstring": "string with closed scopes.", "docstring_tokens": [ "string", "with", "closed", "scopes", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstri...
a69c095ba7635a2f2e0802ab120fddf4c9f9419c
OlafHaag/bvh-tools
src/bvhtoolbox/manipulate/renamejoints.py
[ "MIT" ]
Python
rename_joints
<not_specific>
def rename_joints(source_path, names_map, destination_path=None): """Rename joints in a BVH file using a dictionary and save the file. :param source_path: file path to bvh file. :type source_path: str :param names_map: Dictionary with old_name: new_name pairs. :type names_map: dict :param d...
Rename joints in a BVH file using a dictionary and save the file. :param source_path: file path to bvh file. :type source_path: str :param names_map: Dictionary with old_name: new_name pairs. :type names_map: dict :param destination_path: Destination file path. If None BVH file is overwritten. ...
Rename joints in a BVH file using a dictionary and save the file.
[ "Rename", "joints", "in", "a", "BVH", "file", "using", "a", "dictionary", "and", "save", "the", "file", "." ]
def rename_joints(source_path, names_map, destination_path=None): file_type = os.path.splitext(source_path)[1].lower() if file_type != ".bvh": print("ERROR: File extension BVH expected for: {}".format(source_path)) return False try: with open(source_path, mode='r') as file_handle: ...
[ "def", "rename_joints", "(", "source_path", ",", "names_map", ",", "destination_path", "=", "None", ")", ":", "file_type", "=", "os", ".", "path", ".", "splitext", "(", "source_path", ")", "[", "1", "]", ".", "lower", "(", ")", "if", "file_type", "!=", ...
Rename joints in a BVH file using a dictionary and save the file.
[ "Rename", "joints", "in", "a", "BVH", "file", "using", "a", "dictionary", "and", "save", "the", "file", "." ]
[ "\"\"\"Rename joints in a BVH file using a dictionary and save the file.\n \n :param source_path: file path to bvh file.\n :type source_path: str\n :param names_map: Dictionary with old_name: new_name pairs.\n :type names_map: dict\n :param destination_path: Destination file path. If None BVH file...
[ { "param": "source_path", "type": null }, { "param": "names_map", "type": null }, { "param": "destination_path", "type": null } ]
{ "returns": [ { "docstring": "Whether writing the changed file was successful or not.", "docstring_tokens": [ "Whether", "writing", "the", "changed", "file", "was", "successful", "or", "not", "." ], "type": "b...
7ff0c2a3ffd2dca2fa519af1b1a1169612090f60
jscheytt/endo-loc
label_import/timestamp.py
[ "Apache-2.0" ]
Python
from_str
<not_specific>
def from_str(cls, timestamp_str): """ Construct Timestamp from timestamp str. :param timestamp_str: :return: """ units = timestamp_str.split(":") seconds_ms = units[-1].split(".") hours = int(units[0]) minutes = int(units[1]) seconds = int(...
Construct Timestamp from timestamp str. :param timestamp_str: :return:
Construct Timestamp from timestamp str.
[ "Construct", "Timestamp", "from", "timestamp", "str", "." ]
def from_str(cls, timestamp_str): units = timestamp_str.split(":") seconds_ms = units[-1].split(".") hours = int(units[0]) minutes = int(units[1]) seconds = int(seconds_ms[0]) milliseconds = int(seconds_ms[1]) return cls(hours, minutes, seconds, milliseconds)
[ "def", "from_str", "(", "cls", ",", "timestamp_str", ")", ":", "units", "=", "timestamp_str", ".", "split", "(", "\":\"", ")", "seconds_ms", "=", "units", "[", "-", "1", "]", ".", "split", "(", "\".\"", ")", "hours", "=", "int", "(", "units", "[", ...
Construct Timestamp from timestamp str.
[ "Construct", "Timestamp", "from", "timestamp", "str", "." ]
[ "\"\"\"\n Construct Timestamp from timestamp str.\n :param timestamp_str:\n :return:\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "timestamp_str", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
7ff0c2a3ffd2dca2fa519af1b1a1169612090f60
jscheytt/endo-loc
label_import/timestamp.py
[ "Apache-2.0" ]
Python
from_frameidx_fps
<not_specific>
def from_frameidx_fps(cls, frameidx, fps): """ Construct Timestamp from frame index and fps :param frameidx: :param fps: Frames per second :return: """ import helper.helper as hlp milliseconds = (frameidx % fps) * 100 / fps total_seconds = frameidx...
Construct Timestamp from frame index and fps :param frameidx: :param fps: Frames per second :return:
Construct Timestamp from frame index and fps
[ "Construct", "Timestamp", "from", "frame", "index", "and", "fps" ]
def from_frameidx_fps(cls, frameidx, fps): import helper.helper as hlp milliseconds = (frameidx % fps) * 100 / fps total_seconds = frameidx // fps seconds = total_seconds % S_PER_MIN total_minutes = total_seconds // S_PER_MIN minutes = total_minutes % MIN_PER_H ho...
[ "def", "from_frameidx_fps", "(", "cls", ",", "frameidx", ",", "fps", ")", ":", "import", "helper", ".", "helper", "as", "hlp", "milliseconds", "=", "(", "frameidx", "%", "fps", ")", "*", "100", "/", "fps", "total_seconds", "=", "frameidx", "//", "fps", ...
Construct Timestamp from frame index and fps
[ "Construct", "Timestamp", "from", "frame", "index", "and", "fps" ]
[ "\"\"\"\n Construct Timestamp from frame index and fps\n :param frameidx:\n :param fps: Frames per second\n :return:\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "frameidx", "type": null }, { "param": "fps", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
7ff0c2a3ffd2dca2fa519af1b1a1169612090f60
jscheytt/endo-loc
label_import/timestamp.py
[ "Apache-2.0" ]
Python
to_str
<not_specific>
def to_str(self): """ Get str representation of Timestamp obj. :return: str representation of Timestamp obj """ return self.PATTERN % (self.hours, self.minutes, self.seconds, self.milliseconds)
Get str representation of Timestamp obj. :return: str representation of Timestamp obj
Get str representation of Timestamp obj.
[ "Get", "str", "representation", "of", "Timestamp", "obj", "." ]
def to_str(self): return self.PATTERN % (self.hours, self.minutes, self.seconds, self.milliseconds)
[ "def", "to_str", "(", "self", ")", ":", "return", "self", ".", "PATTERN", "%", "(", "self", ".", "hours", ",", "self", ".", "minutes", ",", "self", ".", "seconds", ",", "self", ".", "milliseconds", ")" ]
Get str representation of Timestamp obj.
[ "Get", "str", "representation", "of", "Timestamp", "obj", "." ]
[ "\"\"\"\n Get str representation of Timestamp obj.\n :return: str representation of Timestamp obj\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "str representation of Timestamp obj", "docstring_tokens": [ "str", "representation", "of", "Timestamp", "obj" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null...
9e6444cea0535ef9f11f52649584a34d400f17af
jscheytt/endo-loc
sample/sample.py
[ "Apache-2.0" ]
Python
plot_grid_search_results
<not_specific>
def plot_grid_search_results(grid, C_range, gamma_range): """ Plot heatmap resulting from Grid Search. Plotting taken from http://scikit-learn.org/stable/auto_examples/svm/plot_rbf_parameters.html :param grid: Grid Search obj :param C_range: :param gamma_range: :return: """ from m...
Plot heatmap resulting from Grid Search. Plotting taken from http://scikit-learn.org/stable/auto_examples/svm/plot_rbf_parameters.html :param grid: Grid Search obj :param C_range: :param gamma_range: :return:
Plot heatmap resulting from Grid Search.
[ "Plot", "heatmap", "resulting", "from", "Grid", "Search", "." ]
def plot_grid_search_results(grid, C_range, gamma_range): from matplotlib.colors import Normalize class MidpointNormalize(Normalize): def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): self.midpoint = midpoint Normalize.__init__(self, vmin, vmax, clip) d...
[ "def", "plot_grid_search_results", "(", "grid", ",", "C_range", ",", "gamma_range", ")", ":", "from", "matplotlib", ".", "colors", "import", "Normalize", "class", "MidpointNormalize", "(", "Normalize", ")", ":", "\"\"\"\n Utility function to move the midpoint of a ...
Plot heatmap resulting from Grid Search.
[ "Plot", "heatmap", "resulting", "from", "Grid", "Search", "." ]
[ "\"\"\"\n Plot heatmap resulting from Grid Search.\n Plotting taken from http://scikit-learn.org/stable/auto_examples/svm/plot_rbf_parameters.html\n :param grid: Grid Search obj\n :param C_range: \n :param gamma_range: \n :return: \n \"\"\"", "\"\"\"\n Utility function to move the midp...
[ { "param": "grid", "type": null }, { "param": "C_range", "type": null }, { "param": "gamma_range", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "grid", "type": null, "docstring": "Grid Search obj", "docstring_tokens": [ "Grid", "Search", ...
9e6444cea0535ef9f11f52649584a34d400f17af
jscheytt/endo-loc
sample/sample.py
[ "Apache-2.0" ]
Python
write_classifier
null
def write_classifier(clf, filepath): """ Write a classifier to the filepath. :param clf: classifier from sklearn :param filepath: :return: """ joblib.dump(clf, filepath)
Write a classifier to the filepath. :param clf: classifier from sklearn :param filepath: :return:
Write a classifier to the filepath.
[ "Write", "a", "classifier", "to", "the", "filepath", "." ]
def write_classifier(clf, filepath): joblib.dump(clf, filepath)
[ "def", "write_classifier", "(", "clf", ",", "filepath", ")", ":", "joblib", ".", "dump", "(", "clf", ",", "filepath", ")" ]
Write a classifier to the filepath.
[ "Write", "a", "classifier", "to", "the", "filepath", "." ]
[ "\"\"\"\n Write a classifier to the filepath.\n :param clf: classifier from sklearn\n :param filepath: \n :return: \n \"\"\"" ]
[ { "param": "clf", "type": null }, { "param": "filepath", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "clf", "type": null, "docstring": "classifier from sklearn", "docstring_tokens": [ "classifier", "fr...
9e6444cea0535ef9f11f52649584a34d400f17af
jscheytt/endo-loc
sample/sample.py
[ "Apache-2.0" ]
Python
predict_single_ft_vec
<not_specific>
def predict_single_ft_vec(clf, ft_vec): """ Predict the class label on a single feature vector. :param clf: classifier to be used for prediction :param ft_vec: feature vector without label :return: class label value """ value = clf.predict(ft_vec) return value
Predict the class label on a single feature vector. :param clf: classifier to be used for prediction :param ft_vec: feature vector without label :return: class label value
Predict the class label on a single feature vector.
[ "Predict", "the", "class", "label", "on", "a", "single", "feature", "vector", "." ]
def predict_single_ft_vec(clf, ft_vec): value = clf.predict(ft_vec) return value
[ "def", "predict_single_ft_vec", "(", "clf", ",", "ft_vec", ")", ":", "value", "=", "clf", ".", "predict", "(", "ft_vec", ")", "return", "value" ]
Predict the class label on a single feature vector.
[ "Predict", "the", "class", "label", "on", "a", "single", "feature", "vector", "." ]
[ "\"\"\"\n Predict the class label on a single feature vector.\n :param clf: classifier to be used for prediction\n :param ft_vec: feature vector without label\n :return: class label value\n \"\"\"" ]
[ { "param": "clf", "type": null }, { "param": "ft_vec", "type": null } ]
{ "returns": [ { "docstring": "class label value", "docstring_tokens": [ "class", "label", "value" ], "type": null } ], "raises": [], "params": [ { "identifier": "clf", "type": null, "docstring": "classifier to be used for prediction"...
9e6444cea0535ef9f11f52649584a34d400f17af
jscheytt/endo-loc
sample/sample.py
[ "Apache-2.0" ]
Python
calc_scores_on_both_classes
<not_specific>
def calc_scores_on_both_classes(y, y_pred, n_folds=10, metric=sk_mt.f1_score): """ Evaluate a score defined by metric for both classes on every partition. :param y: :param y_pred: predicted labels :param n_folds: number of folds. if <=1 then just calculate the score for each class on the whole sampl...
Evaluate a score defined by metric for both classes on every partition. :param y: :param y_pred: predicted labels :param n_folds: number of folds. if <=1 then just calculate the score for each class on the whole sample :param metric: metric to be assessed over the predictions :return: scores of...
Evaluate a score defined by metric for both classes on every partition.
[ "Evaluate", "a", "score", "defined", "by", "metric", "for", "both", "classes", "on", "every", "partition", "." ]
def calc_scores_on_both_classes(y, y_pred, n_folds=10, metric=sk_mt.f1_score): y_true = np.array(y) y_true_inv = 1 - y_true y_pred = np.array(y_pred) y_pred_inv = 1 - y_pred scorer = lambda folds: metric(folds[0], folds[1]) if n_folds > 1: folds_y_true = np.array_split(y_true, n_folds) ...
[ "def", "calc_scores_on_both_classes", "(", "y", ",", "y_pred", ",", "n_folds", "=", "10", ",", "metric", "=", "sk_mt", ".", "f1_score", ")", ":", "y_true", "=", "np", ".", "array", "(", "y", ")", "y_true_inv", "=", "1", "-", "y_true", "y_pred", "=", ...
Evaluate a score defined by metric for both classes on every partition.
[ "Evaluate", "a", "score", "defined", "by", "metric", "for", "both", "classes", "on", "every", "partition", "." ]
[ "\"\"\"\n Evaluate a score defined by metric for both classes on every partition.\n :param y:\n :param y_pred: predicted labels\n :param n_folds: number of folds. if <=1 then just calculate the score for each class on the whole sample\n :param metric: metric to be assessed over the predictions\n :...
[ { "param": "y", "type": null }, { "param": "y_pred", "type": null }, { "param": "n_folds", "type": null }, { "param": "metric", "type": null } ]
{ "returns": [ { "docstring": "scores of both classes, array of floats with shape (2, n_folds)", "docstring_tokens": [ "scores", "of", "both", "classes", "array", "of", "floats", "with", "shape", "(", "2", ...
9e6444cea0535ef9f11f52649584a34d400f17af
jscheytt/endo-loc
sample/sample.py
[ "Apache-2.0" ]
Python
crossval_predict_files_folds
<not_specific>
def crossval_predict_files_folds(clf, X_list, y_list, do_subsampling=True, metric=None): """ Perform cross validation on lists of data and targets. Use the files / list entries as folds. :param clf: classifier object :param X_list: list of data arrays :param y_list: list of target arrays :pa...
Perform cross validation on lists of data and targets. Use the files / list entries as folds. :param clf: classifier object :param X_list: list of data arrays :param y_list: list of target arrays :param do_subsampling: perform subsampling on selection (not on eval data) :return:
Perform cross validation on lists of data and targets. Use the files / list entries as folds.
[ "Perform", "cross", "validation", "on", "lists", "of", "data", "and", "targets", ".", "Use", "the", "files", "/", "list", "entries", "as", "folds", "." ]
def crossval_predict_files_folds(clf, X_list, y_list, do_subsampling=True, metric=None): y_pred = [] scores_class0 = [] scores_class1 = [] for idx, X_eval in hlp.reverse_enum(X_list): X_sel = X_list[:idx] + X_list[idx + 1:] y_sel = y_list[:idx] + y_list[idx + 1:] X_sel_comb = np....
[ "def", "crossval_predict_files_folds", "(", "clf", ",", "X_list", ",", "y_list", ",", "do_subsampling", "=", "True", ",", "metric", "=", "None", ")", ":", "y_pred", "=", "[", "]", "scores_class0", "=", "[", "]", "scores_class1", "=", "[", "]", "for", "id...
Perform cross validation on lists of data and targets.
[ "Perform", "cross", "validation", "on", "lists", "of", "data", "and", "targets", "." ]
[ "\"\"\"\n Perform cross validation on lists of data and targets.\n Use the files / list entries as folds.\n :param clf: classifier object\n :param X_list: list of data arrays\n :param y_list: list of target arrays\n :param do_subsampling: perform subsampling on selection (not on eval data)\n :r...
[ { "param": "clf", "type": null }, { "param": "X_list", "type": null }, { "param": "y_list", "type": null }, { "param": "do_subsampling", "type": null }, { "param": "metric", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "clf", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "...
20eee2ca24f9a691ca4cac44c02ea2defc0e5f75
jscheytt/endo-loc
feature_extraction/ft_extractor.py
[ "Apache-2.0" ]
Python
write_video_to_xml
null
def write_video_to_xml(video_xml, target_filename): """ Write Video XML element to an XML file. :param video_xml: Video XML element :param target_filename: Path to target XML file :return: """ tree = etree.ElementTree(video_xml) tree.write(target_filename, encoding=CHARSET, pretty_print=...
Write Video XML element to an XML file. :param video_xml: Video XML element :param target_filename: Path to target XML file :return:
Write Video XML element to an XML file.
[ "Write", "Video", "XML", "element", "to", "an", "XML", "file", "." ]
def write_video_to_xml(video_xml, target_filename): tree = etree.ElementTree(video_xml) tree.write(target_filename, encoding=CHARSET, pretty_print=True)
[ "def", "write_video_to_xml", "(", "video_xml", ",", "target_filename", ")", ":", "tree", "=", "etree", ".", "ElementTree", "(", "video_xml", ")", "tree", ".", "write", "(", "target_filename", ",", "encoding", "=", "CHARSET", ",", "pretty_print", "=", "True", ...
Write Video XML element to an XML file.
[ "Write", "Video", "XML", "element", "to", "an", "XML", "file", "." ]
[ "\"\"\"\n Write Video XML element to an XML file.\n :param video_xml: Video XML element\n :param target_filename: Path to target XML file\n :return:\n \"\"\"" ]
[ { "param": "video_xml", "type": null }, { "param": "target_filename", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "video_xml", "type": null, "docstring": "Video XML element", "docstring_tokens": [ "Video", "XML", ...
a04eb28d0870be12d56ed85a5e43f0f9aaee3fdf
jscheytt/endo-loc
prep/preprocessor.py
[ "Apache-2.0" ]
Python
classes_balanced
<not_specific>
def classes_balanced(c1, c2): """ Check if the ratio of class sizes is within the accepted range for balance. :param c1: :param c2: :return: """ return 0.5 <= len(c1) / len(c2) <= 2
Check if the ratio of class sizes is within the accepted range for balance. :param c1: :param c2: :return:
Check if the ratio of class sizes is within the accepted range for balance.
[ "Check", "if", "the", "ratio", "of", "class", "sizes", "is", "within", "the", "accepted", "range", "for", "balance", "." ]
def classes_balanced(c1, c2): return 0.5 <= len(c1) / len(c2) <= 2
[ "def", "classes_balanced", "(", "c1", ",", "c2", ")", ":", "return", "0.5", "<=", "len", "(", "c1", ")", "/", "len", "(", "c2", ")", "<=", "2" ]
Check if the ratio of class sizes is within the accepted range for balance.
[ "Check", "if", "the", "ratio", "of", "class", "sizes", "is", "within", "the", "accepted", "range", "for", "balance", "." ]
[ "\"\"\"\n Check if the ratio of class sizes is within the accepted range for balance.\n :param c1: \n :param c2: \n :return: \n \"\"\"" ]
[ { "param": "c1", "type": null }, { "param": "c2", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "c1", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "i...
a04eb28d0870be12d56ed85a5e43f0f9aaee3fdf
jscheytt/endo-loc
prep/preprocessor.py
[ "Apache-2.0" ]
Python
balance_class_sizes
null
def balance_class_sizes(X, y): """ Balance classes for binary classification. Perform in-place manipulation of array. :param X: list of feature vectors :param y: class labels (0 and 1) """ with LogCont("Subsample majority class"): indices_of_classes = get_indices_of_classes(X, y) ...
Balance classes for binary classification. Perform in-place manipulation of array. :param X: list of feature vectors :param y: class labels (0 and 1)
Balance classes for binary classification. Perform in-place manipulation of array.
[ "Balance", "classes", "for", "binary", "classification", ".", "Perform", "in", "-", "place", "manipulation", "of", "array", "." ]
def balance_class_sizes(X, y): with LogCont("Subsample majority class"): indices_of_classes = get_indices_of_classes(X, y) cl0 = indices_of_classes[0] if len(indices_of_classes) > 1: cl1 = indices_of_classes[1] else: cl1 = [] if len(cl0) > len(cl1): ...
[ "def", "balance_class_sizes", "(", "X", ",", "y", ")", ":", "with", "LogCont", "(", "\"Subsample majority class\"", ")", ":", "indices_of_classes", "=", "get_indices_of_classes", "(", "X", ",", "y", ")", "cl0", "=", "indices_of_classes", "[", "0", "]", "if", ...
Balance classes for binary classification.
[ "Balance", "classes", "for", "binary", "classification", "." ]
[ "\"\"\"\n Balance classes for binary classification. Perform in-place manipulation of array.\n :param X: list of feature vectors\n :param y: class labels (0 and 1)\n \"\"\"" ]
[ { "param": "X", "type": null }, { "param": "y", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "X", "type": null, "docstring": "list of feature vectors", "docstring_tokens": [ "list", "of", "feature", "vectors" ], "default": null, "is_optional": null }, { "i...
a05d69796af433efd0fe16c3508b7216834f4240
jscheytt/endo-loc
debug/debug.py
[ "Apache-2.0" ]
Python
display_image
null
def display_image(image): """Display image in a new window. Window closes after pressing any key.""" cv2.imshow(IMG_TITLE, image) cv2.waitKey(0) cv2.destroyAllWindows()
Display image in a new window. Window closes after pressing any key.
Display image in a new window. Window closes after pressing any key.
[ "Display", "image", "in", "a", "new", "window", ".", "Window", "closes", "after", "pressing", "any", "key", "." ]
def display_image(image): cv2.imshow(IMG_TITLE, image) cv2.waitKey(0) cv2.destroyAllWindows()
[ "def", "display_image", "(", "image", ")", ":", "cv2", ".", "imshow", "(", "IMG_TITLE", ",", "image", ")", "cv2", ".", "waitKey", "(", "0", ")", "cv2", ".", "destroyAllWindows", "(", ")" ]
Display image in a new window.
[ "Display", "image", "in", "a", "new", "window", "." ]
[ "\"\"\"Display image in a new window. Window closes after pressing any key.\"\"\"" ]
[ { "param": "image", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "image", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a05d69796af433efd0fe16c3508b7216834f4240
jscheytt/endo-loc
debug/debug.py
[ "Apache-2.0" ]
Python
plot_histograms
null
def plot_histograms(hists, update_interval=0.0): """ Plot histogram in new window in Red, Green and Blue. :param hists: List of 3 histogram channels :param update_interval: Time in seconds at which the window should be updated :return: """ color = ('r', 'g', 'b') for idx, col in enumerat...
Plot histogram in new window in Red, Green and Blue. :param hists: List of 3 histogram channels :param update_interval: Time in seconds at which the window should be updated :return:
Plot histogram in new window in Red, Green and Blue.
[ "Plot", "histogram", "in", "new", "window", "in", "Red", "Green", "and", "Blue", "." ]
def plot_histograms(hists, update_interval=0.0): color = ('r', 'g', 'b') for idx, col in enumerate(color): plt.plot(hists[idx], color=col) plt.xlim([0, 256]) plt.draw() plt.pause(update_interval)
[ "def", "plot_histograms", "(", "hists", ",", "update_interval", "=", "0.0", ")", ":", "color", "=", "(", "'r'", ",", "'g'", ",", "'b'", ")", "for", "idx", ",", "col", "in", "enumerate", "(", "color", ")", ":", "plt", ".", "plot", "(", "hists", "[",...
Plot histogram in new window in Red, Green and Blue.
[ "Plot", "histogram", "in", "new", "window", "in", "Red", "Green", "and", "Blue", "." ]
[ "\"\"\"\n Plot histogram in new window in Red, Green and Blue.\n :param hists: List of 3 histogram channels\n :param update_interval: Time in seconds at which the window should be updated\n :return:\n \"\"\"" ]
[ { "param": "hists", "type": null }, { "param": "update_interval", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "hists", "type": null, "docstring": "List of 3 histogram channels", "docstring_tokens": [ "List", "o...
a05d69796af433efd0fe16c3508b7216834f4240
jscheytt/endo-loc
debug/debug.py
[ "Apache-2.0" ]
Python
plot_histograms_live
null
def plot_histograms_live(filename): """ Plot histogram of a video frame by frame. Is not expected to work in real time. :param filename: Path to video file :return: """ import feature_extraction.ft_extractor as fx cap = cv2.VideoCapture(filename) while cap.isOpened(): _, frame =...
Plot histogram of a video frame by frame. Is not expected to work in real time. :param filename: Path to video file :return:
Plot histogram of a video frame by frame. Is not expected to work in real time.
[ "Plot", "histogram", "of", "a", "video", "frame", "by", "frame", ".", "Is", "not", "expected", "to", "work", "in", "real", "time", "." ]
def plot_histograms_live(filename): import feature_extraction.ft_extractor as fx cap = cv2.VideoCapture(filename) while cap.isOpened(): _, frame = cap.read() hists_frame = fx.get_histograms_hsv(frame) plt.clf() plt.cla() plot_histograms(hists_frame, 0.04) if c...
[ "def", "plot_histograms_live", "(", "filename", ")", ":", "import", "feature_extraction", ".", "ft_extractor", "as", "fx", "cap", "=", "cv2", ".", "VideoCapture", "(", "filename", ")", "while", "cap", ".", "isOpened", "(", ")", ":", "_", ",", "frame", "=",...
Plot histogram of a video frame by frame.
[ "Plot", "histogram", "of", "a", "video", "frame", "by", "frame", "." ]
[ "\"\"\"\n Plot histogram of a video frame by frame. Is not expected to work in real time.\n :param filename: Path to video file\n :return:\n \"\"\"", "# Clear current plot", "# Update at 25 fps speed if live" ]
[ { "param": "filename", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": "Path to video file", "docstring_tokens": [ "Path", "to", ...