repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
PredixDev/predixpy
predix/security/uaa.py
UserAccountAuthentication.get_user_by_username
def get_user_by_username(self, username): """ Returns details for user of the given username. If there is more than one match will only return the first. Use get_users() for full result set. """ results = self.get_users(filter='username eq "%s"' % (username)) if...
python
def get_user_by_username(self, username): """ Returns details for user of the given username. If there is more than one match will only return the first. Use get_users() for full result set. """ results = self.get_users(filter='username eq "%s"' % (username)) if...
[ "def", "get_user_by_username", "(", "self", ",", "username", ")", ":", "results", "=", "self", ".", "get_users", "(", "filter", "=", "'username eq \"%s\"'", "%", "(", "username", ")", ")", "if", "results", "[", "'totalResults'", "]", "==", "0", ":", "loggi...
Returns details for user of the given username. If there is more than one match will only return the first. Use get_users() for full result set.
[ "Returns", "details", "for", "user", "of", "the", "given", "username", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/security/uaa.py#L698-L713
PredixDev/predixpy
predix/security/uaa.py
UserAccountAuthentication.get_user_by_email
def get_user_by_email(self, email): """ Returns details for user with the given email address. If there is more than one match will only return the first. Use get_users() for full result set. """ results = self.get_users(filter='email eq "%s"' % (email)) if resu...
python
def get_user_by_email(self, email): """ Returns details for user with the given email address. If there is more than one match will only return the first. Use get_users() for full result set. """ results = self.get_users(filter='email eq "%s"' % (email)) if resu...
[ "def", "get_user_by_email", "(", "self", ",", "email", ")", ":", "results", "=", "self", ".", "get_users", "(", "filter", "=", "'email eq \"%s\"'", "%", "(", "email", ")", ")", "if", "results", "[", "'totalResults'", "]", "==", "0", ":", "logging", ".", ...
Returns details for user with the given email address. If there is more than one match will only return the first. Use get_users() for full result set.
[ "Returns", "details", "for", "user", "with", "the", "given", "email", "address", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/security/uaa.py#L715-L730
PredixDev/predixpy
predix/security/uaa.py
UserAccountAuthentication.get_user
def get_user(self, id): """ Returns details about the user for the given id. Use get_user_by_email() or get_user_by_username() for help identifiying the id. """ self.assert_has_permission('scim.read') return self._get(self.uri + '/Users/%s' % (id))
python
def get_user(self, id): """ Returns details about the user for the given id. Use get_user_by_email() or get_user_by_username() for help identifiying the id. """ self.assert_has_permission('scim.read') return self._get(self.uri + '/Users/%s' % (id))
[ "def", "get_user", "(", "self", ",", "id", ")", ":", "self", ".", "assert_has_permission", "(", "'scim.read'", ")", "return", "self", ".", "_get", "(", "self", ".", "uri", "+", "'/Users/%s'", "%", "(", "id", ")", ")" ]
Returns details about the user for the given id. Use get_user_by_email() or get_user_by_username() for help identifiying the id.
[ "Returns", "details", "about", "the", "user", "for", "the", "given", "id", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/security/uaa.py#L732-L740
PredixDev/predixpy
predix/admin/timeseries.py
TimeSeries.create
def create(self): """ Create an instance of the Time Series Service with the typical starting settings. """ self.service.create() predix.config.set_env_value(self.use_class, 'ingest_uri', self.get_ingest_uri()) predix.config.set_env_value(self.use...
python
def create(self): """ Create an instance of the Time Series Service with the typical starting settings. """ self.service.create() predix.config.set_env_value(self.use_class, 'ingest_uri', self.get_ingest_uri()) predix.config.set_env_value(self.use...
[ "def", "create", "(", "self", ")", ":", "self", ".", "service", ".", "create", "(", ")", "predix", ".", "config", ".", "set_env_value", "(", "self", ".", "use_class", ",", "'ingest_uri'", ",", "self", ".", "get_ingest_uri", "(", ")", ")", "predix", "."...
Create an instance of the Time Series Service with the typical starting settings.
[ "Create", "an", "instance", "of", "the", "Time", "Series", "Service", "with", "the", "typical", "starting", "settings", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/timeseries.py#L31-L46
PredixDev/predixpy
predix/admin/timeseries.py
TimeSeries.grant_client
def grant_client(self, client_id, read=True, write=True): """ Grant the given client id all the scopes and authorities needed to work with the timeseries service. """ scopes = ['openid'] authorities = ['uaa.resource'] if write: for zone in self.servic...
python
def grant_client(self, client_id, read=True, write=True): """ Grant the given client id all the scopes and authorities needed to work with the timeseries service. """ scopes = ['openid'] authorities = ['uaa.resource'] if write: for zone in self.servic...
[ "def", "grant_client", "(", "self", ",", "client_id", ",", "read", "=", "True", ",", "write", "=", "True", ")", ":", "scopes", "=", "[", "'openid'", "]", "authorities", "=", "[", "'uaa.resource'", "]", "if", "write", ":", "for", "zone", "in", "self", ...
Grant the given client id all the scopes and authorities needed to work with the timeseries service.
[ "Grant", "the", "given", "client", "id", "all", "the", "scopes", "and", "authorities", "needed", "to", "work", "with", "the", "timeseries", "service", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/timeseries.py#L48-L69
PredixDev/predixpy
predix/admin/timeseries.py
TimeSeries.get_query_uri
def get_query_uri(self): """ Return the uri used for queries on time series data. """ # Query URI has extra path we don't want so strip it off here query_uri = self.service.settings.data['query']['uri'] query_uri = urlparse(query_uri) return query_uri.scheme + ':/...
python
def get_query_uri(self): """ Return the uri used for queries on time series data. """ # Query URI has extra path we don't want so strip it off here query_uri = self.service.settings.data['query']['uri'] query_uri = urlparse(query_uri) return query_uri.scheme + ':/...
[ "def", "get_query_uri", "(", "self", ")", ":", "# Query URI has extra path we don't want so strip it off here", "query_uri", "=", "self", ".", "service", ".", "settings", ".", "data", "[", "'query'", "]", "[", "'uri'", "]", "query_uri", "=", "urlparse", "(", "quer...
Return the uri used for queries on time series data.
[ "Return", "the", "uri", "used", "for", "queries", "on", "time", "series", "data", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/timeseries.py#L91-L98
PredixDev/predixpy
predix/admin/timeseries.py
TimeSeries.add_to_manifest
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
python
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "# Add this service to list of services", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "# Add environment variables", "uri", "=", "predix", ".", "config", ".", "get...
Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry app.
[ "Add", "useful", "details", "to", "the", "manifest", "about", "this", "service", "so", "that", "it", "can", "be", "used", "in", "an", "application", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/timeseries.py#L100-L125
landscapeio/requirements-detector
requirements_detector/detect.py
find_requirements
def find_requirements(path): """ This method tries to determine the requirements of a particular project by inspecting the possible places that they could be defined. It will attempt, in order: 1) to parse setup.py in the root for an install_requires value 2) to read a requirements.txt file or...
python
def find_requirements(path): """ This method tries to determine the requirements of a particular project by inspecting the possible places that they could be defined. It will attempt, in order: 1) to parse setup.py in the root for an install_requires value 2) to read a requirements.txt file or...
[ "def", "find_requirements", "(", "path", ")", ":", "requirements", "=", "[", "]", "setup_py", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'setup.py'", ")", "if", "os", ".", "path", ".", "exists", "(", "setup_py", ")", "and", "os", ".", ...
This method tries to determine the requirements of a particular project by inspecting the possible places that they could be defined. It will attempt, in order: 1) to parse setup.py in the root for an install_requires value 2) to read a requirements.txt file or a requirements.pip in the root 3) to...
[ "This", "method", "tries", "to", "determine", "the", "requirements", "of", "a", "particular", "project", "by", "inspecting", "the", "possible", "places", "that", "they", "could", "be", "defined", "." ]
train
https://github.com/landscapeio/requirements-detector/blob/22cb3fdd6b7f7f6c2eaee40ef8db540ef453b840/requirements_detector/detect.py#L67-L118
PredixDev/predixpy
predix/admin/cf/apps.py
App.get_app_guid
def get_app_guid(self, app_name): """ Returns the GUID for the app instance with the given name. """ summary = self.space.get_space_summary() for app in summary['apps']: if app['name'] == app_name: return app['guid']
python
def get_app_guid(self, app_name): """ Returns the GUID for the app instance with the given name. """ summary = self.space.get_space_summary() for app in summary['apps']: if app['name'] == app_name: return app['guid']
[ "def", "get_app_guid", "(", "self", ",", "app_name", ")", ":", "summary", "=", "self", ".", "space", ".", "get_space_summary", "(", ")", "for", "app", "in", "summary", "[", "'apps'", "]", ":", "if", "app", "[", "'name'", "]", "==", "app_name", ":", "...
Returns the GUID for the app instance with the given name.
[ "Returns", "the", "GUID", "for", "the", "app", "instance", "with", "the", "given", "name", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/apps.py#L16-L24
PredixDev/predixpy
predix/admin/cf/apps.py
App.delete_app
def delete_app(self, app_name): """ Delete the given app. Will fail intentionally if there are any service bindings. You must delete those first. """ if app_name not in self.space.get_apps(): logging.warning("App not found so... succeeded?") retu...
python
def delete_app(self, app_name): """ Delete the given app. Will fail intentionally if there are any service bindings. You must delete those first. """ if app_name not in self.space.get_apps(): logging.warning("App not found so... succeeded?") retu...
[ "def", "delete_app", "(", "self", ",", "app_name", ")", ":", "if", "app_name", "not", "in", "self", ".", "space", ".", "get_apps", "(", ")", ":", "logging", ".", "warning", "(", "\"App not found so... succeeded?\"", ")", "return", "True", "guid", "=", "sel...
Delete the given app. Will fail intentionally if there are any service bindings. You must delete those first.
[ "Delete", "the", "given", "app", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/cf/apps.py#L26-L38
PredixDev/predixpy
predix/admin/config.py
ServiceConfig._get_service_config
def _get_service_config(self): """ Reads in config file of UAA credential information or generates one as a side-effect if not yet initialized. """ # Should work for windows, osx, and linux environments if not os.path.exists(self.config_path): try: ...
python
def _get_service_config(self): """ Reads in config file of UAA credential information or generates one as a side-effect if not yet initialized. """ # Should work for windows, osx, and linux environments if not os.path.exists(self.config_path): try: ...
[ "def", "_get_service_config", "(", "self", ")", ":", "# Should work for windows, osx, and linux environments", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "config_path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "os", ".", "path", ...
Reads in config file of UAA credential information or generates one as a side-effect if not yet initialized.
[ "Reads", "in", "config", "file", "of", "UAA", "credential", "information", "or", "generates", "one", "as", "a", "side", "-", "effect", "if", "not", "yet", "initialized", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/config.py#L23-L40
PredixDev/predixpy
predix/admin/config.py
ServiceConfig._write_service_config
def _write_service_config(self): """ Will write the config out to disk. """ with open(self.config_path, 'w') as output: output.write(json.dumps(self.data, sort_keys=True, indent=4))
python
def _write_service_config(self): """ Will write the config out to disk. """ with open(self.config_path, 'w') as output: output.write(json.dumps(self.data, sort_keys=True, indent=4))
[ "def", "_write_service_config", "(", "self", ")", ":", "with", "open", "(", "self", ".", "config_path", ",", "'w'", ")", "as", "output", ":", "output", ".", "write", "(", "json", ".", "dumps", "(", "self", ".", "data", ",", "sort_keys", "=", "True", ...
Will write the config out to disk.
[ "Will", "write", "the", "config", "out", "to", "disk", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/config.py#L42-L47
PredixDev/predixpy
predix/admin/blobstore.py
BlobStore.create
def create(self, **kwargs): """ Create an instance of the Blob Store Service with the typical starting settings. """ self.service.create(**kwargs) predix.config.set_env_value(self.use_class, 'url', self.service.settings.data['url']) predix.config....
python
def create(self, **kwargs): """ Create an instance of the Blob Store Service with the typical starting settings. """ self.service.create(**kwargs) predix.config.set_env_value(self.use_class, 'url', self.service.settings.data['url']) predix.config....
[ "def", "create", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "service", ".", "create", "(", "*", "*", "kwargs", ")", "predix", ".", "config", ".", "set_env_value", "(", "self", ".", "use_class", ",", "'url'", ",", "self", ".", "ser...
Create an instance of the Blob Store Service with the typical starting settings.
[ "Create", "an", "instance", "of", "the", "Blob", "Store", "Service", "with", "the", "typical", "starting", "settings", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/blobstore.py#L28-L44
PredixDev/predixpy
predix/admin/blobstore.py
BlobStore.add_to_manifest
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
python
def add_to_manifest(self, manifest): """ Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry...
[ "def", "add_to_manifest", "(", "self", ",", "manifest", ")", ":", "# Add this service to the list of services", "manifest", ".", "add_service", "(", "self", ".", "service", ".", "name", ")", "# Add environment variables", "url", "=", "predix", ".", "config", ".", ...
Add useful details to the manifest about this service so that it can be used in an application. :param manifest: An predix.admin.app.Manifest object instance that manages reading/writing manifest config for a cloud foundry app.
[ "Add", "useful", "details", "to", "the", "manifest", "about", "this", "service", "so", "that", "it", "can", "be", "used", "in", "an", "application", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/admin/blobstore.py#L46-L75
PredixDev/predixpy
predix/data/eventhub/subscriber.py
Subscriber.subscribe
def subscribe(self): """ return a generator for all subscribe messages :return: None """ while self.run_subscribe_generator: if len(self._rx_messages) != 0: yield self._rx_messages.pop(0) return
python
def subscribe(self): """ return a generator for all subscribe messages :return: None """ while self.run_subscribe_generator: if len(self._rx_messages) != 0: yield self._rx_messages.pop(0) return
[ "def", "subscribe", "(", "self", ")", ":", "while", "self", ".", "run_subscribe_generator", ":", "if", "len", "(", "self", ".", "_rx_messages", ")", "!=", "0", ":", "yield", "self", ".", "_rx_messages", ".", "pop", "(", "0", ")", "return" ]
return a generator for all subscribe messages :return: None
[ "return", "a", "generator", "for", "all", "subscribe", "messages", ":", "return", ":", "None" ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/subscriber.py#L97-L105
PredixDev/predixpy
predix/data/eventhub/subscriber.py
Subscriber.send_acks
def send_acks(self, message): """ send acks to the service :param message: EventHub_pb2.Message :return: None """ if isinstance(message, EventHub_pb2.Message): ack = EventHub_pb2.Ack(partition=message.partition, offset=message.offset) self.grpc_man...
python
def send_acks(self, message): """ send acks to the service :param message: EventHub_pb2.Message :return: None """ if isinstance(message, EventHub_pb2.Message): ack = EventHub_pb2.Ack(partition=message.partition, offset=message.offset) self.grpc_man...
[ "def", "send_acks", "(", "self", ",", "message", ")", ":", "if", "isinstance", "(", "message", ",", "EventHub_pb2", ".", "Message", ")", ":", "ack", "=", "EventHub_pb2", ".", "Ack", "(", "partition", "=", "message", ".", "partition", ",", "offset", "=", ...
send acks to the service :param message: EventHub_pb2.Message :return: None
[ "send", "acks", "to", "the", "service", ":", "param", "message", ":", "EventHub_pb2", ".", "Message", ":", "return", ":", "None" ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/subscriber.py#L107-L121
PredixDev/predixpy
predix/data/eventhub/subscriber.py
Subscriber._generate_subscribe_headers
def _generate_subscribe_headers(self): """ generate the subscribe stub headers based on the supplied config :return: i """ headers =[] headers.append(('predix-zone-id', self.eventhub_client.zone_id)) token = self.eventhub_client.service._get_bearer_token() ...
python
def _generate_subscribe_headers(self): """ generate the subscribe stub headers based on the supplied config :return: i """ headers =[] headers.append(('predix-zone-id', self.eventhub_client.zone_id)) token = self.eventhub_client.service._get_bearer_token() ...
[ "def", "_generate_subscribe_headers", "(", "self", ")", ":", "headers", "=", "[", "]", "headers", ".", "append", "(", "(", "'predix-zone-id'", ",", "self", ".", "eventhub_client", ".", "zone_id", ")", ")", "token", "=", "self", ".", "eventhub_client", ".", ...
generate the subscribe stub headers based on the supplied config :return: i
[ "generate", "the", "subscribe", "stub", "headers", "based", "on", "the", "supplied", "config", ":", "return", ":", "i" ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/data/eventhub/subscriber.py#L123-L153
PredixDev/predixpy
predix/ie/parking.py
ParkingPlanning._get_assets
def _get_assets(self, bbox, size=None, page=None, asset_type=None, device_type=None, event_type=None, media_type=None): """ Returns the raw results of an asset search for a given bounding box. """ uri = self.uri + '/v1/assets/search' headers = self._get_header...
python
def _get_assets(self, bbox, size=None, page=None, asset_type=None, device_type=None, event_type=None, media_type=None): """ Returns the raw results of an asset search for a given bounding box. """ uri = self.uri + '/v1/assets/search' headers = self._get_header...
[ "def", "_get_assets", "(", "self", ",", "bbox", ",", "size", "=", "None", ",", "page", "=", "None", ",", "asset_type", "=", "None", ",", "device_type", "=", "None", ",", "event_type", "=", "None", ",", "media_type", "=", "None", ")", ":", "uri", "=",...
Returns the raw results of an asset search for a given bounding box.
[ "Returns", "the", "raw", "results", "of", "an", "asset", "search", "for", "a", "given", "bounding", "box", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/ie/parking.py#L85-L146
PredixDev/predixpy
predix/ie/parking.py
ParkingPlanning.get_assets
def get_assets(self, bbox, **kwargs): """ Query the assets stored in the intelligent environment for a given bounding box and query. Assets can be filtered by type of asset, event, or media available. - device_type=['DATASIM'] - asset_type=['CAMERA'] ...
python
def get_assets(self, bbox, **kwargs): """ Query the assets stored in the intelligent environment for a given bounding box and query. Assets can be filtered by type of asset, event, or media available. - device_type=['DATASIM'] - asset_type=['CAMERA'] ...
[ "def", "get_assets", "(", "self", ",", "bbox", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_get_assets", "(", "bbox", ",", "*", "*", "kwargs", ")", "# Remove broken HATEOAS _links but identify asset uid first", "assets", "=", "[", "]", ...
Query the assets stored in the intelligent environment for a given bounding box and query. Assets can be filtered by type of asset, event, or media available. - device_type=['DATASIM'] - asset_type=['CAMERA'] - event_type=['PKIN'] - media_type=['IMAGE'] ...
[ "Query", "the", "assets", "stored", "in", "the", "intelligent", "environment", "for", "a", "given", "bounding", "box", "and", "query", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/ie/parking.py#L148-L188
PredixDev/predixpy
predix/ie/parking.py
ParkingPlanning._get_asset
def _get_asset(self, asset_uid): """ Returns raw response for an given asset by its unique id. """ uri = self.uri + '/v2/assets/' + asset_uid headers = self._get_headers() return self.service._get(uri, headers=headers)
python
def _get_asset(self, asset_uid): """ Returns raw response for an given asset by its unique id. """ uri = self.uri + '/v2/assets/' + asset_uid headers = self._get_headers() return self.service._get(uri, headers=headers)
[ "def", "_get_asset", "(", "self", ",", "asset_uid", ")", ":", "uri", "=", "self", ".", "uri", "+", "'/v2/assets/'", "+", "asset_uid", "headers", "=", "self", ".", "_get_headers", "(", ")", "return", "self", ".", "service", ".", "_get", "(", "uri", ",",...
Returns raw response for an given asset by its unique id.
[ "Returns", "raw", "response", "for", "an", "given", "asset", "by", "its", "unique", "id", "." ]
train
https://github.com/PredixDev/predixpy/blob/a0cb34cf40f716229351bb6d90d6ecace958c81f/predix/ie/parking.py#L190-L198
djgagne/hagelslag
hagelslag/processing/Hysteresis.py
Hysteresis.label
def label(self, input_grid): """ Label input grid with hysteresis method. Args: input_grid: 2D array of values. Returns: Labeled output grid. """ unset = 0 high_labels, num_labels = label(input_grid > self.high_thresh) region_rank...
python
def label(self, input_grid): """ Label input grid with hysteresis method. Args: input_grid: 2D array of values. Returns: Labeled output grid. """ unset = 0 high_labels, num_labels = label(input_grid > self.high_thresh) region_rank...
[ "def", "label", "(", "self", ",", "input_grid", ")", ":", "unset", "=", "0", "high_labels", ",", "num_labels", "=", "label", "(", "input_grid", ">", "self", ".", "high_thresh", ")", "region_ranking", "=", "np", ".", "argsort", "(", "maximum", "(", "input...
Label input grid with hysteresis method. Args: input_grid: 2D array of values. Returns: Labeled output grid.
[ "Label", "input", "grid", "with", "hysteresis", "method", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/Hysteresis.py#L20-L49
djgagne/hagelslag
hagelslag/processing/Hysteresis.py
Hysteresis.size_filter
def size_filter(labeled_grid, min_size): """ Remove labeled objects that do not meet size threshold criteria. Args: labeled_grid: 2D output from label method. min_size: minimum size of object in pixels. Returns: labeled grid with smaller objects remo...
python
def size_filter(labeled_grid, min_size): """ Remove labeled objects that do not meet size threshold criteria. Args: labeled_grid: 2D output from label method. min_size: minimum size of object in pixels. Returns: labeled grid with smaller objects remo...
[ "def", "size_filter", "(", "labeled_grid", ",", "min_size", ")", ":", "out_grid", "=", "np", ".", "zeros", "(", "labeled_grid", ".", "shape", ",", "dtype", "=", "int", ")", "slices", "=", "find_objects", "(", "labeled_grid", ")", "j", "=", "1", "for", ...
Remove labeled objects that do not meet size threshold criteria. Args: labeled_grid: 2D output from label method. min_size: minimum size of object in pixels. Returns: labeled grid with smaller objects removed.
[ "Remove", "labeled", "objects", "that", "do", "not", "meet", "size", "threshold", "criteria", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/Hysteresis.py#L52-L72
djgagne/hagelslag
hagelslag/evaluation/MetricPlotter.py
roc_curve
def roc_curve(roc_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Probability of False Detection", ylabel="Probability of Detection", title="ROC Curve", ticks=np.arange(0, 1.1, 0.1), dpi=300, legend_params=None, bootstrap_sets=None, ci=(2.5, 9...
python
def roc_curve(roc_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Probability of False Detection", ylabel="Probability of Detection", title="ROC Curve", ticks=np.arange(0, 1.1, 0.1), dpi=300, legend_params=None, bootstrap_sets=None, ci=(2.5, 9...
[ "def", "roc_curve", "(", "roc_objs", ",", "obj_labels", ",", "colors", ",", "markers", ",", "filename", ",", "figsize", "=", "(", "8", ",", "8", ")", ",", "xlabel", "=", "\"Probability of False Detection\"", ",", "ylabel", "=", "\"Probability of Detection\"", ...
Plots a set receiver/relative operating characteristic (ROC) curves from DistributedROC objects. The ROC curve shows how well a forecast discriminates between two outcomes over a series of thresholds. It features Probability of Detection (True Positive Rate) on the y-axis and Probability of False Detection ...
[ "Plots", "a", "set", "receiver", "/", "relative", "operating", "characteristic", "(", "ROC", ")", "curves", "from", "DistributedROC", "objects", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MetricPlotter.py#L6-L73
djgagne/hagelslag
hagelslag/evaluation/MetricPlotter.py
performance_diagram
def performance_diagram(roc_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Success Ratio (1-FAR)", ylabel="Probability of Detection", ticks=np.arange(0, 1.1, 0.1), dpi=300, csi_cmap="Blues", csi_label="...
python
def performance_diagram(roc_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Success Ratio (1-FAR)", ylabel="Probability of Detection", ticks=np.arange(0, 1.1, 0.1), dpi=300, csi_cmap="Blues", csi_label="...
[ "def", "performance_diagram", "(", "roc_objs", ",", "obj_labels", ",", "colors", ",", "markers", ",", "filename", ",", "figsize", "=", "(", "8", ",", "8", ")", ",", "xlabel", "=", "\"Success Ratio (1-FAR)\"", ",", "ylabel", "=", "\"Probability of Detection\"", ...
Draws a performance diagram from a set of DistributedROC objects. A performance diagram is a variation on the ROC curve in which the Probability of False Detection on the x-axis has been replaced with the Success Ratio (1-False Alarm Ratio or Precision). The diagram also shows the Critical Success Index (C...
[ "Draws", "a", "performance", "diagram", "from", "a", "set", "of", "DistributedROC", "objects", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MetricPlotter.py#L76-L159
djgagne/hagelslag
hagelslag/evaluation/MetricPlotter.py
reliability_diagram
def reliability_diagram(rel_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Forecast Probability", ylabel="Observed Relative Frequency", ticks=np.arange(0, 1.05, 0.05), dpi=300, inset_size=1.5, title="Reliability Diagram", legend_params=None, bootstra...
python
def reliability_diagram(rel_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Forecast Probability", ylabel="Observed Relative Frequency", ticks=np.arange(0, 1.05, 0.05), dpi=300, inset_size=1.5, title="Reliability Diagram", legend_params=None, bootstra...
[ "def", "reliability_diagram", "(", "rel_objs", ",", "obj_labels", ",", "colors", ",", "markers", ",", "filename", ",", "figsize", "=", "(", "8", ",", "8", ")", ",", "xlabel", "=", "\"Forecast Probability\"", ",", "ylabel", "=", "\"Observed Relative Frequency\"",...
Plot reliability curves against a 1:1 diagonal to determine if probability forecasts are consistent with their observed relative frequency. Args: rel_objs (list): List of DistributedReliability objects. obj_labels (list): List of labels describing the forecast model associated with each curve. ...
[ "Plot", "reliability", "curves", "against", "a", "1", ":", "1", "diagonal", "to", "determine", "if", "probability", "forecasts", "are", "consistent", "with", "their", "observed", "relative", "frequency", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MetricPlotter.py#L162-L217
djgagne/hagelslag
hagelslag/evaluation/MetricPlotter.py
attributes_diagram
def attributes_diagram(rel_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Forecast Probability", ylabel="Observed Relative Frequency", ticks=np.arange(0, 1.05, 0.05), dpi=300, title="Attributes Diagram", legend_params=None, inset_params=None, ...
python
def attributes_diagram(rel_objs, obj_labels, colors, markers, filename, figsize=(8, 8), xlabel="Forecast Probability", ylabel="Observed Relative Frequency", ticks=np.arange(0, 1.05, 0.05), dpi=300, title="Attributes Diagram", legend_params=None, inset_params=None, ...
[ "def", "attributes_diagram", "(", "rel_objs", ",", "obj_labels", ",", "colors", ",", "markers", ",", "filename", ",", "figsize", "=", "(", "8", ",", "8", ")", ",", "xlabel", "=", "\"Forecast Probability\"", ",", "ylabel", "=", "\"Observed Relative Frequency\"", ...
Plot reliability curves against a 1:1 diagonal to determine if probability forecasts are consistent with their observed relative frequency. Also adds gray areas to show where the climatological probabilities lie and what areas result in a positive Brier Skill Score. Args: rel_objs (list): List of D...
[ "Plot", "reliability", "curves", "against", "a", "1", ":", "1", "diagonal", "to", "determine", "if", "probability", "forecasts", "are", "consistent", "with", "their", "observed", "relative", "frequency", ".", "Also", "adds", "gray", "areas", "to", "show", "whe...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MetricPlotter.py#L220-L288
nion-software/nionswift
nion/swift/ScriptsDialog.py
RunScriptDialog.get_string
def get_string(self, prompt, default_str=None) -> str: """Return a string value that the user enters. Raises exception for cancel.""" accept_event = threading.Event() value_ref = [None] def perform(): def accepted(text): value_ref[0] = text ac...
python
def get_string(self, prompt, default_str=None) -> str: """Return a string value that the user enters. Raises exception for cancel.""" accept_event = threading.Event() value_ref = [None] def perform(): def accepted(text): value_ref[0] = text ac...
[ "def", "get_string", "(", "self", ",", "prompt", ",", "default_str", "=", "None", ")", "->", "str", ":", "accept_event", "=", "threading", ".", "Event", "(", ")", "value_ref", "=", "[", "None", "]", "def", "perform", "(", ")", ":", "def", "accepted", ...
Return a string value that the user enters. Raises exception for cancel.
[ "Return", "a", "string", "value", "that", "the", "user", "enters", ".", "Raises", "exception", "for", "cancel", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/ScriptsDialog.py#L388-L415
nion-software/nionswift
nion/swift/ScriptsDialog.py
RunScriptDialog.__accept_reject
def __accept_reject(self, prompt, accepted_text, rejected_text, display_rejected): """Return a boolean value for accept/reject.""" accept_event = threading.Event() result_ref = [False] def perform(): def accepted(): result_ref[0] = True accept...
python
def __accept_reject(self, prompt, accepted_text, rejected_text, display_rejected): """Return a boolean value for accept/reject.""" accept_event = threading.Event() result_ref = [False] def perform(): def accepted(): result_ref[0] = True accept...
[ "def", "__accept_reject", "(", "self", ",", "prompt", ",", "accepted_text", ",", "rejected_text", ",", "display_rejected", ")", ":", "accept_event", "=", "threading", ".", "Event", "(", ")", "result_ref", "=", "[", "False", "]", "def", "perform", "(", ")", ...
Return a boolean value for accept/reject.
[ "Return", "a", "boolean", "value", "for", "accept", "/", "reject", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/ScriptsDialog.py#L444-L470
mgraffg/EvoDAG
EvoDAG/node.py
Variable.compute_weight
def compute_weight(self, r, ytr=None, mask=None): """Returns the weight (w) using OLS of r * w = gp._ytr """ ytr = self._ytr if ytr is None else ytr mask = self._mask if mask is None else mask return compute_weight(r, ytr, mask)
python
def compute_weight(self, r, ytr=None, mask=None): """Returns the weight (w) using OLS of r * w = gp._ytr """ ytr = self._ytr if ytr is None else ytr mask = self._mask if mask is None else mask return compute_weight(r, ytr, mask)
[ "def", "compute_weight", "(", "self", ",", "r", ",", "ytr", "=", "None", ",", "mask", "=", "None", ")", ":", "ytr", "=", "self", ".", "_ytr", "if", "ytr", "is", "None", "else", "ytr", "mask", "=", "self", ".", "_mask", "if", "mask", "is", "None",...
Returns the weight (w) using OLS of r * w = gp._ytr
[ "Returns", "the", "weight", "(", "w", ")", "using", "OLS", "of", "r", "*", "w", "=", "gp", ".", "_ytr" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/node.py#L129-L133
mgraffg/EvoDAG
EvoDAG/node.py
Variable.isfinite
def isfinite(self): "Test whether the predicted values are finite" if self._multiple_outputs: if self.hy_test is not None: r = [(hy.isfinite() and (hyt is None or hyt.isfinite())) for hy, hyt in zip(self.hy, self.hy_test)] else: ...
python
def isfinite(self): "Test whether the predicted values are finite" if self._multiple_outputs: if self.hy_test is not None: r = [(hy.isfinite() and (hyt is None or hyt.isfinite())) for hy, hyt in zip(self.hy, self.hy_test)] else: ...
[ "def", "isfinite", "(", "self", ")", ":", "if", "self", ".", "_multiple_outputs", ":", "if", "self", ".", "hy_test", "is", "not", "None", ":", "r", "=", "[", "(", "hy", ".", "isfinite", "(", ")", "and", "(", "hyt", "is", "None", "or", "hyt", ".",...
Test whether the predicted values are finite
[ "Test", "whether", "the", "predicted", "values", "are", "finite" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/node.py#L192-L202
ajk8/hatchery
hatchery/helpers.py
value_of_named_argument_in_function
def value_of_named_argument_in_function(argument_name, function_name, search_str, resolve_varname=False): """ Parse an arbitrary block of python code to get the value of a named argument from inside a function call """ try: search_str = unicode(search_...
python
def value_of_named_argument_in_function(argument_name, function_name, search_str, resolve_varname=False): """ Parse an arbitrary block of python code to get the value of a named argument from inside a function call """ try: search_str = unicode(search_...
[ "def", "value_of_named_argument_in_function", "(", "argument_name", ",", "function_name", ",", "search_str", ",", "resolve_varname", "=", "False", ")", ":", "try", ":", "search_str", "=", "unicode", "(", "search_str", ")", "except", "NameError", ":", "pass", "read...
Parse an arbitrary block of python code to get the value of a named argument from inside a function call
[ "Parse", "an", "arbitrary", "block", "of", "python", "code", "to", "get", "the", "value", "of", "a", "named", "argument", "from", "inside", "a", "function", "call" ]
train
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/helpers.py#L17-L73
ajk8/hatchery
hatchery/helpers.py
regex_in_file
def regex_in_file(regex, filepath, return_match=False): """ Search for a regex in a file If return_match is True, return the found object instead of a boolean """ file_content = get_file_content(filepath) re_method = funcy.re_find if return_match else funcy.re_test return re_method(regex, file_...
python
def regex_in_file(regex, filepath, return_match=False): """ Search for a regex in a file If return_match is True, return the found object instead of a boolean """ file_content = get_file_content(filepath) re_method = funcy.re_find if return_match else funcy.re_test return re_method(regex, file_...
[ "def", "regex_in_file", "(", "regex", ",", "filepath", ",", "return_match", "=", "False", ")", ":", "file_content", "=", "get_file_content", "(", "filepath", ")", "re_method", "=", "funcy", ".", "re_find", "if", "return_match", "else", "funcy", ".", "re_test",...
Search for a regex in a file If return_match is True, return the found object instead of a boolean
[ "Search", "for", "a", "regex", "in", "a", "file" ]
train
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/helpers.py#L95-L102
ajk8/hatchery
hatchery/helpers.py
regex_in_package_file
def regex_in_package_file(regex, filename, package_name, return_match=False): """ Search for a regex in a file contained within the package directory If return_match is True, return the found object instead of a boolean """ filepath = package_file_path(filename, package_name) return regex_in_file(r...
python
def regex_in_package_file(regex, filename, package_name, return_match=False): """ Search for a regex in a file contained within the package directory If return_match is True, return the found object instead of a boolean """ filepath = package_file_path(filename, package_name) return regex_in_file(r...
[ "def", "regex_in_package_file", "(", "regex", ",", "filename", ",", "package_name", ",", "return_match", "=", "False", ")", ":", "filepath", "=", "package_file_path", "(", "filename", ",", "package_name", ")", "return", "regex_in_file", "(", "regex", ",", "filep...
Search for a regex in a file contained within the package directory If return_match is True, return the found object instead of a boolean
[ "Search", "for", "a", "regex", "in", "a", "file", "contained", "within", "the", "package", "directory" ]
train
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/helpers.py#L106-L112
ajk8/hatchery
hatchery/helpers.py
string_is_url
def string_is_url(test_str): """ Test to see if a string is a URL or not, defined in this case as a string for which urlparse returns a scheme component >>> string_is_url('somestring') False >>> string_is_url('https://some.domain.org/path') True """ parsed = urlparse.urlparse(test_str) ...
python
def string_is_url(test_str): """ Test to see if a string is a URL or not, defined in this case as a string for which urlparse returns a scheme component >>> string_is_url('somestring') False >>> string_is_url('https://some.domain.org/path') True """ parsed = urlparse.urlparse(test_str) ...
[ "def", "string_is_url", "(", "test_str", ")", ":", "parsed", "=", "urlparse", ".", "urlparse", "(", "test_str", ")", "return", "parsed", ".", "scheme", "is", "not", "None", "and", "parsed", ".", "scheme", "!=", "''" ]
Test to see if a string is a URL or not, defined in this case as a string for which urlparse returns a scheme component >>> string_is_url('somestring') False >>> string_is_url('https://some.domain.org/path') True
[ "Test", "to", "see", "if", "a", "string", "is", "a", "URL", "or", "not", "defined", "in", "this", "case", "as", "a", "string", "for", "which", "urlparse", "returns", "a", "scheme", "component" ]
train
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/helpers.py#L116-L126
nion-software/nionswift
nion/swift/model/DocumentModel.py
TransactionManager.item_transaction
def item_transaction(self, item) -> Transaction: """Begin transaction state for item. A transaction state is exists to prevent writing out to disk, mainly for performance reasons. All changes to the object are delayed until the transaction state exits. This method is thread safe. ...
python
def item_transaction(self, item) -> Transaction: """Begin transaction state for item. A transaction state is exists to prevent writing out to disk, mainly for performance reasons. All changes to the object are delayed until the transaction state exits. This method is thread safe. ...
[ "def", "item_transaction", "(", "self", ",", "item", ")", "->", "Transaction", ":", "items", "=", "self", ".", "__build_transaction_items", "(", "item", ")", "transaction", "=", "Transaction", "(", "self", ",", "item", ",", "items", ")", "self", ".", "__tr...
Begin transaction state for item. A transaction state is exists to prevent writing out to disk, mainly for performance reasons. All changes to the object are delayed until the transaction state exits. This method is thread safe.
[ "Begin", "transaction", "state", "for", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L174-L185
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.insert_data_item
def insert_data_item(self, before_index, data_item, auto_display: bool = True) -> None: """Insert a new data item into document model. This method is NOT threadsafe. """ assert data_item is not None assert data_item not in self.data_items assert before_index <= len(self....
python
def insert_data_item(self, before_index, data_item, auto_display: bool = True) -> None: """Insert a new data item into document model. This method is NOT threadsafe. """ assert data_item is not None assert data_item not in self.data_items assert before_index <= len(self....
[ "def", "insert_data_item", "(", "self", ",", "before_index", ",", "data_item", ",", "auto_display", ":", "bool", "=", "True", ")", "->", "None", ":", "assert", "data_item", "is", "not", "None", "assert", "data_item", "not", "in", "self", ".", "data_items", ...
Insert a new data item into document model. This method is NOT threadsafe.
[ "Insert", "a", "new", "data", "item", "into", "document", "model", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L541-L557
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.remove_data_item
def remove_data_item(self, data_item: DataItem.DataItem, *, safe: bool=False) -> typing.Optional[typing.Sequence]: """Remove data item from document model. This method is NOT threadsafe. """ # remove data item from any computations return self.__cascade_delete(data_item, safe=sa...
python
def remove_data_item(self, data_item: DataItem.DataItem, *, safe: bool=False) -> typing.Optional[typing.Sequence]: """Remove data item from document model. This method is NOT threadsafe. """ # remove data item from any computations return self.__cascade_delete(data_item, safe=sa...
[ "def", "remove_data_item", "(", "self", ",", "data_item", ":", "DataItem", ".", "DataItem", ",", "*", ",", "safe", ":", "bool", "=", "False", ")", "->", "typing", ".", "Optional", "[", "typing", ".", "Sequence", "]", ":", "# remove data item from any computa...
Remove data item from document model. This method is NOT threadsafe.
[ "Remove", "data", "item", "from", "document", "model", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L586-L592
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.__cascade_delete_inner
def __cascade_delete_inner(self, master_item, safe: bool=False) -> typing.Optional[typing.Sequence]: """Cascade delete an item. Returns an undelete log that can be used to undo the cascade deletion. Builds a cascade of items to be deleted and dependencies to be removed when the passed item is ...
python
def __cascade_delete_inner(self, master_item, safe: bool=False) -> typing.Optional[typing.Sequence]: """Cascade delete an item. Returns an undelete log that can be used to undo the cascade deletion. Builds a cascade of items to be deleted and dependencies to be removed when the passed item is ...
[ "def", "__cascade_delete_inner", "(", "self", ",", "master_item", ",", "safe", ":", "bool", "=", "False", ")", "->", "typing", ".", "Optional", "[", "typing", ".", "Sequence", "]", ":", "# print(f\"cascade {master_item}\")", "# this horrible little hack ensures that c...
Cascade delete an item. Returns an undelete log that can be used to undo the cascade deletion. Builds a cascade of items to be deleted and dependencies to be removed when the passed item is deleted. Then removes computations that are no longer valid. Removing a computation may result in more d...
[ "Cascade", "delete", "an", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L852-L956
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.get_dependent_items
def get_dependent_items(self, item) -> typing.List: """Return the list of data items containing data that directly depends on data in this item.""" with self.__dependency_tree_lock: return copy.copy(self.__dependency_tree_source_to_target_map.get(weakref.ref(item), list()))
python
def get_dependent_items(self, item) -> typing.List: """Return the list of data items containing data that directly depends on data in this item.""" with self.__dependency_tree_lock: return copy.copy(self.__dependency_tree_source_to_target_map.get(weakref.ref(item), list()))
[ "def", "get_dependent_items", "(", "self", ",", "item", ")", "->", "typing", ".", "List", ":", "with", "self", ".", "__dependency_tree_lock", ":", "return", "copy", ".", "copy", "(", "self", ".", "__dependency_tree_source_to_target_map", ".", "get", "(", "weak...
Return the list of data items containing data that directly depends on data in this item.
[ "Return", "the", "list", "of", "data", "items", "containing", "data", "that", "directly", "depends", "on", "data", "in", "this", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1151-L1154
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.__get_deep_dependent_item_set
def __get_deep_dependent_item_set(self, item, item_set) -> None: """Return the list of data items containing data that directly depends on data in this item.""" if not item in item_set: item_set.add(item) with self.__dependency_tree_lock: for dependent in self.get...
python
def __get_deep_dependent_item_set(self, item, item_set) -> None: """Return the list of data items containing data that directly depends on data in this item.""" if not item in item_set: item_set.add(item) with self.__dependency_tree_lock: for dependent in self.get...
[ "def", "__get_deep_dependent_item_set", "(", "self", ",", "item", ",", "item_set", ")", "->", "None", ":", "if", "not", "item", "in", "item_set", ":", "item_set", ".", "add", "(", "item", ")", "with", "self", ".", "__dependency_tree_lock", ":", "for", "dep...
Return the list of data items containing data that directly depends on data in this item.
[ "Return", "the", "list", "of", "data", "items", "containing", "data", "that", "directly", "depends", "on", "data", "in", "this", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1156-L1162
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.get_dependent_data_items
def get_dependent_data_items(self, data_item: DataItem.DataItem) -> typing.List[DataItem.DataItem]: """Return the list of data items containing data that directly depends on data in this item.""" with self.__dependency_tree_lock: return [data_item for data_item in self.__dependency_tree_sour...
python
def get_dependent_data_items(self, data_item: DataItem.DataItem) -> typing.List[DataItem.DataItem]: """Return the list of data items containing data that directly depends on data in this item.""" with self.__dependency_tree_lock: return [data_item for data_item in self.__dependency_tree_sour...
[ "def", "get_dependent_data_items", "(", "self", ",", "data_item", ":", "DataItem", ".", "DataItem", ")", "->", "typing", ".", "List", "[", "DataItem", ".", "DataItem", "]", ":", "with", "self", ".", "__dependency_tree_lock", ":", "return", "[", "data_item", ...
Return the list of data items containing data that directly depends on data in this item.
[ "Return", "the", "list", "of", "data", "items", "containing", "data", "that", "directly", "depends", "on", "data", "in", "this", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1168-L1171
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.transaction_context
def transaction_context(self): """Return a context object for a document-wide transaction.""" class DocumentModelTransaction: def __init__(self, document_model): self.__document_model = document_model def __enter__(self): self.__document_model.per...
python
def transaction_context(self): """Return a context object for a document-wide transaction.""" class DocumentModelTransaction: def __init__(self, document_model): self.__document_model = document_model def __enter__(self): self.__document_model.per...
[ "def", "transaction_context", "(", "self", ")", ":", "class", "DocumentModelTransaction", ":", "def", "__init__", "(", "self", ",", "document_model", ")", ":", "self", ".", "__document_model", "=", "document_model", "def", "__enter__", "(", "self", ")", ":", "...
Return a context object for a document-wide transaction.
[ "Return", "a", "context", "object", "for", "a", "document", "-", "wide", "transaction", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1195-L1209
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.data_item_live
def data_item_live(self, data_item): """ Return a context manager to put the data item in a 'live state'. """ class LiveContextManager: def __init__(self, manager, object): self.__manager = manager self.__object = object def __enter__(self): ...
python
def data_item_live(self, data_item): """ Return a context manager to put the data item in a 'live state'. """ class LiveContextManager: def __init__(self, manager, object): self.__manager = manager self.__object = object def __enter__(self): ...
[ "def", "data_item_live", "(", "self", ",", "data_item", ")", ":", "class", "LiveContextManager", ":", "def", "__init__", "(", "self", ",", "manager", ",", "object", ")", ":", "self", ".", "__manager", "=", "manager", "self", ".", "__object", "=", "object",...
Return a context manager to put the data item in a 'live state'.
[ "Return", "a", "context", "manager", "to", "put", "the", "data", "item", "in", "a", "live", "state", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1227-L1238
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.begin_data_item_live
def begin_data_item_live(self, data_item): """Begins a live state for the data item. The live state is propagated to dependent data items. This method is thread safe. See slow_test_dependent_data_item_removed_while_live_data_item_becomes_unlive. """ with self.__live_data_items_...
python
def begin_data_item_live(self, data_item): """Begins a live state for the data item. The live state is propagated to dependent data items. This method is thread safe. See slow_test_dependent_data_item_removed_while_live_data_item_becomes_unlive. """ with self.__live_data_items_...
[ "def", "begin_data_item_live", "(", "self", ",", "data_item", ")", ":", "with", "self", ".", "__live_data_items_lock", ":", "old_live_count", "=", "self", ".", "__live_data_items", ".", "get", "(", "data_item", ".", "uuid", ",", "0", ")", "self", ".", "__liv...
Begins a live state for the data item. The live state is propagated to dependent data items. This method is thread safe. See slow_test_dependent_data_item_removed_while_live_data_item_becomes_unlive.
[ "Begins", "a", "live", "state", "for", "the", "data", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1240-L1253
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.end_data_item_live
def end_data_item_live(self, data_item): """Ends a live state for the data item. The live-ness property is propagated to dependent data items, similar to the transactions. This method is thread safe. """ with self.__live_data_items_lock: live_count = self.__live_dat...
python
def end_data_item_live(self, data_item): """Ends a live state for the data item. The live-ness property is propagated to dependent data items, similar to the transactions. This method is thread safe. """ with self.__live_data_items_lock: live_count = self.__live_dat...
[ "def", "end_data_item_live", "(", "self", ",", "data_item", ")", ":", "with", "self", ".", "__live_data_items_lock", ":", "live_count", "=", "self", ".", "__live_data_items", ".", "get", "(", "data_item", ".", "uuid", ",", "0", ")", "-", "1", "assert", "li...
Ends a live state for the data item. The live-ness property is propagated to dependent data items, similar to the transactions. This method is thread safe.
[ "Ends", "a", "live", "state", "for", "the", "data", "item", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L1255-L1269
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.__construct_data_item_reference
def __construct_data_item_reference(self, hardware_source: HardwareSource.HardwareSource, data_channel: HardwareSource.DataChannel): """Construct a data item reference. Construct a data item reference and assign a data item to it. Update data item session id and session metadata. Also connect t...
python
def __construct_data_item_reference(self, hardware_source: HardwareSource.HardwareSource, data_channel: HardwareSource.DataChannel): """Construct a data item reference. Construct a data item reference and assign a data item to it. Update data item session id and session metadata. Also connect t...
[ "def", "__construct_data_item_reference", "(", "self", ",", "hardware_source", ":", "HardwareSource", ".", "HardwareSource", ",", "data_channel", ":", "HardwareSource", ".", "DataChannel", ")", ":", "session_id", "=", "self", ".", "session_id", "key", "=", "self", ...
Construct a data item reference. Construct a data item reference and assign a data item to it. Update data item session id and session metadata. Also connect the data channel processor. This method is thread safe.
[ "Construct", "a", "data", "item", "reference", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L2072-L2113
nion-software/nionswift
nion/swift/model/DocumentModel.py
DocumentModel.__make_computation
def __make_computation(self, processing_id: str, inputs: typing.List[typing.Tuple[DisplayItem.DisplayItem, typing.Optional[Graphics.Graphic]]], region_list_map: typing.Mapping[str, typing.List[Graphics.Graphic]]=None, parameters: typing.Mapping[str, typing.Any]=None) -> DataItem.DataItem: """Create a new data i...
python
def __make_computation(self, processing_id: str, inputs: typing.List[typing.Tuple[DisplayItem.DisplayItem, typing.Optional[Graphics.Graphic]]], region_list_map: typing.Mapping[str, typing.List[Graphics.Graphic]]=None, parameters: typing.Mapping[str, typing.Any]=None) -> DataItem.DataItem: """Create a new data i...
[ "def", "__make_computation", "(", "self", ",", "processing_id", ":", "str", ",", "inputs", ":", "typing", ".", "List", "[", "typing", ".", "Tuple", "[", "DisplayItem", ".", "DisplayItem", ",", "typing", ".", "Optional", "[", "Graphics", ".", "Graphic", "]"...
Create a new data item with computation specified by processing_id, inputs, and region_list_map. The region_list_map associates a list of graphics corresponding to the required regions with a computation source (key).
[ "Create", "a", "new", "data", "item", "with", "computation", "specified", "by", "processing_id", "inputs", "and", "region_list_map", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L2389-L2633
nion-software/nionswift
nion/swift/model/ColorMaps.py
interpolate_colors
def interpolate_colors(array: numpy.ndarray, x: int) -> numpy.ndarray: """ Creates a color map for values in array :param array: color map to interpolate :param x: number of colors :return: interpolated color map """ out_array = [] for i in range(x): if i % (x / (len(array) - 1))...
python
def interpolate_colors(array: numpy.ndarray, x: int) -> numpy.ndarray: """ Creates a color map for values in array :param array: color map to interpolate :param x: number of colors :return: interpolated color map """ out_array = [] for i in range(x): if i % (x / (len(array) - 1))...
[ "def", "interpolate_colors", "(", "array", ":", "numpy", ".", "ndarray", ",", "x", ":", "int", ")", "->", "numpy", ".", "ndarray", ":", "out_array", "=", "[", "]", "for", "i", "in", "range", "(", "x", ")", ":", "if", "i", "%", "(", "x", "/", "(...
Creates a color map for values in array :param array: color map to interpolate :param x: number of colors :return: interpolated color map
[ "Creates", "a", "color", "map", "for", "values", "in", "array", ":", "param", "array", ":", "color", "map", "to", "interpolate", ":", "param", "x", ":", "number", "of", "colors", ":", "return", ":", "interpolated", "color", "map" ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/ColorMaps.py#L23-L42
softvar/simplegist
simplegist/do.py
Do.star
def star(self, **args): ''' star any gist by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide authenticated user...
python
def star(self, **args): ''' star any gist by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide authenticated user...
[ "def", "star", "(", "self", ",", "*", "*", "args", ")", ":", "if", "'name'", "in", "args", ":", "self", ".", "gist_name", "=", "args", "[", "'name'", "]", "self", ".", "gist_id", "=", "self", ".", "getMyID", "(", "self", ".", "gist_name", ")", "e...
star any gist by providing gistID or gistname(for authenticated user)
[ "star", "any", "gist", "by", "providing", "gistID", "or", "gistname", "(", "for", "authenticated", "user", ")" ]
train
https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L28-L50
softvar/simplegist
simplegist/do.py
Do.fork
def fork(self, **args): ''' fork any gist by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide authenticated user...
python
def fork(self, **args): ''' fork any gist by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide authenticated user...
[ "def", "fork", "(", "self", ",", "*", "*", "args", ")", ":", "if", "'name'", "in", "args", ":", "self", ".", "gist_name", "=", "args", "[", "'name'", "]", "self", ".", "gist_id", "=", "self", ".", "getMyID", "(", "self", ".", "gist_name", ")", "e...
fork any gist by providing gistID or gistname(for authenticated user)
[ "fork", "any", "gist", "by", "providing", "gistID", "or", "gistname", "(", "for", "authenticated", "user", ")" ]
train
https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L76-L101
softvar/simplegist
simplegist/do.py
Do.checkifstar
def checkifstar(self, **args): ''' Check a gist if starred by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide ...
python
def checkifstar(self, **args): ''' Check a gist if starred by providing gistID or gistname(for authenticated user) ''' if 'name' in args: self.gist_name = args['name'] self.gist_id = self.getMyID(self.gist_name) elif 'id' in args: self.gist_id = args['id'] else: raise Exception('Either provide ...
[ "def", "checkifstar", "(", "self", ",", "*", "*", "args", ")", ":", "if", "'name'", "in", "args", ":", "self", ".", "gist_name", "=", "args", "[", "'name'", "]", "self", ".", "gist_id", "=", "self", ".", "getMyID", "(", "self", ".", "gist_name", ")...
Check a gist if starred by providing gistID or gistname(for authenticated user)
[ "Check", "a", "gist", "if", "starred", "by", "providing", "gistID", "or", "gistname", "(", "for", "authenticated", "user", ")" ]
train
https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L103-L130
base4sistemas/satcfe
satcfe/resposta/extrairlogs.py
RespostaExtrairLogs.salvar
def salvar(self, destino=None, prefix='tmp', suffix='-sat.log'): """Salva o arquivo de log decodificado. :param str destino: (Opcional) Caminho completo para o arquivo onde os dados dos logs deverão ser salvos. Se não informado, será criado um arquivo temporário via :func:`tempf...
python
def salvar(self, destino=None, prefix='tmp', suffix='-sat.log'): """Salva o arquivo de log decodificado. :param str destino: (Opcional) Caminho completo para o arquivo onde os dados dos logs deverão ser salvos. Se não informado, será criado um arquivo temporário via :func:`tempf...
[ "def", "salvar", "(", "self", ",", "destino", "=", "None", ",", "prefix", "=", "'tmp'", ",", "suffix", "=", "'-sat.log'", ")", ":", "if", "destino", ":", "if", "os", ".", "path", ".", "exists", "(", "destino", ")", ":", "raise", "IOError", "(", "("...
Salva o arquivo de log decodificado. :param str destino: (Opcional) Caminho completo para o arquivo onde os dados dos logs deverão ser salvos. Se não informado, será criado um arquivo temporário via :func:`tempfile.mkstemp`. :param str prefix: (Opcional) Prefixo para o nome do ...
[ "Salva", "o", "arquivo", "de", "log", "decodificado", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/extrairlogs.py#L55-L85
base4sistemas/satcfe
satcfe/resposta/extrairlogs.py
RespostaExtrairLogs.analisar
def analisar(retorno): """Constrói uma :class:`RespostaExtrairLogs` a partir do retorno informado. :param unicode retorno: Retorno da função ``ExtrairLogs``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='ExtrairLogs', classe_res...
python
def analisar(retorno): """Constrói uma :class:`RespostaExtrairLogs` a partir do retorno informado. :param unicode retorno: Retorno da função ``ExtrairLogs``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='ExtrairLogs', classe_res...
[ "def", "analisar", "(", "retorno", ")", ":", "resposta", "=", "analisar_retorno", "(", "forcar_unicode", "(", "retorno", ")", ",", "funcao", "=", "'ExtrairLogs'", ",", "classe_resposta", "=", "RespostaExtrairLogs", ",", "campos", "=", "RespostaSAT", ".", "CAMPOS...
Constrói uma :class:`RespostaExtrairLogs` a partir do retorno informado. :param unicode retorno: Retorno da função ``ExtrairLogs``.
[ "Constrói", "uma", ":", "class", ":", "RespostaExtrairLogs", "a", "partir", "do", "retorno", "informado", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/extrairlogs.py#L89-L109
djgagne/hagelslag
hagelslag/data/ModelGrid.py
ModelGrid.load_data_old
def load_data_old(self): """ Loads time series of 2D data grids from each opened file. The code handles loading a full time series from one file or individual time steps from multiple files. Missing files are supported. """ units = "" if len(self.file_objects) ==...
python
def load_data_old(self): """ Loads time series of 2D data grids from each opened file. The code handles loading a full time series from one file or individual time steps from multiple files. Missing files are supported. """ units = "" if len(self.file_objects) ==...
[ "def", "load_data_old", "(", "self", ")", ":", "units", "=", "\"\"", "if", "len", "(", "self", ".", "file_objects", ")", "==", "1", "and", "self", ".", "file_objects", "[", "0", "]", "is", "not", "None", ":", "data", "=", "self", ".", "file_objects",...
Loads time series of 2D data grids from each opened file. The code handles loading a full time series from one file or individual time steps from multiple files. Missing files are supported.
[ "Loads", "time", "series", "of", "2D", "data", "grids", "from", "each", "opened", "file", ".", "The", "code", "handles", "loading", "a", "full", "time", "series", "from", "one", "file", "or", "individual", "time", "steps", "from", "multiple", "files", ".",...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L55-L94
djgagne/hagelslag
hagelslag/data/ModelGrid.py
ModelGrid.load_data
def load_data(self): """ Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats. Returns: Array of data loaded from files in (time, y, x) dimensions, Units """ units = "" if self.file_objects[0] is None: ...
python
def load_data(self): """ Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats. Returns: Array of data loaded from files in (time, y, x) dimensions, Units """ units = "" if self.file_objects[0] is None: ...
[ "def", "load_data", "(", "self", ")", ":", "units", "=", "\"\"", "if", "self", ".", "file_objects", "[", "0", "]", "is", "None", ":", "raise", "IOError", "(", ")", "var_name", ",", "z_index", "=", "self", ".", "format_var_name", "(", "self", ".", "va...
Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats. Returns: Array of data loaded from files in (time, y, x) dimensions, Units
[ "Load", "data", "from", "netCDF", "file", "objects", "or", "list", "of", "netCDF", "file", "objects", ".", "Handles", "special", "variable", "name", "formats", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L96-L127
djgagne/hagelslag
hagelslag/data/ModelGrid.py
ModelGrid.format_var_name
def format_var_name(variable, var_list): """ Searches var list for variable name, checks other variable name format options. Args: variable (str): Variable being loaded var_list (list): List of variables in file. Returns: Name of variable in file con...
python
def format_var_name(variable, var_list): """ Searches var list for variable name, checks other variable name format options. Args: variable (str): Variable being loaded var_list (list): List of variables in file. Returns: Name of variable in file con...
[ "def", "format_var_name", "(", "variable", ",", "var_list", ")", ":", "z_index", "=", "None", "if", "variable", "in", "var_list", ":", "var_name", "=", "variable", "elif", "variable", ".", "ljust", "(", "6", ",", "\"_\"", ")", "in", "var_list", ":", "var...
Searches var list for variable name, checks other variable name format options. Args: variable (str): Variable being loaded var_list (list): List of variables in file. Returns: Name of variable in file containing relevant data, and index of variable z-level if multi...
[ "Searches", "var", "list", "for", "variable", "name", "checks", "other", "variable", "name", "format", "options", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L130-L152
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.load_data
def load_data(self, mode="train", format="csv"): """ Load data from flat data files containing total track information and information about each timestep. The two sets are combined using merge operations on the Track IDs. Additional member information is gathered from the appropriate me...
python
def load_data(self, mode="train", format="csv"): """ Load data from flat data files containing total track information and information about each timestep. The two sets are combined using merge operations on the Track IDs. Additional member information is gathered from the appropriate me...
[ "def", "load_data", "(", "self", ",", "mode", "=", "\"train\"", ",", "format", "=", "\"csv\"", ")", ":", "if", "mode", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "run_dates", "=", "pd", ".", "DatetimeIndex", "(", "start", "=", "self", "...
Load data from flat data files containing total track information and information about each timestep. The two sets are combined using merge operations on the Track IDs. Additional member information is gathered from the appropriate member file. Args: mode: "train" or "forecast" ...
[ "Load", "data", "from", "flat", "data", "files", "containing", "total", "track", "information", "and", "information", "about", "each", "timestep", ".", "The", "two", "sets", "are", "combined", "using", "merge", "operations", "on", "the", "Track", "IDs", ".", ...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L63-L111
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.calc_copulas
def calc_copulas(self, output_file, model_names=("start-time", "translation-x", "translation-y"), label_columns=("Start_Time_Error", "Translation_Error_X", "Translation_Error_Y")): """ Calculate a copula multivariate normal distribution from...
python
def calc_copulas(self, output_file, model_names=("start-time", "translation-x", "translation-y"), label_columns=("Start_Time_Error", "Translation_Error_X", "Translation_Error_Y")): """ Calculate a copula multivariate normal distribution from...
[ "def", "calc_copulas", "(", "self", ",", "output_file", ",", "model_names", "=", "(", "\"start-time\"", ",", "\"translation-x\"", ",", "\"translation-y\"", ")", ",", "label_columns", "=", "(", "\"Start_Time_Error\"", ",", "\"Translation_Error_X\"", ",", "\"Translation...
Calculate a copula multivariate normal distribution from the training data for each group of ensemble members. Distributions are written to a pickle file for later use. Args: output_file: Pickle file model_names: Names of the tracking models label_columns: Names of th...
[ "Calculate", "a", "copula", "multivariate", "normal", "distribution", "from", "the", "training", "data", "for", "each", "group", "of", "ensemble", "members", ".", "Distributions", "are", "written", "to", "a", "pickle", "file", "for", "later", "use", ".", "Args...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L113-L142
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_condition_models
def fit_condition_models(self, model_names, model_objs, input_columns, output_column="Matched", output_threshold=0.0): """ Fit machine learning models to predict whether or not hail will o...
python
def fit_condition_models(self, model_names, model_objs, input_columns, output_column="Matched", output_threshold=0.0): """ Fit machine learning models to predict whether or not hail will o...
[ "def", "fit_condition_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_column", "=", "\"Matched\"", ",", "output_threshold", "=", "0.0", ")", ":", "print", "(", "\"Fitting condition models\"", ")", "groups", "=", "sel...
Fit machine learning models to predict whether or not hail will occur. Args: model_names: List of strings with the names for the particular machine learning models model_objs: scikit-learn style machine learning model objects. input_columns: list of the names of the columns u...
[ "Fit", "machine", "learning", "models", "to", "predict", "whether", "or", "not", "hail", "will", "occur", ".", "Args", ":", "model_names", ":", "List", "of", "strings", "with", "the", "names", "for", "the", "particular", "machine", "learning", "models", "mod...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L144-L191
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_condition_threshold_models
def fit_condition_threshold_models(self, model_names, model_objs, input_columns, output_column="Matched", output_threshold=0.5, num_folds=5, threshold_score="ets"): """ Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshol...
python
def fit_condition_threshold_models(self, model_names, model_objs, input_columns, output_column="Matched", output_threshold=0.5, num_folds=5, threshold_score="ets"): """ Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshol...
[ "def", "fit_condition_threshold_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_column", "=", "\"Matched\"", ",", "output_threshold", "=", "0.5", ",", "num_folds", "=", "5", ",", "threshold_score", "=", "\"ets\"", ")...
Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshold that maximizes a skill score. Args: model_names: List of machine learning model names model_objs: List of Scikit-learn ML models input_columns: List of input variables i...
[ "Fit", "models", "to", "predict", "hail", "/", "no", "-", "hail", "and", "use", "cross", "-", "validation", "to", "determine", "the", "probaility", "threshold", "that", "maximizes", "a", "skill", "score", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L193-L292
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.predict_condition_models
def predict_condition_models(self, model_names, input_columns, metadata_cols, data_mode="forecast", ): """ Apply condition modelsto forecast data. Args: ...
python
def predict_condition_models(self, model_names, input_columns, metadata_cols, data_mode="forecast", ): """ Apply condition modelsto forecast data. Args: ...
[ "def", "predict_condition_models", "(", "self", ",", "model_names", ",", "input_columns", ",", "metadata_cols", ",", "data_mode", "=", "\"forecast\"", ",", ")", ":", "groups", "=", "self", ".", "condition_models", ".", "keys", "(", ")", "predictions", "=", "pd...
Apply condition modelsto forecast data. Args: model_names: List of names associated with each condition model used for prediction input_columns: List of columns in data used as input into the model metadata_cols: Columns from input data that should be included in the data fra...
[ "Apply", "condition", "modelsto", "forecast", "data", ".", "Args", ":", "model_names", ":", "List", "of", "names", "associated", "with", "each", "condition", "model", "used", "for", "prediction", "input_columns", ":", "List", "of", "columns", "in", "data", "us...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L294-L327
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_size_distribution_models
def fit_size_distribution_models(self, model_names, model_objs, input_columns, output_columns=None, calibrate=False): """ Fits multitask machine learning models to predict the parameters of a size distribution Args: model_names: List of machine le...
python
def fit_size_distribution_models(self, model_names, model_objs, input_columns, output_columns=None, calibrate=False): """ Fits multitask machine learning models to predict the parameters of a size distribution Args: model_names: List of machine le...
[ "def", "fit_size_distribution_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_columns", "=", "None", ",", "calibrate", "=", "False", ")", ":", "if", "output_columns", "is", "None", ":", "output_columns", "=", "[", ...
Fits multitask machine learning models to predict the parameters of a size distribution Args: model_names: List of machine learning model names model_objs: scikit-learn style machine learning model objects input_columns: Training data columns used as input for ML model ...
[ "Fits", "multitask", "machine", "learning", "models", "to", "predict", "the", "parameters", "of", "a", "size", "distribution", "Args", ":", "model_names", ":", "List", "of", "machine", "learning", "model", "names", "model_objs", ":", "scikit", "-", "learn", "s...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L329-L399
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_size_distribution_component_models
def fit_size_distribution_component_models(self, model_names, model_objs, input_columns, output_columns): """ This calculates 2 principal components for the hail size distribution between the shape and scale parameters. Separate machine learning models are fit to predict each component. ...
python
def fit_size_distribution_component_models(self, model_names, model_objs, input_columns, output_columns): """ This calculates 2 principal components for the hail size distribution between the shape and scale parameters. Separate machine learning models are fit to predict each component. ...
[ "def", "fit_size_distribution_component_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_columns", ")", ":", "groups", "=", "np", ".", "unique", "(", "self", ".", "data", "[", "\"train\"", "]", "[", "\"member\"", ...
This calculates 2 principal components for the hail size distribution between the shape and scale parameters. Separate machine learning models are fit to predict each component. Args: model_names: List of machine learning model names model_objs: List of machine learning model ob...
[ "This", "calculates", "2", "principal", "components", "for", "the", "hail", "size", "distribution", "between", "the", "shape", "and", "scale", "parameters", ".", "Separate", "machine", "learning", "models", "are", "fit", "to", "predict", "each", "component", "."...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L402-L468
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.predict_size_distribution_models
def predict_size_distribution_models(self, model_names, input_columns, metadata_cols, data_mode="forecast", location=6, calibrate=False): """ Make predictions using fitted size distribution models. Args: model_names: Name of the models for pre...
python
def predict_size_distribution_models(self, model_names, input_columns, metadata_cols, data_mode="forecast", location=6, calibrate=False): """ Make predictions using fitted size distribution models. Args: model_names: Name of the models for pre...
[ "def", "predict_size_distribution_models", "(", "self", ",", "model_names", ",", "input_columns", ",", "metadata_cols", ",", "data_mode", "=", "\"forecast\"", ",", "location", "=", "6", ",", "calibrate", "=", "False", ")", ":", "groups", "=", "self", ".", "siz...
Make predictions using fitted size distribution models. Args: model_names: Name of the models for predictions input_columns: Data columns used for input into ML models metadata_cols: Columns from input data that should be included in the data frame with the predictions. ...
[ "Make", "predictions", "using", "fitted", "size", "distribution", "models", ".", "Args", ":", "model_names", ":", "Name", "of", "the", "models", "for", "predictions", "input_columns", ":", "Data", "columns", "used", "for", "input", "into", "ML", "models", "met...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L470-L510
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.predict_size_distribution_component_models
def predict_size_distribution_component_models(self, model_names, input_columns, output_columns, metadata_cols, data_mode="forecast", location=6): """ Make predictions using fitted size distribution models. Args: model_names: Name of...
python
def predict_size_distribution_component_models(self, model_names, input_columns, output_columns, metadata_cols, data_mode="forecast", location=6): """ Make predictions using fitted size distribution models. Args: model_names: Name of...
[ "def", "predict_size_distribution_component_models", "(", "self", ",", "model_names", ",", "input_columns", ",", "output_columns", ",", "metadata_cols", ",", "data_mode", "=", "\"forecast\"", ",", "location", "=", "6", ")", ":", "groups", "=", "self", ".", "size_d...
Make predictions using fitted size distribution models. Args: model_names: Name of the models for predictions input_columns: Data columns used for input into ML models output_columns: Names of output columns metadata_cols: Columns from input data that should be in...
[ "Make", "predictions", "using", "fitted", "size", "distribution", "models", ".", "Args", ":", "model_names", ":", "Name", "of", "the", "models", "for", "predictions", "input_columns", ":", "Data", "columns", "used", "for", "input", "into", "ML", "models", "out...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L512-L553
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_size_models
def fit_size_models(self, model_names, model_objs, input_columns, output_column="Hail_Size", output_start=5, output_step=5, output_stop=100): """ Fit size model...
python
def fit_size_models(self, model_names, model_objs, input_columns, output_column="Hail_Size", output_start=5, output_step=5, output_stop=100): """ Fit size model...
[ "def", "fit_size_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_column", "=", "\"Hail_Size\"", ",", "output_start", "=", "5", ",", "output_step", "=", "5", ",", "output_stop", "=", "100", ")", ":", "print", "(...
Fit size models to produce discrete pdfs of forecast hail sizes. Args: model_names: List of model names model_objs: List of model objects input_columns: List of input variables output_column: Output variable name output_start: Hail size bin start ...
[ "Fit", "size", "models", "to", "produce", "discrete", "pdfs", "of", "forecast", "hail", "sizes", ".", "Args", ":", "model_names", ":", "List", "of", "model", "names", "model_objs", ":", "List", "of", "model", "objects", "input_columns", ":", "List", "of", ...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L555-L591
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.predict_size_models
def predict_size_models(self, model_names, input_columns, metadata_cols, data_mode="forecast"): """ Apply size models to forecast data. Args: model_names: input_columns: metada...
python
def predict_size_models(self, model_names, input_columns, metadata_cols, data_mode="forecast"): """ Apply size models to forecast data. Args: model_names: input_columns: metada...
[ "def", "predict_size_models", "(", "self", ",", "model_names", ",", "input_columns", ",", "metadata_cols", ",", "data_mode", "=", "\"forecast\"", ")", ":", "groups", "=", "self", ".", "size_models", ".", "keys", "(", ")", "predictions", "=", "{", "}", "for",...
Apply size models to forecast data. Args: model_names: input_columns: metadata_cols: data_mode:
[ "Apply", "size", "models", "to", "forecast", "data", ".", "Args", ":", "model_names", ":", "input_columns", ":", "metadata_cols", ":", "data_mode", ":" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L593-L624
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.fit_track_models
def fit_track_models(self, model_names, model_objs, input_columns, output_columns, output_ranges, ): """ Fit machine learning models to predict track erro...
python
def fit_track_models(self, model_names, model_objs, input_columns, output_columns, output_ranges, ): """ Fit machine learning models to predict track erro...
[ "def", "fit_track_models", "(", "self", ",", "model_names", ",", "model_objs", ",", "input_columns", ",", "output_columns", ",", "output_ranges", ",", ")", ":", "print", "(", "\"Fitting track models\"", ")", "groups", "=", "self", ".", "data", "[", "\"train\"", ...
Fit machine learning models to predict track error offsets. model_names: model_objs: input_columns: output_columns: output_ranges:
[ "Fit", "machine", "learning", "models", "to", "predict", "track", "error", "offsets", ".", "model_names", ":", "model_objs", ":", "input_columns", ":", "output_columns", ":", "output_ranges", ":" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L626-L661
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.save_models
def save_models(self, model_path): """ Save machine learning models to pickle files. """ for group, condition_model_set in self.condition_models.items(): for model_name, model_obj in condition_model_set.items(): out_filename = model_path + \ ...
python
def save_models(self, model_path): """ Save machine learning models to pickle files. """ for group, condition_model_set in self.condition_models.items(): for model_name, model_obj in condition_model_set.items(): out_filename = model_path + \ ...
[ "def", "save_models", "(", "self", ",", "model_path", ")", ":", "for", "group", ",", "condition_model_set", "in", "self", ".", "condition_models", ".", "items", "(", ")", ":", "for", "model_name", ",", "model_obj", "in", "condition_model_set", ".", "items", ...
Save machine learning models to pickle files.
[ "Save", "machine", "learning", "models", "to", "pickle", "files", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L700-L745
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.load_models
def load_models(self, model_path): """ Load models from pickle files. """ condition_model_files = sorted(glob(model_path + "*_condition.pkl")) if len(condition_model_files) > 0: for condition_model_file in condition_model_files: model_comps = condition...
python
def load_models(self, model_path): """ Load models from pickle files. """ condition_model_files = sorted(glob(model_path + "*_condition.pkl")) if len(condition_model_files) > 0: for condition_model_file in condition_model_files: model_comps = condition...
[ "def", "load_models", "(", "self", ",", "model_path", ")", ":", "condition_model_files", "=", "sorted", "(", "glob", "(", "model_path", "+", "\"*_condition.pkl\"", ")", ")", "if", "len", "(", "condition_model_files", ")", ">", "0", ":", "for", "condition_model...
Load models from pickle files.
[ "Load", "models", "from", "pickle", "files", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L747-L799
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.output_forecasts_json
def output_forecasts_json(self, forecasts, condition_model_names, size_model_names, dist_model_names, track_model_names, json_data_path, out...
python
def output_forecasts_json(self, forecasts, condition_model_names, size_model_names, dist_model_names, track_model_names, json_data_path, out...
[ "def", "output_forecasts_json", "(", "self", ",", "forecasts", ",", "condition_model_names", ",", "size_model_names", ",", "dist_model_names", ",", "track_model_names", ",", "json_data_path", ",", "out_path", ")", ":", "total_tracks", "=", "self", ".", "data", "[", ...
Output forecast values to geoJSON file format. :param forecasts: :param condition_model_names: :param size_model_names: :param track_model_names: :param json_data_path: :param out_path: :return:
[ "Output", "forecast", "values", "to", "geoJSON", "file", "format", ".", ":", "param", "forecasts", ":", ":", "param", "condition_model_names", ":", ":", "param", "size_model_names", ":", ":", "param", "track_model_names", ":", ":", "param", "json_data_path", ":"...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L801-L877
djgagne/hagelslag
hagelslag/processing/TrackModeler.py
TrackModeler.output_forecasts_csv
def output_forecasts_csv(self, forecasts, mode, csv_path, run_date_format="%Y%m%d-%H%M"): """ Output hail forecast values to csv files by run date and ensemble member. Args: forecasts: mode: csv_path: Returns: """ merged_forecasts = pd...
python
def output_forecasts_csv(self, forecasts, mode, csv_path, run_date_format="%Y%m%d-%H%M"): """ Output hail forecast values to csv files by run date and ensemble member. Args: forecasts: mode: csv_path: Returns: """ merged_forecasts = pd...
[ "def", "output_forecasts_csv", "(", "self", ",", "forecasts", ",", "mode", ",", "csv_path", ",", "run_date_format", "=", "\"%Y%m%d-%H%M\"", ")", ":", "merged_forecasts", "=", "pd", ".", "merge", "(", "forecasts", "[", "\"condition\"", "]", ",", "forecasts", "[...
Output hail forecast values to csv files by run date and ensemble member. Args: forecasts: mode: csv_path: Returns:
[ "Output", "hail", "forecast", "values", "to", "csv", "files", "by", "run", "date", "and", "ensemble", "member", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L879-L905
base4sistemas/satcfe
satcfe/base.py
BibliotecaSAT._carregar
def _carregar(self): """Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada ainda não tiver sido definida, será determinada pela extensão do arquivo da biblioteca. :raises ValueError: Se a convenção de chamada não puder ser determinada ou se não for um valor v...
python
def _carregar(self): """Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada ainda não tiver sido definida, será determinada pela extensão do arquivo da biblioteca. :raises ValueError: Se a convenção de chamada não puder ser determinada ou se não for um valor v...
[ "def", "_carregar", "(", "self", ")", ":", "if", "self", ".", "_convencao", "is", "None", ":", "if", "self", ".", "_caminho", ".", "endswith", "(", "(", "'.DLL'", ",", "'.dll'", ")", ")", ":", "self", ".", "_convencao", "=", "constantes", ".", "WINDO...
Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada ainda não tiver sido definida, será determinada pela extensão do arquivo da biblioteca. :raises ValueError: Se a convenção de chamada não puder ser determinada ou se não for um valor válido.
[ "Carrega", "(", "ou", "recarrega", ")", "a", "biblioteca", "SAT", ".", "Se", "a", "convenção", "de", "chamada", "ainda", "não", "tiver", "sido", "definida", "será", "determinada", "pela", "extensão", "do", "arquivo", "da", "biblioteca", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L81-L105
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.ativar_sat
def ativar_sat(self, tipo_certificado, cnpj, codigo_uf): """Função ``AtivarSAT`` conforme ER SAT, item 6.1.1. Ativação do equipamento SAT. Dependendo do tipo do certificado, o procedimento de ativação é complementado enviando-se o certificado emitido pela ICP-Brasil (:meth:`comunicar_cer...
python
def ativar_sat(self, tipo_certificado, cnpj, codigo_uf): """Função ``AtivarSAT`` conforme ER SAT, item 6.1.1. Ativação do equipamento SAT. Dependendo do tipo do certificado, o procedimento de ativação é complementado enviando-se o certificado emitido pela ICP-Brasil (:meth:`comunicar_cer...
[ "def", "ativar_sat", "(", "self", ",", "tipo_certificado", ",", "cnpj", ",", "codigo_uf", ")", ":", "return", "self", ".", "invocar__AtivarSAT", "(", "self", ".", "gerar_numero_sessao", "(", ")", ",", "tipo_certificado", ",", "self", ".", "_codigo_ativacao", "...
Função ``AtivarSAT`` conforme ER SAT, item 6.1.1. Ativação do equipamento SAT. Dependendo do tipo do certificado, o procedimento de ativação é complementado enviando-se o certificado emitido pela ICP-Brasil (:meth:`comunicar_certificado_icpbrasil`). :param int tipo_certificado: Deverá s...
[ "Função", "AtivarSAT", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "1", ".", "Ativação", "do", "equipamento", "SAT", ".", "Dependendo", "do", "tipo", "do", "certificado", "o", "procedimento", "de", "ativação", "é", "complementado", "enviando", "-", ...
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L262-L290
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.comunicar_certificado_icpbrasil
def comunicar_certificado_icpbrasil(self, certificado): """Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2. Envio do certificado criado pela ICP-Brasil. :param str certificado: Conteúdo do certificado digital criado pela autoridade certificadora ICP-Brasil. ...
python
def comunicar_certificado_icpbrasil(self, certificado): """Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2. Envio do certificado criado pela ICP-Brasil. :param str certificado: Conteúdo do certificado digital criado pela autoridade certificadora ICP-Brasil. ...
[ "def", "comunicar_certificado_icpbrasil", "(", "self", ",", "certificado", ")", ":", "return", "self", ".", "invocar__ComunicarCertificadoICPBRASIL", "(", "self", ".", "gerar_numero_sessao", "(", ")", ",", "self", ".", "_codigo_ativacao", ",", "certificado", ")" ]
Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2. Envio do certificado criado pela ICP-Brasil. :param str certificado: Conteúdo do certificado digital criado pela autoridade certificadora ICP-Brasil. :return: Retorna *verbatim* a resposta da função SAT. ...
[ "Função", "ComunicarCertificadoICPBRASIL", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "2", ".", "Envio", "do", "certificado", "criado", "pela", "ICP", "-", "Brasil", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L293-L304
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.enviar_dados_venda
def enviar_dados_venda(self, dados_venda): """Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o CF-e de venda para o equipamento SAT, que o enviará para autorização pela SEFAZ. :param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda` ou uma str...
python
def enviar_dados_venda(self, dados_venda): """Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o CF-e de venda para o equipamento SAT, que o enviará para autorização pela SEFAZ. :param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda` ou uma str...
[ "def", "enviar_dados_venda", "(", "self", ",", "dados_venda", ")", ":", "cfe_venda", "=", "dados_venda", "if", "isinstance", "(", "dados_venda", ",", "basestring", ")", "else", "dados_venda", ".", "documento", "(", ")", "return", "self", ".", "invocar__EnviarDad...
Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o CF-e de venda para o equipamento SAT, que o enviará para autorização pela SEFAZ. :param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda` ou uma string contendo o XML do CF-e de venda. :return:...
[ "Função", "EnviarDadosVenda", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "3", ".", "Envia", "o", "CF", "-", "e", "de", "venda", "para", "o", "equipamento", "SAT", "que", "o", "enviará", "para", "autorização", "pela", "SEFAZ", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L307-L323
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.cancelar_ultima_venda
def cancelar_ultima_venda(self, chave_cfe, dados_cancelamento): """Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o CF-e de cancelamento para o equipamento SAT, que o enviará para autorização e cancelamento do CF-e pela SEFAZ. :param chave_cfe: String contendo a chave...
python
def cancelar_ultima_venda(self, chave_cfe, dados_cancelamento): """Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o CF-e de cancelamento para o equipamento SAT, que o enviará para autorização e cancelamento do CF-e pela SEFAZ. :param chave_cfe: String contendo a chave...
[ "def", "cancelar_ultima_venda", "(", "self", ",", "chave_cfe", ",", "dados_cancelamento", ")", ":", "cfe_canc", "=", "dados_cancelamento", "if", "isinstance", "(", "dados_cancelamento", ",", "basestring", ")", "else", "dados_cancelamento", ".", "documento", "(", ")"...
Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o CF-e de cancelamento para o equipamento SAT, que o enviará para autorização e cancelamento do CF-e pela SEFAZ. :param chave_cfe: String contendo a chave do CF-e a ser cancelado, prefixada com o literal ``CFe``. ...
[ "Função", "CancelarUltimaVenda", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "4", ".", "Envia", "o", "CF", "-", "e", "de", "cancelamento", "para", "o", "equipamento", "SAT", "que", "o", "enviará", "para", "autorização", "e", "cancelamento", "do", ...
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L326-L347
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.consultar_numero_sessao
def consultar_numero_sessao(self, numero_sessao): """Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8. Consulta o equipamento SAT por um número de sessão específico. :param int numero_sessao: Número da sessão que se quer consultar. :return: Retorna *verbatim* a resposta da ...
python
def consultar_numero_sessao(self, numero_sessao): """Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8. Consulta o equipamento SAT por um número de sessão específico. :param int numero_sessao: Número da sessão que se quer consultar. :return: Retorna *verbatim* a resposta da ...
[ "def", "consultar_numero_sessao", "(", "self", ",", "numero_sessao", ")", ":", "return", "self", ".", "invocar__ConsultarNumeroSessao", "(", "self", ".", "gerar_numero_sessao", "(", ")", ",", "self", ".", "_codigo_ativacao", ",", "numero_sessao", ")" ]
Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8. Consulta o equipamento SAT por um número de sessão específico. :param int numero_sessao: Número da sessão que se quer consultar. :return: Retorna *verbatim* a resposta da função SAT. :rtype: string
[ "Função", "ConsultarNumeroSessao", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "8", ".", "Consulta", "o", "equipamento", "SAT", "por", "um", "número", "de", "sessão", "específico", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L389-L399
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.configurar_interface_de_rede
def configurar_interface_de_rede(self, configuracao): """Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9. Configurção da interface de comunicação do equipamento SAT. :param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede` ou uma string contendo o XM...
python
def configurar_interface_de_rede(self, configuracao): """Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9. Configurção da interface de comunicação do equipamento SAT. :param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede` ou uma string contendo o XM...
[ "def", "configurar_interface_de_rede", "(", "self", ",", "configuracao", ")", ":", "conf_xml", "=", "configuracao", "if", "isinstance", "(", "configuracao", ",", "basestring", ")", "else", "configuracao", ".", "documento", "(", ")", "return", "self", ".", "invoc...
Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9. Configurção da interface de comunicação do equipamento SAT. :param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede` ou uma string contendo o XML com as configurações de rede. :return: Retorna *verbat...
[ "Função", "ConfigurarInterfaceDeRede", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "9", ".", "Configurção", "da", "interface", "de", "comunicação", "do", "equipamento", "SAT", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L402-L417
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.associar_assinatura
def associar_assinatura(self, sequencia_cnpj, assinatura_ac): """Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10. Associação da assinatura do aplicativo comercial. :param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ do desenvolvedor da AC e do CNPJ do e...
python
def associar_assinatura(self, sequencia_cnpj, assinatura_ac): """Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10. Associação da assinatura do aplicativo comercial. :param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ do desenvolvedor da AC e do CNPJ do e...
[ "def", "associar_assinatura", "(", "self", ",", "sequencia_cnpj", ",", "assinatura_ac", ")", ":", "return", "self", ".", "invocar__AssociarAssinatura", "(", "self", ".", "gerar_numero_sessao", "(", ")", ",", "self", ".", "_codigo_ativacao", ",", "sequencia_cnpj", ...
Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10. Associação da assinatura do aplicativo comercial. :param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ do desenvolvedor da AC e do CNPJ do estabelecimento comercial contribuinte, conforme ER SAT, item ...
[ "Função", "AssociarAssinatura", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "10", ".", "Associação", "da", "assinatura", "do", "aplicativo", "comercial", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L420-L436
base4sistemas/satcfe
satcfe/base.py
FuncoesSAT.trocar_codigo_de_ativacao
def trocar_codigo_de_ativacao(self, novo_codigo_ativacao, opcao=constantes.CODIGO_ATIVACAO_REGULAR, codigo_emergencia=None): """Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15. Troca do código de ativação do equipamento SAT. :param str novo_codigo_ativacao...
python
def trocar_codigo_de_ativacao(self, novo_codigo_ativacao, opcao=constantes.CODIGO_ATIVACAO_REGULAR, codigo_emergencia=None): """Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15. Troca do código de ativação do equipamento SAT. :param str novo_codigo_ativacao...
[ "def", "trocar_codigo_de_ativacao", "(", "self", ",", "novo_codigo_ativacao", ",", "opcao", "=", "constantes", ".", "CODIGO_ATIVACAO_REGULAR", ",", "codigo_emergencia", "=", "None", ")", ":", "if", "not", "novo_codigo_ativacao", ":", "raise", "ValueError", "(", "'No...
Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15. Troca do código de ativação do equipamento SAT. :param str novo_codigo_ativacao: O novo código de ativação escolhido pelo contribuinte. :param int opcao: Indica se deverá ser utilizado o código de ativação ...
[ "Função", "TrocarCodigoDeAtivacao", "conforme", "ER", "SAT", "item", "6", ".", "1", ".", "15", ".", "Troca", "do", "código", "de", "ativação", "do", "equipamento", "SAT", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L483-L545
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.load_forecasts
def load_forecasts(self): """ Loads the forecast files and gathers the forecast information into pandas DataFrames. """ forecast_path = self.forecast_json_path + "/{0}/{1}/".format(self.run_date.strftime("%Y%m%d"), self...
python
def load_forecasts(self): """ Loads the forecast files and gathers the forecast information into pandas DataFrames. """ forecast_path = self.forecast_json_path + "/{0}/{1}/".format(self.run_date.strftime("%Y%m%d"), self...
[ "def", "load_forecasts", "(", "self", ")", ":", "forecast_path", "=", "self", ".", "forecast_json_path", "+", "\"/{0}/{1}/\"", ".", "format", "(", "self", ".", "run_date", ".", "strftime", "(", "\"%Y%m%d\"", ")", ",", "self", ".", "ensemble_member", ")", "fo...
Loads the forecast files and gathers the forecast information into pandas DataFrames.
[ "Loads", "the", "forecast", "files", "and", "gathers", "the", "forecast", "information", "into", "pandas", "DataFrames", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L62-L87
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.load_obs
def load_obs(self): """ Loads the track total and step files and merges the information into a single data frame. """ track_total_file = self.track_data_csv_path + \ "track_total_{0}_{1}_{2}.csv".format(self.ensemble_name, self...
python
def load_obs(self): """ Loads the track total and step files and merges the information into a single data frame. """ track_total_file = self.track_data_csv_path + \ "track_total_{0}_{1}_{2}.csv".format(self.ensemble_name, self...
[ "def", "load_obs", "(", "self", ")", ":", "track_total_file", "=", "self", ".", "track_data_csv_path", "+", "\"track_total_{0}_{1}_{2}.csv\"", ".", "format", "(", "self", ".", "ensemble_name", ",", "self", ".", "ensemble_member", ",", "self", ".", "run_date", "....
Loads the track total and step files and merges the information into a single data frame.
[ "Loads", "the", "track", "total", "and", "step", "files", "and", "merges", "the", "information", "into", "a", "single", "data", "frame", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L89-L106
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.merge_obs
def merge_obs(self): """ Match forecasts and observations. """ for model_type in self.model_types: self.matched_forecasts[model_type] = {} for model_name in self.model_names[model_type]: self.matched_forecasts[model_type][model_name] = pd.merge(sel...
python
def merge_obs(self): """ Match forecasts and observations. """ for model_type in self.model_types: self.matched_forecasts[model_type] = {} for model_name in self.model_names[model_type]: self.matched_forecasts[model_type][model_name] = pd.merge(sel...
[ "def", "merge_obs", "(", "self", ")", ":", "for", "model_type", "in", "self", ".", "model_types", ":", "self", ".", "matched_forecasts", "[", "model_type", "]", "=", "{", "}", "for", "model_name", "in", "self", ".", "model_names", "[", "model_type", "]", ...
Match forecasts and observations.
[ "Match", "forecasts", "and", "observations", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L108-L117
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.crps
def crps(self, model_type, model_name, condition_model_name, condition_threshold, query=None): """ Calculates the cumulative ranked probability score (CRPS) on the forecast data. Args: model_type: model type being evaluated. model_name: machine learning model being evalu...
python
def crps(self, model_type, model_name, condition_model_name, condition_threshold, query=None): """ Calculates the cumulative ranked probability score (CRPS) on the forecast data. Args: model_type: model type being evaluated. model_name: machine learning model being evalu...
[ "def", "crps", "(", "self", ",", "model_type", ",", "model_name", ",", "condition_model_name", ",", "condition_threshold", ",", "query", "=", "None", ")", ":", "def", "gamma_cdf", "(", "x", ",", "a", ",", "loc", ",", "b", ")", ":", "if", "a", "==", "...
Calculates the cumulative ranked probability score (CRPS) on the forecast data. Args: model_type: model type being evaluated. model_name: machine learning model being evaluated. condition_model_name: Name of the hail/no-hail model being evaluated condition_thresh...
[ "Calculates", "the", "cumulative", "ranked", "probability", "score", "(", "CRPS", ")", "on", "the", "forecast", "data", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L119-L168
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.roc
def roc(self, model_type, model_name, intensity_threshold, prob_thresholds, query=None): """ Calculates a ROC curve at a specified intensity threshold. Args: model_type: type of model being evaluated (e.g. size). model_name: machine learning model being evaluated ...
python
def roc(self, model_type, model_name, intensity_threshold, prob_thresholds, query=None): """ Calculates a ROC curve at a specified intensity threshold. Args: model_type: type of model being evaluated (e.g. size). model_name: machine learning model being evaluated ...
[ "def", "roc", "(", "self", ",", "model_type", ",", "model_name", ",", "intensity_threshold", ",", "prob_thresholds", ",", "query", "=", "None", ")", ":", "roc_obj", "=", "DistributedROC", "(", "prob_thresholds", ",", "0.5", ")", "if", "query", "is", "not", ...
Calculates a ROC curve at a specified intensity threshold. Args: model_type: type of model being evaluated (e.g. size). model_name: machine learning model being evaluated intensity_threshold: forecast bin used as the split point for evaluation prob_thresholds: Ar...
[ "Calculates", "a", "ROC", "curve", "at", "a", "specified", "intensity", "threshold", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L170-L207
djgagne/hagelslag
hagelslag/evaluation/ObjectEvaluator.py
ObjectEvaluator.sample_forecast_max_hail
def sample_forecast_max_hail(self, dist_model_name, condition_model_name, num_samples, condition_threshold=0.5, query=None): """ Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes. Hail sizes are sampled from ...
python
def sample_forecast_max_hail(self, dist_model_name, condition_model_name, num_samples, condition_threshold=0.5, query=None): """ Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes. Hail sizes are sampled from ...
[ "def", "sample_forecast_max_hail", "(", "self", ",", "dist_model_name", ",", "condition_model_name", ",", "num_samples", ",", "condition_threshold", "=", "0.5", ",", "query", "=", "None", ")", ":", "if", "query", "is", "not", "None", ":", "dist_forecasts", "=", ...
Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes. Hail sizes are sampled from each predicted gamma distribution. The total number of samples equals num_samples * area of the hail object. To get the maximum hail size for each realization, the maximu...
[ "Samples", "every", "forecast", "hail", "object", "and", "returns", "an", "empirical", "distribution", "of", "possible", "maximum", "hail", "sizes", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L248-L282
paymentwall/paymentwall-python
paymentwall/widget.py
Widget.get_params
def get_params(self): """Get signature and params """ params = { 'key': self.get_app_key(), 'uid': self.user_id, 'widget': self.widget_code } products_number = len(self.products) if self.get_api_type() == self.API_GOODS: ...
python
def get_params(self): """Get signature and params """ params = { 'key': self.get_app_key(), 'uid': self.user_id, 'widget': self.widget_code } products_number = len(self.products) if self.get_api_type() == self.API_GOODS: ...
[ "def", "get_params", "(", "self", ")", ":", "params", "=", "{", "'key'", ":", "self", ".", "get_app_key", "(", ")", ",", "'uid'", ":", "self", ".", "user_id", ",", "'widget'", ":", "self", ".", "widget_code", "}", "products_number", "=", "len", "(", ...
Get signature and params
[ "Get", "signature", "and", "params" ]
train
https://github.com/paymentwall/paymentwall-python/blob/5f65cb4460074787bbf75b8f276ace5ca8480d17/paymentwall/widget.py#L25-L95
base4sistemas/satcfe
satcfe/util.py
hms
def hms(segundos): # TODO: mover para util.py """ Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> hms(3601) ...
python
def hms(segundos): # TODO: mover para util.py """ Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> hms(3601) ...
[ "def", "hms", "(", "segundos", ")", ":", "# TODO: mover para util.py", "h", "=", "(", "segundos", "/", "3600", ")", "m", "=", "(", "segundos", "-", "(", "3600", "*", "h", ")", ")", "/", "60", "s", "=", "(", "segundos", "-", "(", "3600", "*", "h",...
Retorna o número de horas, minutos e segundos a partir do total de segundos informado. .. sourcecode:: python >>> hms(1) (0, 0, 1) >>> hms(60) (0, 1, 0) >>> hms(3600) (1, 0, 0) >>> hms(3601) (1, 0, 1) >>> hms(3661) (1, 1, 1) ...
[ "Retorna", "o", "número", "de", "horas", "minutos", "e", "segundos", "a", "partir", "do", "total", "de", "segundos", "informado", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/util.py#L166-L199
base4sistemas/satcfe
satcfe/util.py
hms_humanizado
def hms_humanizado(segundos): # TODO: mover para util.py """ Retorna um texto legível que descreve o total de horas, minutos e segundos calculados a partir do total de segundos informados. .. sourcecode:: python >>> hms_humanizado(0) 'zero segundos' >>> hms_humanizado(1) ...
python
def hms_humanizado(segundos): # TODO: mover para util.py """ Retorna um texto legível que descreve o total de horas, minutos e segundos calculados a partir do total de segundos informados. .. sourcecode:: python >>> hms_humanizado(0) 'zero segundos' >>> hms_humanizado(1) ...
[ "def", "hms_humanizado", "(", "segundos", ")", ":", "# TODO: mover para util.py", "p", "=", "lambda", "n", ",", "s", ",", "p", ":", "p", "if", "n", ">", "1", "else", "s", "h", ",", "m", ",", "s", "=", "hms", "(", "segundos", ")", "tokens", "=", "...
Retorna um texto legível que descreve o total de horas, minutos e segundos calculados a partir do total de segundos informados. .. sourcecode:: python >>> hms_humanizado(0) 'zero segundos' >>> hms_humanizado(1) '1 segundo' >>> hms_humanizado(2) '2 segundos' ...
[ "Retorna", "um", "texto", "legível", "que", "descreve", "o", "total", "de", "horas", "minutos", "e", "segundos", "calculados", "a", "partir", "do", "total", "de", "segundos", "informados", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/util.py#L202-L245
djgagne/hagelslag
hagelslag/data/HREFv2ModelGrid.py
ModelGrid.format_grib_name
def format_grib_name(self, selected_variable): """ Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations. Args: selected_variable(str): name of selected variable for loading Names: 3: LCDC: Low Cloud Cover 4:...
python
def format_grib_name(self, selected_variable): """ Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations. Args: selected_variable(str): name of selected variable for loading Names: 3: LCDC: Low Cloud Cover 4:...
[ "def", "format_grib_name", "(", "self", ",", "selected_variable", ")", ":", "names", "=", "self", ".", "unknown_names", "units", "=", "self", ".", "unknown_units", "for", "key", ",", "value", "in", "names", ".", "items", "(", ")", ":", "if", "selected_vari...
Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations. Args: selected_variable(str): name of selected variable for loading Names: 3: LCDC: Low Cloud Cover 4: MCDC: Medium Cloud Cover 5: HCDC: High Cloud Cover ...
[ "Assigns", "name", "to", "grib2", "message", "number", "with", "name", "unknown", ".", "Names", "based", "on", "NOAA", "grib2", "abbreviations", ".", "Args", ":", "selected_variable", "(", "str", ")", ":", "name", "of", "selected", "variable", "for", "loadin...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HREFv2ModelGrid.py#L70-L101
djgagne/hagelslag
hagelslag/data/HREFv2ModelGrid.py
ModelGrid.load_data
def load_data(self): """ Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names and grib2 message numbers. Returns: Array of data loaded from files in (time, y, x) dimensions, Units """ file_...
python
def load_data(self): """ Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names and grib2 message numbers. Returns: Array of data loaded from files in (time, y, x) dimensions, Units """ file_...
[ "def", "load_data", "(", "self", ")", ":", "file_objects", "=", "self", ".", "file_objects", "var", "=", "self", ".", "variable", "valid_date", "=", "self", ".", "valid_dates", "data", "=", "self", ".", "data", "unknown_names", "=", "self", ".", "unknown_n...
Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names and grib2 message numbers. Returns: Array of data loaded from files in (time, y, x) dimensions, Units
[ "Loads", "data", "from", "grib2", "file", "objects", "or", "list", "of", "grib2", "file", "objects", ".", "Handles", "specific", "grib2", "variable", "names", "and", "grib2", "message", "numbers", ".", "Returns", ":", "Array", "of", "data", "loaded", "from",...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HREFv2ModelGrid.py#L103-L187
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.load_forecasts
def load_forecasts(self): """ Load the forecast files into memory. """ run_date_str = self.run_date.strftime("%Y%m%d") for model_name in self.model_names: self.raw_forecasts[model_name] = {} forecast_file = self.forecast_path + run_date_str + "/" + \ ...
python
def load_forecasts(self): """ Load the forecast files into memory. """ run_date_str = self.run_date.strftime("%Y%m%d") for model_name in self.model_names: self.raw_forecasts[model_name] = {} forecast_file = self.forecast_path + run_date_str + "/" + \ ...
[ "def", "load_forecasts", "(", "self", ")", ":", "run_date_str", "=", "self", ".", "run_date", ".", "strftime", "(", "\"%Y%m%d\"", ")", "for", "model_name", "in", "self", ".", "model_names", ":", "self", ".", "raw_forecasts", "[", "model_name", "]", "=", "{...
Load the forecast files into memory.
[ "Load", "the", "forecast", "files", "into", "memory", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L77-L92
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.get_window_forecasts
def get_window_forecasts(self): """ Aggregate the forecasts within the specified time windows. """ for model_name in self.model_names: self.window_forecasts[model_name] = {} for size_threshold in self.size_thresholds: self.window_forecasts[model_na...
python
def get_window_forecasts(self): """ Aggregate the forecasts within the specified time windows. """ for model_name in self.model_names: self.window_forecasts[model_name] = {} for size_threshold in self.size_thresholds: self.window_forecasts[model_na...
[ "def", "get_window_forecasts", "(", "self", ")", ":", "for", "model_name", "in", "self", ".", "model_names", ":", "self", ".", "window_forecasts", "[", "model_name", "]", "=", "{", "}", "for", "size_threshold", "in", "self", ".", "size_thresholds", ":", "sel...
Aggregate the forecasts within the specified time windows.
[ "Aggregate", "the", "forecasts", "within", "the", "specified", "time", "windows", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L94-L103
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.load_obs
def load_obs(self, mask_threshold=0.5): """ Loads observations and masking grid (if needed). :param mask_threshold: Values greater than the threshold are kept, others are masked. :return: """ start_date = self.run_date + timedelta(hours=self.start_hour) end_date...
python
def load_obs(self, mask_threshold=0.5): """ Loads observations and masking grid (if needed). :param mask_threshold: Values greater than the threshold are kept, others are masked. :return: """ start_date = self.run_date + timedelta(hours=self.start_hour) end_date...
[ "def", "load_obs", "(", "self", ",", "mask_threshold", "=", "0.5", ")", ":", "start_date", "=", "self", ".", "run_date", "+", "timedelta", "(", "hours", "=", "self", ".", "start_hour", ")", "end_date", "=", "self", ".", "run_date", "+", "timedelta", "(",...
Loads observations and masking grid (if needed). :param mask_threshold: Values greater than the threshold are kept, others are masked. :return:
[ "Loads", "observations", "and", "masking", "grid", "(", "if", "needed", ")", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L105-L125
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.dilate_obs
def dilate_obs(self, dilation_radius): """ Use a dilation filter to grow positive observation areas by a specified number of grid points :param dilation_radius: Number of times to dilate the grid. :return: """ for s in self.size_thresholds: self.dilated_obs[s...
python
def dilate_obs(self, dilation_radius): """ Use a dilation filter to grow positive observation areas by a specified number of grid points :param dilation_radius: Number of times to dilate the grid. :return: """ for s in self.size_thresholds: self.dilated_obs[s...
[ "def", "dilate_obs", "(", "self", ",", "dilation_radius", ")", ":", "for", "s", "in", "self", ".", "size_thresholds", ":", "self", ".", "dilated_obs", "[", "s", "]", "=", "np", ".", "zeros", "(", "self", ".", "window_obs", "[", "self", ".", "mrms_varia...
Use a dilation filter to grow positive observation areas by a specified number of grid points :param dilation_radius: Number of times to dilate the grid. :return:
[ "Use", "a", "dilation", "filter", "to", "grow", "positive", "observation", "areas", "by", "a", "specified", "number", "of", "grid", "points" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L127-L137
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.roc_curves
def roc_curves(self, prob_thresholds): """ Generate ROC Curve objects for each machine learning model, size threshold, and time window. :param prob_thresholds: Probability thresholds for the ROC Curve :param dilation_radius: Number of times to dilate the observation grid. :retur...
python
def roc_curves(self, prob_thresholds): """ Generate ROC Curve objects for each machine learning model, size threshold, and time window. :param prob_thresholds: Probability thresholds for the ROC Curve :param dilation_radius: Number of times to dilate the observation grid. :retur...
[ "def", "roc_curves", "(", "self", ",", "prob_thresholds", ")", ":", "all_roc_curves", "=", "{", "}", "for", "model_name", "in", "self", ".", "model_names", ":", "all_roc_curves", "[", "model_name", "]", "=", "{", "}", "for", "size_threshold", "in", "self", ...
Generate ROC Curve objects for each machine learning model, size threshold, and time window. :param prob_thresholds: Probability thresholds for the ROC Curve :param dilation_radius: Number of times to dilate the observation grid. :return: a dictionary of DistributedROC objects.
[ "Generate", "ROC", "Curve", "objects", "for", "each", "machine", "learning", "model", "size", "threshold", "and", "time", "window", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L139-L167
djgagne/hagelslag
hagelslag/evaluation/GridEvaluator.py
GridEvaluator.reliability_curves
def reliability_curves(self, prob_thresholds): """ Output reliability curves for each machine learning model, size threshold, and time window. :param prob_thresholds: :param dilation_radius: :return: """ all_rel_curves = {} for model_name in self.model_na...
python
def reliability_curves(self, prob_thresholds): """ Output reliability curves for each machine learning model, size threshold, and time window. :param prob_thresholds: :param dilation_radius: :return: """ all_rel_curves = {} for model_name in self.model_na...
[ "def", "reliability_curves", "(", "self", ",", "prob_thresholds", ")", ":", "all_rel_curves", "=", "{", "}", "for", "model_name", "in", "self", ".", "model_names", ":", "all_rel_curves", "[", "model_name", "]", "=", "{", "}", "for", "size_threshold", "in", "...
Output reliability curves for each machine learning model, size threshold, and time window. :param prob_thresholds: :param dilation_radius: :return:
[ "Output", "reliability", "curves", "for", "each", "machine", "learning", "model", "size", "threshold", "and", "time", "window", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L169-L197
djgagne/hagelslag
hagelslag/util/convert_mrms_grids.py
load_map_coordinates
def load_map_coordinates(map_file): """ Loads map coordinates from netCDF or pickle file created by util.makeMapGrids. Args: map_file: Filename for the file containing coordinate information. Returns: Latitude and longitude grids as numpy arrays. """ if map_file[-4:] == ".pkl":...
python
def load_map_coordinates(map_file): """ Loads map coordinates from netCDF or pickle file created by util.makeMapGrids. Args: map_file: Filename for the file containing coordinate information. Returns: Latitude and longitude grids as numpy arrays. """ if map_file[-4:] == ".pkl":...
[ "def", "load_map_coordinates", "(", "map_file", ")", ":", "if", "map_file", "[", "-", "4", ":", "]", "==", "\".pkl\"", ":", "map_data", "=", "pickle", ".", "load", "(", "open", "(", "map_file", ")", ")", "lon", "=", "map_data", "[", "'lon'", "]", "la...
Loads map coordinates from netCDF or pickle file created by util.makeMapGrids. Args: map_file: Filename for the file containing coordinate information. Returns: Latitude and longitude grids as numpy arrays.
[ "Loads", "map", "coordinates", "from", "netCDF", "or", "pickle", "file", "created", "by", "util", ".", "makeMapGrids", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L56-L78
djgagne/hagelslag
hagelslag/util/convert_mrms_grids.py
interpolate_mrms_day
def interpolate_mrms_day(start_date, variable, interp_type, mrms_path, map_filename, out_path): """ For a given day, this module interpolates hourly MRMS data to a specified latitude and longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files. Args: start_date (datet...
python
def interpolate_mrms_day(start_date, variable, interp_type, mrms_path, map_filename, out_path): """ For a given day, this module interpolates hourly MRMS data to a specified latitude and longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files. Args: start_date (datet...
[ "def", "interpolate_mrms_day", "(", "start_date", ",", "variable", ",", "interp_type", ",", "mrms_path", ",", "map_filename", ",", "out_path", ")", ":", "try", ":", "print", "(", "start_date", ",", "variable", ")", "end_date", "=", "start_date", "+", "timedelt...
For a given day, this module interpolates hourly MRMS data to a specified latitude and longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files. Args: start_date (datetime.datetime): Date of data being interpolated variable (str): MRMS variable interp_type (st...
[ "For", "a", "given", "day", "this", "module", "interpolates", "hourly", "MRMS", "data", "to", "a", "specified", "latitude", "and", "longitude", "grid", "and", "saves", "the", "interpolated", "grids", "to", "CF", "-", "compliant", "netCDF4", "files", ".", "Ar...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L81-L113