partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
HardwareSource.grab_next_to_finish
Grabs the next frame to finish and returns it as data and metadata. .. versionadded:: 1.0 :param timeout: The timeout in seconds. Pass None to use default. :return: The list of data and metadata items that were read. :rtype: list of :py:class:`DataAndMetadata` If the view is n...
nion/swift/Facade.py
def grab_next_to_finish(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]: """Grabs the next frame to finish and returns it as data and metadata. .. versionadded:: 1.0 :param timeout: The timeout in seconds. Pass None to use default. :return: The list of data a...
def grab_next_to_finish(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]: """Grabs the next frame to finish and returns it as data and metadata. .. versionadded:: 1.0 :param timeout: The timeout in seconds. Pass None to use default. :return: The list of data a...
[ "Grabs", "the", "next", "frame", "to", "finish", "and", "returns", "it", "as", "data", "and", "metadata", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1823-L1837
[ "def", "grab_next_to_finish", "(", "self", ",", "timeout", ":", "float", "=", "None", ")", "->", "typing", ".", "List", "[", "DataAndMetadata", ".", "DataAndMetadata", "]", ":", "self", ".", "start_playing", "(", ")", "return", "self", ".", "__hardware_sourc...
d43693eaf057b8683b9638e575000f055fede452
train
Instrument.set_control_output
Set the value of a control asynchronously. :param name: The name of the control (string). :param value: The control value (float). :param options: A dict of custom options to pass to the instrument for setting the value. Options are: value_type: local, delta, output. output...
nion/swift/Facade.py
def set_control_output(self, name: str, value: float, *, options: dict=None) -> None: """Set the value of a control asynchronously. :param name: The name of the control (string). :param value: The control value (float). :param options: A dict of custom options to pass to the instrument ...
def set_control_output(self, name: str, value: float, *, options: dict=None) -> None: """Set the value of a control asynchronously. :param name: The name of the control (string). :param value: The control value (float). :param options: A dict of custom options to pass to the instrument ...
[ "Set", "the", "value", "of", "a", "control", "asynchronously", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1911-L1942
[ "def", "set_control_output", "(", "self", ",", "name", ":", "str", ",", "value", ":", "float", ",", "*", ",", "options", ":", "dict", "=", "None", ")", "->", "None", ":", "self", ".", "__instrument", ".", "set_control_output", "(", "name", ",", "value"...
d43693eaf057b8683b9638e575000f055fede452
train
Instrument.get_property_as_float
Return the value of a float property. :return: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_property_as_float(self, name: str) -> float: """Return the value of a float property. :return: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 Scriptable: Yes """ return float(self.__instrument.ge...
def get_property_as_float(self, name: str) -> float: """Return the value of a float property. :return: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 Scriptable: Yes """ return float(self.__instrument.ge...
[ "Return", "the", "value", "of", "a", "float", "property", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1961-L1972
[ "def", "get_property_as_float", "(", "self", ",", "name", ":", "str", ")", "->", "float", ":", "return", "float", "(", "self", ".", "__instrument", ".", "get_property", "(", "name", ")", ")" ]
d43693eaf057b8683b9638e575000f055fede452
train
Instrument.set_property_as_float
Set the value of a float property. :param name: The name of the property (string). :param value: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def set_property_as_float(self, name: str, value: float) -> None: """Set the value of a float property. :param name: The name of the property (string). :param value: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 ...
def set_property_as_float(self, name: str, value: float) -> None: """Set the value of a float property. :param name: The name of the property (string). :param value: The property value (float). Raises exception if property with name doesn't exist. .. versionadded:: 1.0 ...
[ "Set", "the", "value", "of", "a", "float", "property", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1974-L1986
[ "def", "set_property_as_float", "(", "self", ",", "name", ":", "str", ",", "value", ":", "float", ")", "->", "None", ":", "self", ".", "__instrument", ".", "set_property", "(", "name", ",", "float", "(", "value", ")", ")" ]
d43693eaf057b8683b9638e575000f055fede452
train
Library.data_items
Return the list of data items. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def data_items(self) -> typing.List[DataItem]: """Return the list of data items. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [DataItem(data_item) for data_item in self.__document_model.data_items...
def data_items(self) -> typing.List[DataItem]: """Return the list of data items. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [DataItem(data_item) for data_item in self.__document_model.data_items...
[ "Return", "the", "list", "of", "data", "items", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2205-L2214
[ "def", "data_items", "(", "self", ")", "->", "typing", ".", "List", "[", "DataItem", "]", ":", "return", "[", "DataItem", "(", "data_item", ")", "for", "data_item", "in", "self", ".", "__document_model", ".", "data_items", "]" ]
d43693eaf057b8683b9638e575000f055fede452
train
Library.display_items
Return the list of display items. :return: The list of :py:class:`nion.swift.Facade.Display` objects. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def display_items(self) -> typing.List[Display]: """Return the list of display items. :return: The list of :py:class:`nion.swift.Facade.Display` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [Display(display_item) for display_item in self.__document_model.d...
def display_items(self) -> typing.List[Display]: """Return the list of display items. :return: The list of :py:class:`nion.swift.Facade.Display` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [Display(display_item) for display_item in self.__document_model.d...
[ "Return", "the", "list", "of", "display", "items", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2217-L2226
[ "def", "display_items", "(", "self", ")", "->", "typing", ".", "List", "[", "Display", "]", ":", "return", "[", "Display", "(", "display_item", ")", "for", "display_item", "in", "self", ".", "__document_model", ".", "display_items", "]" ]
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_source_data_items
Return the list of data items that are data sources for the data item. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_source_data_items(self, data_item: DataItem) -> typing.List[DataItem]: """Return the list of data items that are data sources for the data item. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ retur...
def get_source_data_items(self, data_item: DataItem) -> typing.List[DataItem]: """Return the list of data items that are data sources for the data item. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ retur...
[ "Return", "the", "list", "of", "data", "items", "that", "are", "data", "sources", "for", "the", "data", "item", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2228-L2237
[ "def", "get_source_data_items", "(", "self", ",", "data_item", ":", "DataItem", ")", "->", "typing", ".", "List", "[", "DataItem", "]", ":", "return", "[", "DataItem", "(", "data_item", ")", "for", "data_item", "in", "self", ".", "_document_model", ".", "g...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_dependent_data_items
Return the dependent data items the data item argument. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_dependent_data_items(self, data_item: DataItem) -> typing.List[DataItem]: """Return the dependent data items the data item argument. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [DataItem(...
def get_dependent_data_items(self, data_item: DataItem) -> typing.List[DataItem]: """Return the dependent data items the data item argument. :return: The list of :py:class:`nion.swift.Facade.DataItem` objects. .. versionadded:: 1.0 Scriptable: Yes """ return [DataItem(...
[ "Return", "the", "dependent", "data", "items", "the", "data", "item", "argument", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2239-L2248
[ "def", "get_dependent_data_items", "(", "self", ",", "data_item", ":", "DataItem", ")", "->", "typing", ".", "List", "[", "DataItem", "]", ":", "return", "[", "DataItem", "(", "data_item", ")", "for", "data_item", "in", "self", ".", "_document_model", ".", ...
d43693eaf057b8683b9638e575000f055fede452
train
Library.create_data_item
Create an empty data item in the library. :param title: The title of the data item (optional). :return: The new :py:class:`nion.swift.Facade.DataItem` object. :rtype: :py:class:`nion.swift.Facade.DataItem` .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def create_data_item(self, title: str=None) -> DataItem: """Create an empty data item in the library. :param title: The title of the data item (optional). :return: The new :py:class:`nion.swift.Facade.DataItem` object. :rtype: :py:class:`nion.swift.Facade.DataItem` .. versionad...
def create_data_item(self, title: str=None) -> DataItem: """Create an empty data item in the library. :param title: The title of the data item (optional). :return: The new :py:class:`nion.swift.Facade.DataItem` object. :rtype: :py:class:`nion.swift.Facade.DataItem` .. versionad...
[ "Create", "an", "empty", "data", "item", "in", "the", "library", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2250-L2266
[ "def", "create_data_item", "(", "self", ",", "title", ":", "str", "=", "None", ")", "->", "DataItem", ":", "data_item", "=", "DataItemModule", ".", "DataItem", "(", ")", "data_item", ".", "ensure_data_source", "(", ")", "if", "title", "is", "not", "None", ...
d43693eaf057b8683b9638e575000f055fede452
train
Library.create_data_item_from_data
Create a data item in the library from an ndarray. The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, create an empty data item and use the data item methods to modify the data. :param d...
nion/swift/Facade.py
def create_data_item_from_data(self, data: numpy.ndarray, title: str=None) -> DataItem: """Create a data item in the library from an ndarray. The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, cr...
def create_data_item_from_data(self, data: numpy.ndarray, title: str=None) -> DataItem: """Create a data item in the library from an ndarray. The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, cr...
[ "Create", "a", "data", "item", "in", "the", "library", "from", "an", "ndarray", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2268-L2284
[ "def", "create_data_item_from_data", "(", "self", ",", "data", ":", "numpy", ".", "ndarray", ",", "title", ":", "str", "=", "None", ")", "->", "DataItem", ":", "return", "self", ".", "create_data_item_from_data_and_metadata", "(", "DataAndMetadata", ".", "DataAn...
d43693eaf057b8683b9638e575000f055fede452
train
Library.create_data_item_from_data_and_metadata
Create a data item in the library from a data and metadata object. The data for the data item will be written to disk immediately and unloaded from memory. If you wish to delay writing to disk and keep using the data, create an empty data item and use the data item methods to modify the data. ...
nion/swift/Facade.py
def create_data_item_from_data_and_metadata(self, data_and_metadata: DataAndMetadata.DataAndMetadata, title: str=None) -> DataItem: """Create a data item in the library from a data and metadata object. The data for the data item will be written to disk immediately and unloaded from memory. If you wish ...
def create_data_item_from_data_and_metadata(self, data_and_metadata: DataAndMetadata.DataAndMetadata, title: str=None) -> DataItem: """Create a data item in the library from a data and metadata object. The data for the data item will be written to disk immediately and unloaded from memory. If you wish ...
[ "Create", "a", "data", "item", "in", "the", "library", "from", "a", "data", "and", "metadata", "object", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2286-L2306
[ "def", "create_data_item_from_data_and_metadata", "(", "self", ",", "data_and_metadata", ":", "DataAndMetadata", ".", "DataAndMetadata", ",", "title", ":", "str", "=", "None", ")", "->", "DataItem", ":", "data_item", "=", "DataItemModule", ".", "new_data_item", "(",...
d43693eaf057b8683b9638e575000f055fede452
train
Library.copy_data_item
Copy a data item. .. versionadded:: 1.0 Scriptable: No
nion/swift/Facade.py
def copy_data_item(self, data_item: DataItem) -> DataItem: """Copy a data item. .. versionadded:: 1.0 Scriptable: No """ data_item = copy.deepcopy(data_item._data_item) self.__document_model.append_data_item(data_item) return DataItem(data_item)
def copy_data_item(self, data_item: DataItem) -> DataItem: """Copy a data item. .. versionadded:: 1.0 Scriptable: No """ data_item = copy.deepcopy(data_item._data_item) self.__document_model.append_data_item(data_item) return DataItem(data_item)
[ "Copy", "a", "data", "item", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2308-L2317
[ "def", "copy_data_item", "(", "self", ",", "data_item", ":", "DataItem", ")", "->", "DataItem", ":", "data_item", "=", "copy", ".", "deepcopy", "(", "data_item", ".", "_data_item", ")", "self", ".", "__document_model", ".", "append_data_item", "(", "data_item"...
d43693eaf057b8683b9638e575000f055fede452
train
Library.snapshot_data_item
Snapshot a data item. Similar to copy but with a data snapshot. .. versionadded:: 1.0 Scriptable: No
nion/swift/Facade.py
def snapshot_data_item(self, data_item: DataItem) -> DataItem: """Snapshot a data item. Similar to copy but with a data snapshot. .. versionadded:: 1.0 Scriptable: No """ data_item = data_item._data_item.snapshot() self.__document_model.append_data_item(data_item) ...
def snapshot_data_item(self, data_item: DataItem) -> DataItem: """Snapshot a data item. Similar to copy but with a data snapshot. .. versionadded:: 1.0 Scriptable: No """ data_item = data_item._data_item.snapshot() self.__document_model.append_data_item(data_item) ...
[ "Snapshot", "a", "data", "item", ".", "Similar", "to", "copy", "but", "with", "a", "data", "snapshot", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2319-L2328
[ "def", "snapshot_data_item", "(", "self", ",", "data_item", ":", "DataItem", ")", "->", "DataItem", ":", "data_item", "=", "data_item", ".", "_data_item", ".", "snapshot", "(", ")", "self", ".", "__document_model", ".", "append_data_item", "(", "data_item", ")...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_or_create_data_group
Get (or create) a data group. :param title: The title of the data group. :return: The new :py:class:`nion.swift.Facade.DataGroup` object. :rtype: :py:class:`nion.swift.Facade.DataGroup` .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_or_create_data_group(self, title: str) -> DataGroup: """Get (or create) a data group. :param title: The title of the data group. :return: The new :py:class:`nion.swift.Facade.DataGroup` object. :rtype: :py:class:`nion.swift.Facade.DataGroup` .. versionadded:: 1.0 ...
def get_or_create_data_group(self, title: str) -> DataGroup: """Get (or create) a data group. :param title: The title of the data group. :return: The new :py:class:`nion.swift.Facade.DataGroup` object. :rtype: :py:class:`nion.swift.Facade.DataGroup` .. versionadded:: 1.0 ...
[ "Get", "(", "or", "create", ")", "a", "data", "group", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2330-L2341
[ "def", "get_or_create_data_group", "(", "self", ",", "title", ":", "str", ")", "->", "DataGroup", ":", "return", "DataGroup", "(", "self", ".", "__document_model", ".", "get_or_create_data_group", "(", "title", ")", ")" ]
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_data_item_for_hardware_source
Get the data item associated with hardware source and (optional) channel id and processor_id. Optionally create if missing. :param hardware_source: The hardware_source. :param channel_id: The (optional) channel id. :param processor_id: The (optional) processor id for the channel. :param...
nion/swift/Facade.py
def get_data_item_for_hardware_source(self, hardware_source, channel_id: str=None, processor_id: str=None, create_if_needed: bool=False, large_format: bool=False) -> DataItem: """Get the data item associated with hardware source and (optional) channel id and processor_id. Optionally create if missing. ...
def get_data_item_for_hardware_source(self, hardware_source, channel_id: str=None, processor_id: str=None, create_if_needed: bool=False, large_format: bool=False) -> DataItem: """Get the data item associated with hardware source and (optional) channel id and processor_id. Optionally create if missing. ...
[ "Get", "the", "data", "item", "associated", "with", "hardware", "source", "and", "(", "optional", ")", "channel", "id", "and", "processor_id", ".", "Optionally", "create", "if", "missing", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2376-L2394
[ "def", "get_data_item_for_hardware_source", "(", "self", ",", "hardware_source", ",", "channel_id", ":", "str", "=", "None", ",", "processor_id", ":", "str", "=", "None", ",", "create_if_needed", ":", "bool", "=", "False", ",", "large_format", ":", "bool", "="...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_data_item_for_reference_key
Get the data item associated with data item reference key. Optionally create if missing. :param data_item_reference_key: The data item reference key. :param create_if_needed: Whether to create a new data item if none is found. :return: The associated data item. May be None. .. versiona...
nion/swift/Facade.py
def get_data_item_for_reference_key(self, data_item_reference_key: str=None, create_if_needed: bool=False, large_format: bool=False) -> DataItem: """Get the data item associated with data item reference key. Optionally create if missing. :param data_item_reference_key: The data item reference key. ...
def get_data_item_for_reference_key(self, data_item_reference_key: str=None, create_if_needed: bool=False, large_format: bool=False) -> DataItem: """Get the data item associated with data item reference key. Optionally create if missing. :param data_item_reference_key: The data item reference key. ...
[ "Get", "the", "data", "item", "associated", "with", "data", "item", "reference", "key", ".", "Optionally", "create", "if", "missing", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2396-L2418
[ "def", "get_data_item_for_reference_key", "(", "self", ",", "data_item_reference_key", ":", "str", "=", "None", ",", "create_if_needed", ":", "bool", "=", "False", ",", "large_format", ":", "bool", "=", "False", ")", "->", "DataItem", ":", "document_model", "=",...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_data_item_by_uuid
Get the data item with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes
nion/swift/Facade.py
def get_data_item_by_uuid(self, data_item_uuid: uuid_module.UUID) -> DataItem: """Get the data item with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ data_item = self._document_model.get_data_item_by_uuid(data_item_uuid) return D...
def get_data_item_by_uuid(self, data_item_uuid: uuid_module.UUID) -> DataItem: """Get the data item with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ data_item = self._document_model.get_data_item_by_uuid(data_item_uuid) return D...
[ "Get", "the", "data", "item", "with", "the", "given", "UUID", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2420-L2429
[ "def", "get_data_item_by_uuid", "(", "self", ",", "data_item_uuid", ":", "uuid_module", ".", "UUID", ")", "->", "DataItem", ":", "data_item", "=", "self", ".", "_document_model", ".", "get_data_item_by_uuid", "(", "data_item_uuid", ")", "return", "DataItem", "(", ...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_graphic_by_uuid
Get the graphic with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes
nion/swift/Facade.py
def get_graphic_by_uuid(self, graphic_uuid: uuid_module.UUID) -> Graphic: """Get the graphic with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ for display_item in self._document_model.display_items: for graphic in display_ite...
def get_graphic_by_uuid(self, graphic_uuid: uuid_module.UUID) -> Graphic: """Get the graphic with the given UUID. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ for display_item in self._document_model.display_items: for graphic in display_ite...
[ "Get", "the", "graphic", "with", "the", "given", "UUID", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2431-L2443
[ "def", "get_graphic_by_uuid", "(", "self", ",", "graphic_uuid", ":", "uuid_module", ".", "UUID", ")", "->", "Graphic", ":", "for", "display_item", "in", "self", ".", "_document_model", ".", "display_items", ":", "for", "graphic", "in", "display_item", ".", "gr...
d43693eaf057b8683b9638e575000f055fede452
train
Library.has_library_value
Return whether the library value for the given key exists. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def has_library_value(self, key: str) -> bool: """Return whether the library value for the given key exists. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) ...
def has_library_value(self, key: str) -> bool: """Return whether the library value for the given key exists. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) ...
[ "Return", "whether", "the", "library", "value", "for", "the", "given", "key", "exists", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2445-L2458
[ "def", "has_library_value", "(", "self", ",", "key", ":", "str", ")", "->", "bool", ":", "desc", "=", "Metadata", ".", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "field_id", "=", "desc", "[", "'path'", "]"...
d43693eaf057b8683b9638e575000f055fede452
train
Library.get_library_value
Get the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_library_value(self, key: str) -> typing.Any: """Get the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) if desc is n...
def get_library_value(self, key: str) -> typing.Any: """Get the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) if desc is n...
[ "Get", "the", "library", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2460-L2473
[ "def", "get_library_value", "(", "self", ",", "key", ":", "str", ")", "->", "typing", ".", "Any", ":", "desc", "=", "Metadata", ".", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "field_id", "=", "desc", "[",...
d43693eaf057b8683b9638e575000f055fede452
train
Library.set_library_value
Set the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def set_library_value(self, key: str, value: typing.Any) -> None: """Set the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) ...
def set_library_value(self, key: str, value: typing.Any) -> None: """Set the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) ...
[ "Set", "the", "library", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2475-L2489
[ "def", "set_library_value", "(", "self", ",", "key", ":", "str", ",", "value", ":", "typing", ".", "Any", ")", "->", "None", ":", "desc", "=", "Metadata", ".", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", ...
d43693eaf057b8683b9638e575000f055fede452
train
Library.delete_library_value
Delete the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def delete_library_value(self, key: str) -> None: """Delete the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) if desc is n...
def delete_library_value(self, key: str) -> None: """Delete the library value for the given key. Please consult the developer documentation for a list of valid keys. .. versionadded:: 1.0 Scriptable: Yes """ desc = Metadata.session_key_map.get(key) if desc is n...
[ "Delete", "the", "library", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2491-L2505
[ "def", "delete_library_value", "(", "self", ",", "key", ":", "str", ")", "->", "None", ":", "desc", "=", "Metadata", ".", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "field_id", "=", "desc", "[", "'path'", ...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.all_display_panels
Return the list of display panels currently visible. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def all_display_panels(self) -> typing.List[DisplayPanel]: """Return the list of display panels currently visible. .. versionadded:: 1.0 Scriptable: Yes """ return [DisplayPanel(display_panel) for display_panel in self.__document_controller.workspace_controller.display_panels]
def all_display_panels(self) -> typing.List[DisplayPanel]: """Return the list of display panels currently visible. .. versionadded:: 1.0 Scriptable: Yes """ return [DisplayPanel(display_panel) for display_panel in self.__document_controller.workspace_controller.display_panels]
[ "Return", "the", "list", "of", "display", "panels", "currently", "visible", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2585-L2592
[ "def", "all_display_panels", "(", "self", ")", "->", "typing", ".", "List", "[", "DisplayPanel", "]", ":", "return", "[", "DisplayPanel", "(", "display_panel", ")", "for", "display_panel", "in", "self", ".", "__document_controller", ".", "workspace_controller", ...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.get_display_panel_by_id
Return display panel with the identifier. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes
nion/swift/Facade.py
def get_display_panel_by_id(self, identifier: str) -> DisplayPanel: """Return display panel with the identifier. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ display_panel = next( (display_panel for display_panel in self.__document_controlle...
def get_display_panel_by_id(self, identifier: str) -> DisplayPanel: """Return display panel with the identifier. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ display_panel = next( (display_panel for display_panel in self.__document_controlle...
[ "Return", "display", "panel", "with", "the", "identifier", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2594-L2605
[ "def", "get_display_panel_by_id", "(", "self", ",", "identifier", ":", "str", ")", "->", "DisplayPanel", ":", "display_panel", "=", "next", "(", "(", "display_panel", "for", "display_panel", "in", "self", ".", "__document_controller", ".", "workspace_controller", ...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.display_data_item
Display a new data item and gives it keyboard focus. Uses existing display if it is already displayed. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes
nion/swift/Facade.py
def display_data_item(self, data_item: DataItem, source_display_panel=None, source_data_item=None): """Display a new data item and gives it keyboard focus. Uses existing display if it is already displayed. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ fo...
def display_data_item(self, data_item: DataItem, source_display_panel=None, source_data_item=None): """Display a new data item and gives it keyboard focus. Uses existing display if it is already displayed. .. versionadded:: 1.0 Status: Provisional Scriptable: Yes """ fo...
[ "Display", "a", "new", "data", "item", "and", "gives", "it", "keyboard", "focus", ".", "Uses", "existing", "display", "if", "it", "is", "already", "displayed", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2607-L2625
[ "def", "display_data_item", "(", "self", ",", "data_item", ":", "DataItem", ",", "source_display_panel", "=", "None", ",", "source_data_item", "=", "None", ")", ":", "for", "display_panel", "in", "self", ".", "__document_controller", ".", "workspace_controller", "...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.show_get_string_message_box
Show a dialog box and ask for a string. Caption describes the user prompt. Text is the initial/default string. Accepted function must be a function taking one argument which is the resulting text if the user accepts the message dialog. It will only be called if the user clicks OK. Rej...
nion/swift/Facade.py
def show_get_string_message_box(self, caption: str, text: str, accepted_fn, rejected_fn=None, accepted_text: str=None, rejected_text: str=None) -> None: """Show a dialog box and ask for a string. Caption describes the user prompt. Text is the initial/default string. Accepted function must be a...
def show_get_string_message_box(self, caption: str, text: str, accepted_fn, rejected_fn=None, accepted_text: str=None, rejected_text: str=None) -> None: """Show a dialog box and ask for a string. Caption describes the user prompt. Text is the initial/default string. Accepted function must be a...
[ "Show", "a", "dialog", "box", "and", "ask", "for", "a", "string", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2644-L2659
[ "def", "show_get_string_message_box", "(", "self", ",", "caption", ":", "str", ",", "text", ":", "str", ",", "accepted_fn", ",", "rejected_fn", "=", "None", ",", "accepted_text", ":", "str", "=", "None", ",", "rejected_text", ":", "str", "=", "None", ")", ...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.create_data_item_from_data
Create a data item in the library from data. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No
nion/swift/Facade.py
def create_data_item_from_data(self, data: numpy.ndarray, title: str=None) -> DataItem: """Create a data item in the library from data. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No ...
def create_data_item_from_data(self, data: numpy.ndarray, title: str=None) -> DataItem: """Create a data item in the library from data. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No ...
[ "Create", "a", "data", "item", "in", "the", "library", "from", "data", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2685-L2694
[ "def", "create_data_item_from_data", "(", "self", ",", "data", ":", "numpy", ".", "ndarray", ",", "title", ":", "str", "=", "None", ")", "->", "DataItem", ":", "return", "DataItem", "(", "self", ".", "__document_controller", ".", "add_data", "(", "data", "...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.create_data_item_from_data_and_metadata
Create a data item in the library from the data and metadata. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data_and_metadata` instead. Scriptable: No
nion/swift/Facade.py
def create_data_item_from_data_and_metadata(self, data_and_metadata: DataAndMetadata.DataAndMetadata, title: str=None) -> DataItem: """Create a data item in the library from the data and metadata. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.crea...
def create_data_item_from_data_and_metadata(self, data_and_metadata: DataAndMetadata.DataAndMetadata, title: str=None) -> DataItem: """Create a data item in the library from the data and metadata. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.crea...
[ "Create", "a", "data", "item", "in", "the", "library", "from", "the", "data", "and", "metadata", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2696-L2709
[ "def", "create_data_item_from_data_and_metadata", "(", "self", ",", "data_and_metadata", ":", "DataAndMetadata", ".", "DataAndMetadata", ",", "title", ":", "str", "=", "None", ")", "->", "DataItem", ":", "data_item", "=", "DataItemModule", ".", "new_data_item", "(",...
d43693eaf057b8683b9638e575000f055fede452
train
DocumentWindow.get_or_create_data_group
Get (or create) a data group. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No
nion/swift/Facade.py
def get_or_create_data_group(self, title: str) -> DataGroup: """Get (or create) a data group. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No """ return DataGroup(self.__do...
def get_or_create_data_group(self, title: str) -> DataGroup: """Get (or create) a data group. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.Library.create_data_item_from_data` instead. Scriptable: No """ return DataGroup(self.__do...
[ "Get", "(", "or", "create", ")", "a", "data", "group", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2711-L2720
[ "def", "get_or_create_data_group", "(", "self", ",", "title", ":", "str", ")", "->", "DataGroup", ":", "return", "DataGroup", "(", "self", ".", "__document_controller", ".", "document_model", ".", "get_or_create_data_group", "(", "title", ")", ")" ]
d43693eaf057b8683b9638e575000f055fede452
train
Application.document_windows
Return the document windows. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def document_windows(self) -> typing.List[DocumentWindow]: """Return the document windows. .. versionadded:: 1.0 Scriptable: Yes """ return [DocumentWindow(document_controller) for document_controller in self.__application.document_controllers]
def document_windows(self) -> typing.List[DocumentWindow]: """Return the document windows. .. versionadded:: 1.0 Scriptable: Yes """ return [DocumentWindow(document_controller) for document_controller in self.__application.document_controllers]
[ "Return", "the", "document", "windows", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2761-L2768
[ "def", "document_windows", "(", "self", ")", "->", "typing", ".", "List", "[", "DocumentWindow", "]", ":", "return", "[", "DocumentWindow", "(", "document_controller", ")", "for", "document_controller", "in", "self", ".", "__application", ".", "document_controller...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_calibration
Create a calibration object with offset, scale, and units. :param offset: The offset of the calibration. :param scale: The scale of the calibration. :param units: The units of the calibration as a string. :return: The calibration object. .. versionadded:: 1.0 Scriptabl...
nion/swift/Facade.py
def create_calibration(self, offset: float=None, scale: float=None, units: str=None) -> CalibrationModule.Calibration: """Create a calibration object with offset, scale, and units. :param offset: The offset of the calibration. :param scale: The scale of the calibration. :param units: Th...
def create_calibration(self, offset: float=None, scale: float=None, units: str=None) -> CalibrationModule.Calibration: """Create a calibration object with offset, scale, and units. :param offset: The offset of the calibration. :param scale: The scale of the calibration. :param units: Th...
[ "Create", "a", "calibration", "object", "with", "offset", "scale", "and", "units", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2895-L2910
[ "def", "create_calibration", "(", "self", ",", "offset", ":", "float", "=", "None", ",", "scale", ":", "float", "=", "None", ",", "units", ":", "str", "=", "None", ")", "->", "CalibrationModule", ".", "Calibration", ":", "return", "CalibrationModule", ".",...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_data_descriptor
Create a data descriptor. :param is_sequence: whether the descriptor describes a sequence of data. :param collection_dimension_count: the number of collection dimensions represented by the descriptor. :param datum_dimension_count: the number of datum dimensions represented by the descriptor. ...
nion/swift/Facade.py
def create_data_descriptor(self, is_sequence: bool, collection_dimension_count: int, datum_dimension_count: int) -> DataAndMetadata.DataDescriptor: """Create a data descriptor. :param is_sequence: whether the descriptor describes a sequence of data. :param collection_dimension_count: the number...
def create_data_descriptor(self, is_sequence: bool, collection_dimension_count: int, datum_dimension_count: int) -> DataAndMetadata.DataDescriptor: """Create a data descriptor. :param is_sequence: whether the descriptor describes a sequence of data. :param collection_dimension_count: the number...
[ "Create", "a", "data", "descriptor", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2912-L2923
[ "def", "create_data_descriptor", "(", "self", ",", "is_sequence", ":", "bool", ",", "collection_dimension_count", ":", "int", ",", "datum_dimension_count", ":", "int", ")", "->", "DataAndMetadata", ".", "DataDescriptor", ":", "return", "DataAndMetadata", ".", "DataD...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_data_and_metadata
Create a data_and_metadata object from data. :param data: an ndarray of data. :param intensity_calibration: An optional calibration object. :param dimensional_calibrations: An optional list of calibration objects. :param metadata: A dict of metadata. :param timestamp: A datetime...
nion/swift/Facade.py
def create_data_and_metadata(self, data: numpy.ndarray, intensity_calibration: CalibrationModule.Calibration = None, dimensional_calibrations: typing.List[CalibrationModule.Calibration] = None, metadata: dict = None, timestamp: str = None, data_descripto...
def create_data_and_metadata(self, data: numpy.ndarray, intensity_calibration: CalibrationModule.Calibration = None, dimensional_calibrations: typing.List[CalibrationModule.Calibration] = None, metadata: dict = None, timestamp: str = None, data_descripto...
[ "Create", "a", "data_and_metadata", "object", "from", "data", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2925-L2941
[ "def", "create_data_and_metadata", "(", "self", ",", "data", ":", "numpy", ".", "ndarray", ",", "intensity_calibration", ":", "CalibrationModule", ".", "Calibration", "=", "None", ",", "dimensional_calibrations", ":", "typing", ".", "List", "[", "CalibrationModule",...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_data_and_metadata_from_data
Create a data_and_metadata object from data. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.DataItem.create_data_and_metadata` instead. Scriptable: No
nion/swift/Facade.py
def create_data_and_metadata_from_data(self, data: numpy.ndarray, intensity_calibration: CalibrationModule.Calibration=None, dimensional_calibrations: typing.List[CalibrationModule.Calibration]=None, metadata: dict=None, timestamp: str=None) -> DataAndMetadata.DataAndMetadata: """Create a data_and_metadata obje...
def create_data_and_metadata_from_data(self, data: numpy.ndarray, intensity_calibration: CalibrationModule.Calibration=None, dimensional_calibrations: typing.List[CalibrationModule.Calibration]=None, metadata: dict=None, timestamp: str=None) -> DataAndMetadata.DataAndMetadata: """Create a data_and_metadata obje...
[ "Create", "a", "data_and_metadata", "object", "from", "data", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2943-L2952
[ "def", "create_data_and_metadata_from_data", "(", "self", ",", "data", ":", "numpy", ".", "ndarray", ",", "intensity_calibration", ":", "CalibrationModule", ".", "Calibration", "=", "None", ",", "dimensional_calibrations", ":", "typing", ".", "List", "[", "Calibrati...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_data_and_metadata_io_handler
Create an I/O handler that reads and writes a single data_and_metadata. :param io_handler_delegate: A delegate object :py:class:`DataAndMetadataIOHandlerInterface` .. versionadded:: 1.0 Scriptable: No
nion/swift/Facade.py
def create_data_and_metadata_io_handler(self, io_handler_delegate): """Create an I/O handler that reads and writes a single data_and_metadata. :param io_handler_delegate: A delegate object :py:class:`DataAndMetadataIOHandlerInterface` .. versionadded:: 1.0 Scriptable: No """ ...
def create_data_and_metadata_io_handler(self, io_handler_delegate): """Create an I/O handler that reads and writes a single data_and_metadata. :param io_handler_delegate: A delegate object :py:class:`DataAndMetadataIOHandlerInterface` .. versionadded:: 1.0 Scriptable: No """ ...
[ "Create", "an", "I", "/", "O", "handler", "that", "reads", "and", "writes", "a", "single", "data_and_metadata", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2954-L3008
[ "def", "create_data_and_metadata_io_handler", "(", "self", ",", "io_handler_delegate", ")", ":", "class", "DelegateIOHandler", "(", "ImportExportManager", ".", "ImportExportHandler", ")", ":", "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__in...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.create_panel
Create a utility panel that can be attached to a window. .. versionadded:: 1.0 Scriptable: No The panel_delegate should respond to the following: (property, read-only) panel_id (property, read-only) panel_name (property, read-only) panel_positions (a list ...
nion/swift/Facade.py
def create_panel(self, panel_delegate): """Create a utility panel that can be attached to a window. .. versionadded:: 1.0 Scriptable: No The panel_delegate should respond to the following: (property, read-only) panel_id (property, read-only) panel_name ...
def create_panel(self, panel_delegate): """Create a utility panel that can be attached to a window. .. versionadded:: 1.0 Scriptable: No The panel_delegate should respond to the following: (property, read-only) panel_id (property, read-only) panel_name ...
[ "Create", "a", "utility", "panel", "that", "can", "be", "attached", "to", "a", "window", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3107-L3155
[ "def", "create_panel", "(", "self", ",", "panel_delegate", ")", ":", "panel_id", "=", "panel_delegate", ".", "panel_id", "panel_name", "=", "panel_delegate", ".", "panel_name", "panel_positions", "=", "getattr", "(", "panel_delegate", ",", "\"panel_positions\"", ","...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.get_hardware_source_by_id
Return the hardware source API matching the hardware_source_id and version. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def get_hardware_source_by_id(self, hardware_source_id: str, version: str): """Return the hardware source API matching the hardware_source_id and version. .. versionadded:: 1.0 Scriptable: Yes """ actual_version = "1.0.0" if Utility.compare_versions(version, actual_vers...
def get_hardware_source_by_id(self, hardware_source_id: str, version: str): """Return the hardware source API matching the hardware_source_id and version. .. versionadded:: 1.0 Scriptable: Yes """ actual_version = "1.0.0" if Utility.compare_versions(version, actual_vers...
[ "Return", "the", "hardware", "source", "API", "matching", "the", "hardware_source_id", "and", "version", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3166-L3177
[ "def", "get_hardware_source_by_id", "(", "self", ",", "hardware_source_id", ":", "str", ",", "version", ":", "str", ")", ":", "actual_version", "=", "\"1.0.0\"", "if", "Utility", ".", "compare_versions", "(", "version", ",", "actual_version", ")", ">", "0", ":...
d43693eaf057b8683b9638e575000f055fede452
train
API_1.library
Return the library object. .. versionadded:: 1.0 Scriptable: Yes
nion/swift/Facade.py
def library(self) -> Library: """Return the library object. .. versionadded:: 1.0 Scriptable: Yes """ assert self.__app.document_model return Library(self.__app.document_model)
def library(self) -> Library: """Return the library object. .. versionadded:: 1.0 Scriptable: Yes """ assert self.__app.document_model return Library(self.__app.document_model)
[ "Return", "the", "library", "object", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3197-L3205
[ "def", "library", "(", "self", ")", "->", "Library", ":", "assert", "self", ".", "__app", ".", "document_model", "return", "Library", "(", "self", ".", "__app", ".", "document_model", ")" ]
d43693eaf057b8683b9638e575000f055fede452
train
make_cost_matrix
Create a cost matrix from a profit matrix by calling 'inversion_function' to invert each value. The inversion function must take one numeric argument (of any type) and return another numeric argument which is presumed to be the cost inverse of the original profit. This is a static method. Call it l...
hagelslag/util/munkres.py
def make_cost_matrix(profit_matrix, inversion_function): """ Create a cost matrix from a profit matrix by calling 'inversion_function' to invert each value. The inversion function must take one numeric argument (of any type) and return another numeric argument which is presumed to be the cost invers...
def make_cost_matrix(profit_matrix, inversion_function): """ Create a cost matrix from a profit matrix by calling 'inversion_function' to invert each value. The inversion function must take one numeric argument (of any type) and return another numeric argument which is presumed to be the cost invers...
[ "Create", "a", "cost", "matrix", "from", "a", "profit", "matrix", "by", "calling", "inversion_function", "to", "invert", "each", "value", ".", "The", "inversion", "function", "must", "take", "one", "numeric", "argument", "(", "of", "any", "type", ")", "and",...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L676-L709
[ "def", "make_cost_matrix", "(", "profit_matrix", ",", "inversion_function", ")", ":", "cost_matrix", "=", "[", "]", "for", "row", "in", "profit_matrix", ":", "cost_matrix", ".", "append", "(", "[", "inversion_function", "(", "value", ")", "for", "value", "in",...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
print_matrix
Convenience function: Displays the contents of a matrix of integers. :Parameters: matrix : list of lists Matrix to print msg : str Optional message to print before displaying the matrix
hagelslag/util/munkres.py
def print_matrix(matrix, msg=None): """ Convenience function: Displays the contents of a matrix of integers. :Parameters: matrix : list of lists Matrix to print msg : str Optional message to print before displaying the matrix """ import math if msg is n...
def print_matrix(matrix, msg=None): """ Convenience function: Displays the contents of a matrix of integers. :Parameters: matrix : list of lists Matrix to print msg : str Optional message to print before displaying the matrix """ import math if msg is n...
[ "Convenience", "function", ":", "Displays", "the", "contents", "of", "a", "matrix", "of", "integers", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L711-L742
[ "def", "print_matrix", "(", "matrix", ",", "msg", "=", "None", ")", ":", "import", "math", "if", "msg", "is", "not", "None", ":", "print", "(", "msg", ")", "# Calculate the appropriate format width.", "width", "=", "0", "for", "row", "in", "matrix", ":", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.pad_matrix
Pad a possibly non-square matrix to make it square. :Parameters: matrix : list of lists matrix to pad pad_value : int value to use to pad the matrix :rtype: list of lists :return: a new, possibly padded, matrix
hagelslag/util/munkres.py
def pad_matrix(self, matrix, pad_value=0): """ Pad a possibly non-square matrix to make it square. :Parameters: matrix : list of lists matrix to pad pad_value : int value to use to pad the matrix :rtype: list of lists :re...
def pad_matrix(self, matrix, pad_value=0): """ Pad a possibly non-square matrix to make it square. :Parameters: matrix : list of lists matrix to pad pad_value : int value to use to pad the matrix :rtype: list of lists :re...
[ "Pad", "a", "possibly", "non", "-", "square", "matrix", "to", "make", "it", "square", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L331-L365
[ "def", "pad_matrix", "(", "self", ",", "matrix", ",", "pad_value", "=", "0", ")", ":", "max_columns", "=", "0", "total_rows", "=", "len", "(", "matrix", ")", "for", "row", "in", "matrix", ":", "max_columns", "=", "max", "(", "max_columns", ",", "len", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.compute
Compute the indexes for the lowest-cost pairings between rows and columns in the database. Returns a list of (row, column) tuples that can be used to traverse the matrix. :Parameters: cost_matrix : list of lists The cost matrix. If this cost matrix is not square, it ...
hagelslag/util/munkres.py
def compute(self, cost_matrix): """ Compute the indexes for the lowest-cost pairings between rows and columns in the database. Returns a list of (row, column) tuples that can be used to traverse the matrix. :Parameters: cost_matrix : list of lists The...
def compute(self, cost_matrix): """ Compute the indexes for the lowest-cost pairings between rows and columns in the database. Returns a list of (row, column) tuples that can be used to traverse the matrix. :Parameters: cost_matrix : list of lists The...
[ "Compute", "the", "indexes", "for", "the", "lowest", "-", "cost", "pairings", "between", "rows", "and", "columns", "in", "the", "database", ".", "Returns", "a", "list", "of", "(", "row", "column", ")", "tuples", "that", "can", "be", "used", "to", "traver...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L367-L423
[ "def", "compute", "(", "self", ",", "cost_matrix", ")", ":", "self", ".", "C", "=", "self", ".", "pad_matrix", "(", "cost_matrix", ")", "self", ".", "n", "=", "len", "(", "self", ".", "C", ")", "self", ".", "original_length", "=", "len", "(", "cost...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__make_matrix
Create an *n*x*n* matrix, populating it with the specific value.
hagelslag/util/munkres.py
def __make_matrix(self, n, val): """Create an *n*x*n* matrix, populating it with the specific value.""" matrix = [] for i in range(n): matrix += [[val for j in range(n)]] return matrix
def __make_matrix(self, n, val): """Create an *n*x*n* matrix, populating it with the specific value.""" matrix = [] for i in range(n): matrix += [[val for j in range(n)]] return matrix
[ "Create", "an", "*", "n", "*", "x", "*", "n", "*", "matrix", "populating", "it", "with", "the", "specific", "value", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L429-L434
[ "def", "__make_matrix", "(", "self", ",", "n", ",", "val", ")", ":", "matrix", "=", "[", "]", "for", "i", "in", "range", "(", "n", ")", ":", "matrix", "+=", "[", "[", "val", "for", "j", "in", "range", "(", "n", ")", "]", "]", "return", "matri...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step1
For each row of the matrix, find the smallest element and subtract it from every element in its row. Go to Step 2.
hagelslag/util/munkres.py
def __step1(self): """ For each row of the matrix, find the smallest element and subtract it from every element in its row. Go to Step 2. """ C = self.C n = self.n for i in range(n): minval = min(self.C[i]) # Find the minimum value for this...
def __step1(self): """ For each row of the matrix, find the smallest element and subtract it from every element in its row. Go to Step 2. """ C = self.C n = self.n for i in range(n): minval = min(self.C[i]) # Find the minimum value for this...
[ "For", "each", "row", "of", "the", "matrix", "find", "the", "smallest", "element", "and", "subtract", "it", "from", "every", "element", "in", "its", "row", ".", "Go", "to", "Step", "2", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L436-L450
[ "def", "__step1", "(", "self", ")", ":", "C", "=", "self", ".", "C", "n", "=", "self", ".", "n", "for", "i", "in", "range", "(", "n", ")", ":", "minval", "=", "min", "(", "self", ".", "C", "[", "i", "]", ")", "# Find the minimum value for this ro...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step2
Find a zero (Z) in the resulting matrix. If there is no starred zero in its row or column, star Z. Repeat for each element in the matrix. Go to Step 3.
hagelslag/util/munkres.py
def __step2(self): """ Find a zero (Z) in the resulting matrix. If there is no starred zero in its row or column, star Z. Repeat for each element in the matrix. Go to Step 3. """ n = self.n for i in range(n): for j in range(n): if (self...
def __step2(self): """ Find a zero (Z) in the resulting matrix. If there is no starred zero in its row or column, star Z. Repeat for each element in the matrix. Go to Step 3. """ n = self.n for i in range(n): for j in range(n): if (self...
[ "Find", "a", "zero", "(", "Z", ")", "in", "the", "resulting", "matrix", ".", "If", "there", "is", "no", "starred", "zero", "in", "its", "row", "or", "column", "star", "Z", ".", "Repeat", "for", "each", "element", "in", "the", "matrix", ".", "Go", "...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L452-L469
[ "def", "__step2", "(", "self", ")", ":", "n", "=", "self", ".", "n", "for", "i", "in", "range", "(", "n", ")", ":", "for", "j", "in", "range", "(", "n", ")", ":", "if", "(", "self", ".", "C", "[", "i", "]", "[", "j", "]", "==", "0", ")"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step3
Cover each column containing a starred zero. If K columns are covered, the starred zeros describe a complete set of unique assignments. In this case, Go to DONE, otherwise, Go to Step 4.
hagelslag/util/munkres.py
def __step3(self): """ Cover each column containing a starred zero. If K columns are covered, the starred zeros describe a complete set of unique assignments. In this case, Go to DONE, otherwise, Go to Step 4. """ n = self.n count = 0 for i in range(n): ...
def __step3(self): """ Cover each column containing a starred zero. If K columns are covered, the starred zeros describe a complete set of unique assignments. In this case, Go to DONE, otherwise, Go to Step 4. """ n = self.n count = 0 for i in range(n): ...
[ "Cover", "each", "column", "containing", "a", "starred", "zero", ".", "If", "K", "columns", "are", "covered", "the", "starred", "zeros", "describe", "a", "complete", "set", "of", "unique", "assignments", ".", "In", "this", "case", "Go", "to", "DONE", "othe...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L471-L490
[ "def", "__step3", "(", "self", ")", ":", "n", "=", "self", ".", "n", "count", "=", "0", "for", "i", "in", "range", "(", "n", ")", ":", "for", "j", "in", "range", "(", "n", ")", ":", "if", "self", ".", "marked", "[", "i", "]", "[", "j", "]...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step4
Find a noncovered zero and prime it. If there is no starred zero in the row containing this primed zero, Go to Step 5. Otherwise, cover this row and uncover the column containing the starred zero. Continue in this manner until there are no uncovered zeros left. Save the smallest uncovere...
hagelslag/util/munkres.py
def __step4(self): """ Find a noncovered zero and prime it. If there is no starred zero in the row containing this primed zero, Go to Step 5. Otherwise, cover this row and uncover the column containing the starred zero. Continue in this manner until there are no uncovered zeros ...
def __step4(self): """ Find a noncovered zero and prime it. If there is no starred zero in the row containing this primed zero, Go to Step 5. Otherwise, cover this row and uncover the column containing the starred zero. Continue in this manner until there are no uncovered zeros ...
[ "Find", "a", "noncovered", "zero", "and", "prime", "it", ".", "If", "there", "is", "no", "starred", "zero", "in", "the", "row", "containing", "this", "primed", "zero", "Go", "to", "Step", "5", ".", "Otherwise", "cover", "this", "row", "and", "uncover", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L492-L523
[ "def", "__step4", "(", "self", ")", ":", "step", "=", "0", "done", "=", "False", "row", "=", "-", "1", "col", "=", "-", "1", "star_col", "=", "-", "1", "while", "not", "done", ":", "(", "row", ",", "col", ")", "=", "self", ".", "__find_a_zero",...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step5
Construct a series of alternating primed and starred zeros as follows. Let Z0 represent the uncovered primed zero found in Step 4. Let Z1 denote the starred zero in the column of Z0 (if any). Let Z2 denote the primed zero in the row of Z1 (there will always be one). Continue until the se...
hagelslag/util/munkres.py
def __step5(self): """ Construct a series of alternating primed and starred zeros as follows. Let Z0 represent the uncovered primed zero found in Step 4. Let Z1 denote the starred zero in the column of Z0 (if any). Let Z2 denote the primed zero in the row of Z1 (there will always...
def __step5(self): """ Construct a series of alternating primed and starred zeros as follows. Let Z0 represent the uncovered primed zero found in Step 4. Let Z1 denote the starred zero in the column of Z0 (if any). Let Z2 denote the primed zero in the row of Z1 (there will always...
[ "Construct", "a", "series", "of", "alternating", "primed", "and", "starred", "zeros", "as", "follows", ".", "Let", "Z0", "represent", "the", "uncovered", "primed", "zero", "found", "in", "Step", "4", ".", "Let", "Z1", "denote", "the", "starred", "zero", "i...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L525-L559
[ "def", "__step5", "(", "self", ")", ":", "count", "=", "0", "path", "=", "self", ".", "path", "path", "[", "count", "]", "[", "0", "]", "=", "self", ".", "Z0_r", "path", "[", "count", "]", "[", "1", "]", "=", "self", ".", "Z0_c", "done", "=",...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__step6
Add the value found in Step 4 to every element of each covered row, and subtract it from every element of each uncovered column. Return to Step 4 without altering any stars, primes, or covered lines.
hagelslag/util/munkres.py
def __step6(self): """ Add the value found in Step 4 to every element of each covered row, and subtract it from every element of each uncovered column. Return to Step 4 without altering any stars, primes, or covered lines. """ minval = self.__find_smallest() ...
def __step6(self): """ Add the value found in Step 4 to every element of each covered row, and subtract it from every element of each uncovered column. Return to Step 4 without altering any stars, primes, or covered lines. """ minval = self.__find_smallest() ...
[ "Add", "the", "value", "found", "in", "Step", "4", "to", "every", "element", "of", "each", "covered", "row", "and", "subtract", "it", "from", "every", "element", "of", "each", "uncovered", "column", ".", "Return", "to", "Step", "4", "without", "altering", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L561-L575
[ "def", "__step6", "(", "self", ")", ":", "minval", "=", "self", ".", "__find_smallest", "(", ")", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "row_co...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__find_smallest
Find the smallest uncovered value in the matrix.
hagelslag/util/munkres.py
def __find_smallest(self): """Find the smallest uncovered value in the matrix.""" minval = sys.maxsize for i in range(self.n): for j in range(self.n): if (not self.row_covered[i]) and (not self.col_covered[j]): if minval > self.C[i][j]: ...
def __find_smallest(self): """Find the smallest uncovered value in the matrix.""" minval = sys.maxsize for i in range(self.n): for j in range(self.n): if (not self.row_covered[i]) and (not self.col_covered[j]): if minval > self.C[i][j]: ...
[ "Find", "the", "smallest", "uncovered", "value", "in", "the", "matrix", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L577-L585
[ "def", "__find_smallest", "(", "self", ")", ":", "minval", "=", "sys", ".", "maxsize", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "(", "not", "self", ".", "row_c...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__find_a_zero
Find the first uncovered element with value 0
hagelslag/util/munkres.py
def __find_a_zero(self): """Find the first uncovered element with value 0""" row = -1 col = -1 i = 0 n = self.n done = False while not done: j = 0 while True: if (self.C[i][j] == 0) and \ (not self.r...
def __find_a_zero(self): """Find the first uncovered element with value 0""" row = -1 col = -1 i = 0 n = self.n done = False while not done: j = 0 while True: if (self.C[i][j] == 0) and \ (not self.r...
[ "Find", "the", "first", "uncovered", "element", "with", "value", "0" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L587-L611
[ "def", "__find_a_zero", "(", "self", ")", ":", "row", "=", "-", "1", "col", "=", "-", "1", "i", "=", "0", "n", "=", "self", ".", "n", "done", "=", "False", "while", "not", "done", ":", "j", "=", "0", "while", "True", ":", "if", "(", "self", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__find_star_in_row
Find the first starred element in the specified row. Returns the column index, or -1 if no starred element was found.
hagelslag/util/munkres.py
def __find_star_in_row(self, row): """ Find the first starred element in the specified row. Returns the column index, or -1 if no starred element was found. """ col = -1 for j in range(self.n): if self.marked[row][j] == 1: col = j ...
def __find_star_in_row(self, row): """ Find the first starred element in the specified row. Returns the column index, or -1 if no starred element was found. """ col = -1 for j in range(self.n): if self.marked[row][j] == 1: col = j ...
[ "Find", "the", "first", "starred", "element", "in", "the", "specified", "row", ".", "Returns", "the", "column", "index", "or", "-", "1", "if", "no", "starred", "element", "was", "found", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L613-L624
[ "def", "__find_star_in_row", "(", "self", ",", "row", ")", ":", "col", "=", "-", "1", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "marked", "[", "row", "]", "[", "j", "]", "==", "1", ":", "col", "=", "j", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__find_star_in_col
Find the first starred element in the specified row. Returns the row index, or -1 if no starred element was found.
hagelslag/util/munkres.py
def __find_star_in_col(self, col): """ Find the first starred element in the specified row. Returns the row index, or -1 if no starred element was found. """ row = -1 for i in range(self.n): if self.marked[i][col] == 1: row = i ...
def __find_star_in_col(self, col): """ Find the first starred element in the specified row. Returns the row index, or -1 if no starred element was found. """ row = -1 for i in range(self.n): if self.marked[i][col] == 1: row = i ...
[ "Find", "the", "first", "starred", "element", "in", "the", "specified", "row", ".", "Returns", "the", "row", "index", "or", "-", "1", "if", "no", "starred", "element", "was", "found", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L626-L637
[ "def", "__find_star_in_col", "(", "self", ",", "col", ")", ":", "row", "=", "-", "1", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "marked", "[", "i", "]", "[", "col", "]", "==", "1", ":", "row", "=", "i", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__find_prime_in_row
Find the first prime element in the specified row. Returns the column index, or -1 if no starred element was found.
hagelslag/util/munkres.py
def __find_prime_in_row(self, row): """ Find the first prime element in the specified row. Returns the column index, or -1 if no starred element was found. """ col = -1 for j in range(self.n): if self.marked[row][j] == 2: col = j ...
def __find_prime_in_row(self, row): """ Find the first prime element in the specified row. Returns the column index, or -1 if no starred element was found. """ col = -1 for j in range(self.n): if self.marked[row][j] == 2: col = j ...
[ "Find", "the", "first", "prime", "element", "in", "the", "specified", "row", ".", "Returns", "the", "column", "index", "or", "-", "1", "if", "no", "starred", "element", "was", "found", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L639-L650
[ "def", "__find_prime_in_row", "(", "self", ",", "row", ")", ":", "col", "=", "-", "1", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "marked", "[", "row", "]", "[", "j", "]", "==", "2", ":", "col", "=", "j", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__clear_covers
Clear all covered matrix cells
hagelslag/util/munkres.py
def __clear_covers(self): """Clear all covered matrix cells""" for i in range(self.n): self.row_covered[i] = False self.col_covered[i] = False
def __clear_covers(self): """Clear all covered matrix cells""" for i in range(self.n): self.row_covered[i] = False self.col_covered[i] = False
[ "Clear", "all", "covered", "matrix", "cells" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L659-L663
[ "def", "__clear_covers", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "self", ".", "row_covered", "[", "i", "]", "=", "False", "self", ".", "col_covered", "[", "i", "]", "=", "False" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Munkres.__erase_primes
Erase all prime markings
hagelslag/util/munkres.py
def __erase_primes(self): """Erase all prime markings""" for i in range(self.n): for j in range(self.n): if self.marked[i][j] == 2: self.marked[i][j] = 0
def __erase_primes(self): """Erase all prime markings""" for i in range(self.n): for j in range(self.n): if self.marked[i][j] == 2: self.marked[i][j] = 0
[ "Erase", "all", "prime", "markings" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L665-L670
[ "def", "__erase_primes", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "marked", "[", "i", "]", "[", "j", "]", "==", "2", ":...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.update
Update contingency table with new values without creating a new object.
hagelslag/evaluation/ContingencyTable.py
def update(self, a, b, c, d): """ Update contingency table with new values without creating a new object. """ self.table.ravel()[:] = [a, b, c, d] self.N = self.table.sum()
def update(self, a, b, c, d): """ Update contingency table with new values without creating a new object. """ self.table.ravel()[:] = [a, b, c, d] self.N = self.table.sum()
[ "Update", "contingency", "table", "with", "new", "values", "without", "creating", "a", "new", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L23-L28
[ "def", "update", "(", "self", ",", "a", ",", "b", ",", "c", ",", "d", ")", ":", "self", ".", "table", ".", "ravel", "(", ")", "[", ":", "]", "=", "[", "a", ",", "b", ",", "c", ",", "d", "]", "self", ".", "N", "=", "self", ".", "table", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.bias
Frequency Bias. Formula: (a+b)/(a+c)
hagelslag/evaluation/ContingencyTable.py
def bias(self): """ Frequency Bias. Formula: (a+b)/(a+c)""" return (self.table[0, 0] + self.table[0, 1]) / (self.table[0, 0] + self.table[1, 0])
def bias(self): """ Frequency Bias. Formula: (a+b)/(a+c)""" return (self.table[0, 0] + self.table[0, 1]) / (self.table[0, 0] + self.table[1, 0])
[ "Frequency", "Bias", ".", "Formula", ":", "(", "a", "+", "b", ")", "/", "(", "a", "+", "c", ")" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L92-L96
[ "def", "bias", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", ")", "/", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.csi
Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)
hagelslag/evaluation/ContingencyTable.py
def csi(self): """Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)""" return self.table[0, 0] / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0])
def csi(self): """Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)""" return self.table[0, 0] / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0])
[ "Gilbert", "s", "Score", "or", "Threat", "Score", "or", "Critical", "Success", "Index", "a", "/", "(", "a", "+", "b", "+", "c", ")" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L102-L104
[ "def", "csi", "(", "self", ")", ":", "return", "self", ".", "table", "[", "0", ",", "0", "]", "/", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", "+", "self", ".", "table", "[", "1"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.ets
Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N
hagelslag/evaluation/ContingencyTable.py
def ets(self): """Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N""" r = (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 0] + self.table[1, 0]) / self.N return (self.table[0, 0] - r) / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0] - r)
def ets(self): """Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N""" r = (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 0] + self.table[1, 0]) / self.N return (self.table[0, 0] - r) / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0] - r)
[ "Equitable", "Threat", "Score", "Gilbert", "Skill", "Score", "v", "(", "a", "-", "R", ")", "/", "(", "a", "+", "b", "+", "c", "-", "R", ")", "R", "=", "(", "a", "+", "b", ")", "(", "a", "+", "c", ")", "/", "N" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L106-L109
[ "def", "ets", "(", "self", ")", ":", "r", "=", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", ")", "*", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "tabl...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.hss
Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))
hagelslag/evaluation/ContingencyTable.py
def hss(self): """Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))""" return 2 * (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / ( (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 1] + self.table[1, 1]) + (self.table[0, 0] + ...
def hss(self): """Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))""" return 2 * (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / ( (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 1] + self.table[1, 1]) + (self.table[0, 0] + ...
[ "Doolittle", "(", "Heidke", ")", "Skill", "Score", ".", "2", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "b", ")", "(", "b", "+", "d", ")", "+", "(", "a", "+", "c", ")", "(", "c", "+", "d", "))" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L111-L115
[ "def", "hss", "(", "self", ")", ":", "return", "2", "*", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.pss
Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))
hagelslag/evaluation/ContingencyTable.py
def pss(self): """Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[1, 0]) * (self.table[0, 1] + self.table[1, 1]))
def pss(self): """Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[1, 0]) * (self.table[0, 1] + self.table[1, 1]))
[ "Peirce", "(", "Hansen", "-", "Kuipers", "True", ")", "Skill", "Score", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "c", ")", "(", "b", "+", "d", "))" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L117-L120
[ "def", "pss", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table", "[", "1"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ContingencyTable.css
Clayton Skill Score (ad - bc)/((a+b)(c+d))
hagelslag/evaluation/ContingencyTable.py
def css(self): """Clayton Skill Score (ad - bc)/((a+b)(c+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[0, 1]) * (self.table[1, 0] + self.table[1, 1]))
def css(self): """Clayton Skill Score (ad - bc)/((a+b)(c+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[0, 1]) * (self.table[1, 0] + self.table[1, 1]))
[ "Clayton", "Skill", "Score", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "b", ")", "(", "c", "+", "d", "))" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L122-L125
[ "def", "css", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table", "[", "1"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
load_tree_object
Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object
hagelslag/util/output_tree_ensembles.py
def load_tree_object(filename): """ Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object """ with open(filename) as file_obj: ...
def load_tree_object(filename): """ Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object """ with open(filename) as file_obj: ...
[ "Load", "scikit", "-", "learn", "decision", "tree", "ensemble", "object", "from", "file", ".", "Parameters", "----------", "filename", ":", "str", "Name", "of", "the", "pickle", "file", "containing", "the", "tree", "object", ".", "Returns", "-------", "tree", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L30-L45
[ "def", "load_tree_object", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "file_obj", ":", "tree_ensemble_obj", "=", "pickle", ".", "load", "(", "file_obj", ")", "return", "tree_ensemble_obj" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
output_tree_ensemble
Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str File where trees are written attribute_names : list List of attribute names to be us...
hagelslag/util/output_tree_ensembles.py
def output_tree_ensemble(tree_ensemble_obj, output_filename, attribute_names=None): """ Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str ...
def output_tree_ensemble(tree_ensemble_obj, output_filename, attribute_names=None): """ Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str ...
[ "Write", "each", "decision", "tree", "in", "an", "ensemble", "to", "a", "file", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L48-L69
[ "def", "output_tree_ensemble", "(", "tree_ensemble_obj", ",", "output_filename", ",", "attribute_names", "=", "None", ")", ":", "for", "t", ",", "tree", "in", "enumerate", "(", "tree_ensemble_obj", ".", "estimators_", ")", ":", "print", "(", "\"Writing Tree {0:d}\...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
print_tree_recursive
Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being printed attribute_names : list List of attribute names Returns ...
hagelslag/util/output_tree_ensembles.py
def print_tree_recursive(tree_obj, node_index, attribute_names=None): """ Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being pr...
def print_tree_recursive(tree_obj, node_index, attribute_names=None): """ Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being pr...
[ "Recursively", "writes", "a", "string", "representation", "of", "a", "decision", "tree", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L72-L116
[ "def", "print_tree_recursive", "(", "tree_obj", ",", "node_index", ",", "attribute_names", "=", "None", ")", ":", "tree_str", "=", "\"\"", "if", "node_index", "==", "0", ":", "tree_str", "+=", "\"{0:d}\\n\"", ".", "format", "(", "tree_obj", ".", "node_count", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
BaggingFitness.set_classifier_mask
Computes the mask used to create the training and validation set
EvoDAG/bagging_fitness.py
def set_classifier_mask(self, v, base_mask=True): """Computes the mask used to create the training and validation set""" base = self._base v = tonparray(v) a = np.unique(v) if a[0] != -1 or a[1] != 1: raise RuntimeError("The labels must be -1 and 1 (%s)" % a) ...
def set_classifier_mask(self, v, base_mask=True): """Computes the mask used to create the training and validation set""" base = self._base v = tonparray(v) a = np.unique(v) if a[0] != -1 or a[1] != 1: raise RuntimeError("The labels must be -1 and 1 (%s)" % a) ...
[ "Computes", "the", "mask", "used", "to", "create", "the", "training", "and", "validation", "set" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L114-L129
[ "def", "set_classifier_mask", "(", "self", ",", "v", ",", "base_mask", "=", "True", ")", ":", "base", "=", "self", ".", "_base", "v", "=", "tonparray", "(", "v", ")", "a", "=", "np", ".", "unique", "(", "v", ")", "if", "a", "[", "0", "]", "!=",...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
BaggingFitness.set_regression_mask
Computes the mask used to create the training and validation set
EvoDAG/bagging_fitness.py
def set_regression_mask(self, v): """Computes the mask used to create the training and validation set""" base = self._base index = np.arange(v.size()) np.random.shuffle(index) ones = np.ones(v.size()) ones[index[int(base._tr_fraction * v.size()):]] = 0 base._mask ...
def set_regression_mask(self, v): """Computes the mask used to create the training and validation set""" base = self._base index = np.arange(v.size()) np.random.shuffle(index) ones = np.ones(v.size()) ones[index[int(base._tr_fraction * v.size()):]] = 0 base._mask ...
[ "Computes", "the", "mask", "used", "to", "create", "the", "training", "and", "validation", "set" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L164-L171
[ "def", "set_regression_mask", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "index", "=", "np", ".", "arange", "(", "v", ".", "size", "(", ")", ")", "np", ".", "random", ".", "shuffle", "(", "index", ")", "ones", "=", "np", ...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
BaggingFitness.fitness
Fitness function in the training set
EvoDAG/bagging_fitness.py
def fitness(self, v): "Fitness function in the training set" base = self._base if base._classifier: if base._multiple_outputs: hy = SparseArray.argmax(v.hy) fit_func = base._fitness_function if fit_func == 'macro-F1' or fit_func == 'a_F...
def fitness(self, v): "Fitness function in the training set" base = self._base if base._classifier: if base._multiple_outputs: hy = SparseArray.argmax(v.hy) fit_func = base._fitness_function if fit_func == 'macro-F1' or fit_func == 'a_F...
[ "Fitness", "function", "in", "the", "training", "set" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L212-L300
[ "def", "fitness", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "if", "base", ".", "_classifier", ":", "if", "base", ".", "_multiple_outputs", ":", "hy", "=", "SparseArray", ".", "argmax", "(", "v", ".", "hy", ")", "fit_func", ...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
BaggingFitness.fitness_vs
Fitness function in the validation set In classification it uses BER and RSE in regression
EvoDAG/bagging_fitness.py
def fitness_vs(self, v): """Fitness function in the validation set In classification it uses BER and RSE in regression""" base = self._base if base._classifier: if base._multiple_outputs: v.fitness_vs = v._error # if base._fitness_function == '...
def fitness_vs(self, v): """Fitness function in the validation set In classification it uses BER and RSE in regression""" base = self._base if base._classifier: if base._multiple_outputs: v.fitness_vs = v._error # if base._fitness_function == '...
[ "Fitness", "function", "in", "the", "validation", "set", "In", "classification", "it", "uses", "BER", "and", "RSE", "in", "regression" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L302-L342
[ "def", "fitness_vs", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "if", "base", ".", "_classifier", ":", "if", "base", ".", "_multiple_outputs", ":", "v", ".", "fitness_vs", "=", "v", ".", "_error", "# if base._fitness_function == 'm...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
BaggingFitness.set_fitness
Set the fitness to a new node. Returns false in case fitness is not finite
EvoDAG/bagging_fitness.py
def set_fitness(self, v): """Set the fitness to a new node. Returns false in case fitness is not finite""" base = self._base self.fitness(v) if not np.isfinite(v.fitness): self.del_error(v) return False if base._tr_fraction < 1: self.fi...
def set_fitness(self, v): """Set the fitness to a new node. Returns false in case fitness is not finite""" base = self._base self.fitness(v) if not np.isfinite(v.fitness): self.del_error(v) return False if base._tr_fraction < 1: self.fi...
[ "Set", "the", "fitness", "to", "a", "new", "node", ".", "Returns", "false", "in", "case", "fitness", "is", "not", "finite" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L344-L358
[ "def", "set_fitness", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "self", ".", "fitness", "(", "v", ")", "if", "not", "np", ".", "isfinite", "(", "v", ".", "fitness", ")", ":", "self", ".", "del_error", "(", "v", ")", "r...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
RespostaCancelarUltimaVenda.analisar
Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``.
satcfe/resposta/cancelarultimavenda.py
def analisar(retorno): """Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='EnviarDadosVenda', ...
def analisar(retorno): """Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='EnviarDadosVenda', ...
[ "Constrói", "uma", ":", "class", ":", "RespostaCancelarUltimaVenda", "a", "partir", "do", "retorno", "informado", "." ]
base4sistemas/satcfe
python
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/cancelarultimavenda.py#L80-L121
[ "def", "analisar", "(", "retorno", ")", ":", "resposta", "=", "analisar_retorno", "(", "forcar_unicode", "(", "retorno", ")", ",", "funcao", "=", "'EnviarDadosVenda'", ",", "classe_resposta", "=", "RespostaCancelarUltimaVenda", ",", "campos", "=", "(", "(", "'nu...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9
train
convert_data_element_to_data_and_metadata_1
Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional description of the data) spatial_calibrations (optional list of spatial calibration dicts, scale, o...
nion/swift/model/ImportExportManager.py
def convert_data_element_to_data_and_metadata_1(data_element) -> DataAndMetadata.DataAndMetadata: """Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional de...
def convert_data_element_to_data_and_metadata_1(data_element) -> DataAndMetadata.DataAndMetadata: """Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional de...
[ "Convert", "a", "data", "element", "to", "xdata", ".", "No", "data", "copying", "occurs", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/ImportExportManager.py#L274-L362
[ "def", "convert_data_element_to_data_and_metadata_1", "(", "data_element", ")", "->", "DataAndMetadata", ".", "DataAndMetadata", ":", "# data. takes ownership.", "data", "=", "data_element", "[", "\"data\"", "]", "dimensional_shape", "=", "Image", ".", "dimensional_shape_fr...
d43693eaf057b8683b9638e575000f055fede452
train
SectorProcessor.output_sector_csv
Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary key for the csv files, currently either 'track_step' or 'track_tot...
hagelslag/util/create_sector_grid_data.py
def output_sector_csv(self,csv_path,file_dict_key,out_path): """ Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary ke...
def output_sector_csv(self,csv_path,file_dict_key,out_path): """ Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary ke...
[ "Segment", "forecast", "tracks", "to", "only", "output", "data", "contined", "within", "a", "region", "in", "the", "CONUS", "as", "defined", "by", "the", "mapfile", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/create_sector_grid_data.py#L28-L76
[ "def", "output_sector_csv", "(", "self", ",", "csv_path", ",", "file_dict_key", ",", "out_path", ")", ":", "csv_file", "=", "csv_path", "+", "\"{0}_{1}_{2}_{3}.csv\"", ".", "format", "(", "file_dict_key", ",", "self", ".", "ensemble_name", ",", "self", ".", "m...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
SectorProcessor.output_sector_netcdf
Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. out_path (str): Path to output new segmented netcdf files. patch_radius (int):...
hagelslag/util/create_sector_grid_data.py
def output_sector_netcdf(self,netcdf_path,out_path,patch_radius,config): """ Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. ...
def output_sector_netcdf(self,netcdf_path,out_path,patch_radius,config): """ Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. ...
[ "Segment", "patches", "of", "forecast", "tracks", "to", "only", "output", "data", "contined", "within", "a", "region", "in", "the", "CONUS", "as", "defined", "by", "the", "mapfile", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/create_sector_grid_data.py#L108-L234
[ "def", "output_sector_netcdf", "(", "self", ",", "netcdf_path", ",", "out_path", ",", "patch_radius", ",", "config", ")", ":", "nc_data", "=", "self", ".", "load_netcdf_data", "(", "netcdf_path", ",", "patch_radius", ")", "if", "nc_data", "is", "not", "None", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
clean_dict
Return a json-clean dict. Will log info message for failures.
nion/swift/model/Utility.py
def clean_dict(d0, clean_item_fn=None): """ Return a json-clean dict. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item d = dict() for key in d0: cleaned_item = clean_item_fn(d0[key]) if cleaned_item is not None: ...
def clean_dict(d0, clean_item_fn=None): """ Return a json-clean dict. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item d = dict() for key in d0: cleaned_item = clean_item_fn(d0[key]) if cleaned_item is not None: ...
[ "Return", "a", "json", "-", "clean", "dict", ".", "Will", "log", "info", "message", "for", "failures", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L102-L112
[ "def", "clean_dict", "(", "d0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "d", "=", "dict", "(", ")", "for", "key", "in", "d0", ":", "cleaned_item", "=", "clean_item_fn", ...
d43693eaf057b8683b9638e575000f055fede452
train
clean_list
Return a json-clean list. Will log info message for failures.
nion/swift/model/Utility.py
def clean_list(l0, clean_item_fn=None): """ Return a json-clean list. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(l0): cleaned_item = clean_item_fn(item) l.append(cleaned_item) ...
def clean_list(l0, clean_item_fn=None): """ Return a json-clean list. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(l0): cleaned_item = clean_item_fn(item) l.append(cleaned_item) ...
[ "Return", "a", "json", "-", "clean", "list", ".", "Will", "log", "info", "message", "for", "failures", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L115-L124
[ "def", "clean_list", "(", "l0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "l", "=", "list", "(", ")", "for", "index", ",", "item", "in", "enumerate", "(", "l0", ")", "...
d43693eaf057b8683b9638e575000f055fede452
train
clean_tuple
Return a json-clean tuple. Will log info message for failures.
nion/swift/model/Utility.py
def clean_tuple(t0, clean_item_fn=None): """ Return a json-clean tuple. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(t0): cleaned_item = clean_item_fn(item) l.append(cleaned_item...
def clean_tuple(t0, clean_item_fn=None): """ Return a json-clean tuple. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(t0): cleaned_item = clean_item_fn(item) l.append(cleaned_item...
[ "Return", "a", "json", "-", "clean", "tuple", ".", "Will", "log", "info", "message", "for", "failures", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L127-L136
[ "def", "clean_tuple", "(", "t0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "l", "=", "list", "(", ")", "for", "index", ",", "item", "in", "enumerate", "(", "t0", ")", ...
d43693eaf057b8683b9638e575000f055fede452
train
clean_item
Return a json-clean item or None. Will log info message for failure.
nion/swift/model/Utility.py
def clean_item(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i) elif itype == list: return clean_list(i) elif itype == tuple: return clean_tuple(i) elif itype == numpy.float...
def clean_item(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i) elif itype == list: return clean_list(i) elif itype == tuple: return clean_tuple(i) elif itype == numpy.float...
[ "Return", "a", "json", "-", "clean", "item", "or", "None", ".", "Will", "log", "info", "message", "for", "failure", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L139-L179
[ "def", "clean_item", "(", "i", ")", ":", "itype", "=", "type", "(", "i", ")", "if", "itype", "==", "dict", ":", "return", "clean_dict", "(", "i", ")", "elif", "itype", "==", "list", ":", "return", "clean_list", "(", "i", ")", "elif", "itype", "==",...
d43693eaf057b8683b9638e575000f055fede452
train
clean_item_no_list
Return a json-clean item or None. Will log info message for failure.
nion/swift/model/Utility.py
def clean_item_no_list(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i, clean_item_no_list) elif itype == list: return clean_tuple(i, clean_item_no_list) elif itype == tuple: re...
def clean_item_no_list(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i, clean_item_no_list) elif itype == list: return clean_tuple(i, clean_item_no_list) elif itype == tuple: re...
[ "Return", "a", "json", "-", "clean", "item", "or", "None", ".", "Will", "log", "info", "message", "for", "failure", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L182-L216
[ "def", "clean_item_no_list", "(", "i", ")", ":", "itype", "=", "type", "(", "i", ")", "if", "itype", "==", "dict", ":", "return", "clean_dict", "(", "i", ",", "clean_item_no_list", ")", "elif", "itype", "==", "list", ":", "return", "clean_tuple", "(", ...
d43693eaf057b8683b9638e575000f055fede452
train
sample_stack_all
Sample the stack in a thread and print it at regular intervals.
nion/swift/model/Utility.py
def sample_stack_all(count=10, interval=0.1): """Sample the stack in a thread and print it at regular intervals.""" def print_stack_all(l, ll): l1 = list() l1.append("*** STACKTRACE - START ***") code = [] for threadId, stack in sys._current_frames().items(): sub_cod...
def sample_stack_all(count=10, interval=0.1): """Sample the stack in a thread and print it at regular intervals.""" def print_stack_all(l, ll): l1 = list() l1.append("*** STACKTRACE - START ***") code = [] for threadId, stack in sys._current_frames().items(): sub_cod...
[ "Sample", "the", "stack", "in", "a", "thread", "and", "print", "it", "at", "regular", "intervals", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L312-L350
[ "def", "sample_stack_all", "(", "count", "=", "10", ",", "interval", "=", "0.1", ")", ":", "def", "print_stack_all", "(", "l", ",", "ll", ")", ":", "l1", "=", "list", "(", ")", "l1", ".", "append", "(", "\"*** STACKTRACE - START ***\"", ")", "code", "=...
d43693eaf057b8683b9638e575000f055fede452
train
Individual.decision_function
Decision function i.e. the raw data of the prediction
EvoDAG/gp.py
def decision_function(self, X): "Decision function i.e. the raw data of the prediction" self._X = Model.convert_features(X) self._eval() return self._ind[0].hy
def decision_function(self, X): "Decision function i.e. the raw data of the prediction" self._X = Model.convert_features(X) self._eval() return self._ind[0].hy
[ "Decision", "function", "i", ".", "e", ".", "the", "raw", "data", "of", "the", "prediction" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L37-L41
[ "def", "decision_function", "(", "self", ",", "X", ")", ":", "self", ".", "_X", "=", "Model", ".", "convert_features", "(", "X", ")", "self", ".", "_eval", "(", ")", "return", "self", ".", "_ind", "[", "0", "]", ".", "hy" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Individual._eval
Evaluates a individual using recursion and self._pos as pointer
EvoDAG/gp.py
def _eval(self): "Evaluates a individual using recursion and self._pos as pointer" pos = self._pos self._pos += 1 node = self._ind[pos] if isinstance(node, Function): args = [self._eval() for x in range(node.nargs)] node.eval(args) for x in arg...
def _eval(self): "Evaluates a individual using recursion and self._pos as pointer" pos = self._pos self._pos += 1 node = self._ind[pos] if isinstance(node, Function): args = [self._eval() for x in range(node.nargs)] node.eval(args) for x in arg...
[ "Evaluates", "a", "individual", "using", "recursion", "and", "self", ".", "_pos", "as", "pointer" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L43-L56
[ "def", "_eval", "(", "self", ")", ":", "pos", "=", "self", ".", "_pos", "self", ".", "_pos", "+=", "1", "node", "=", "self", ".", "_ind", "[", "pos", "]", "if", "isinstance", "(", "node", ",", "Function", ")", ":", "args", "=", "[", "self", "."...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Population.create_random_ind_full
Random individual using full method
EvoDAG/gp.py
def create_random_ind_full(self, depth=0): "Random individual using full method" lst = [] self._create_random_ind_full(depth=depth, output=lst) return lst
def create_random_ind_full(self, depth=0): "Random individual using full method" lst = [] self._create_random_ind_full(depth=depth, output=lst) return lst
[ "Random", "individual", "using", "full", "method" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L82-L86
[ "def", "create_random_ind_full", "(", "self", ",", "depth", "=", "0", ")", ":", "lst", "=", "[", "]", "self", ".", "_create_random_ind_full", "(", "depth", "=", "depth", ",", "output", "=", "lst", ")", "return", "lst" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Population.grow_use_function
Select either function or terminal in grow method
EvoDAG/gp.py
def grow_use_function(self, depth=0): "Select either function or terminal in grow method" if depth == 0: return False if depth == self._depth: return True return np.random.random() < 0.5
def grow_use_function(self, depth=0): "Select either function or terminal in grow method" if depth == 0: return False if depth == self._depth: return True return np.random.random() < 0.5
[ "Select", "either", "function", "or", "terminal", "in", "grow", "method" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L98-L104
[ "def", "grow_use_function", "(", "self", ",", "depth", "=", "0", ")", ":", "if", "depth", "==", "0", ":", "return", "False", "if", "depth", "==", "self", ".", "_depth", ":", "return", "True", "return", "np", ".", "random", ".", "random", "(", ")", ...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Population.create_random_ind_grow
Random individual using grow method
EvoDAG/gp.py
def create_random_ind_grow(self, depth=0): "Random individual using grow method" lst = [] self._depth = depth self._create_random_ind_grow(depth=depth, output=lst) return lst
def create_random_ind_grow(self, depth=0): "Random individual using grow method" lst = [] self._depth = depth self._create_random_ind_grow(depth=depth, output=lst) return lst
[ "Random", "individual", "using", "grow", "method" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L106-L111
[ "def", "create_random_ind_grow", "(", "self", ",", "depth", "=", "0", ")", ":", "lst", "=", "[", "]", "self", ".", "_depth", "=", "depth", "self", ".", "_create_random_ind_grow", "(", "depth", "=", "depth", ",", "output", "=", "lst", ")", "return", "ls...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Population.create_population
Creates random population using ramped half-and-half method
EvoDAG/gp.py
def create_population(self, popsize=1000, min_depth=2, max_depth=4, X=None): "Creates random population using ramped half-and-half method" import itertools args = [x for x in itertools.product(range(min_depth, ...
def create_population(self, popsize=1000, min_depth=2, max_depth=4, X=None): "Creates random population using ramped half-and-half method" import itertools args = [x for x in itertools.product(range(min_depth, ...
[ "Creates", "random", "population", "using", "ramped", "half", "-", "and", "-", "half", "method" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L123-L152
[ "def", "create_population", "(", "self", ",", "popsize", "=", "1000", ",", "min_depth", "=", "2", ",", "max_depth", "=", "4", ",", "X", "=", "None", ")", ":", "import", "itertools", "args", "=", "[", "x", "for", "x", "in", "itertools", ".", "product"...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Model.decision_function
Decision function i.e. the raw data of the prediction
EvoDAG/model.py
def decision_function(self, X, **kwargs): "Decision function i.e. the raw data of the prediction" if X is None: return self._hy_test X = self.convert_features(X) if len(X) < self.nvar: _ = 'Number of variables differ, trained with %s given %s' % (self.nvar, len(X)...
def decision_function(self, X, **kwargs): "Decision function i.e. the raw data of the prediction" if X is None: return self._hy_test X = self.convert_features(X) if len(X) < self.nvar: _ = 'Number of variables differ, trained with %s given %s' % (self.nvar, len(X)...
[ "Decision", "function", "i", ".", "e", ".", "the", "raw", "data", "of", "the", "prediction" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L154-L174
[ "def", "decision_function", "(", "self", ",", "X", ",", "*", "*", "kwargs", ")", ":", "if", "X", "is", "None", ":", "return", "self", ".", "_hy_test", "X", "=", "self", ".", "convert_features", "(", "X", ")", "if", "len", "(", "X", ")", "<", "sel...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Ensemble.fitness_vs
Median Fitness in the validation set
EvoDAG/model.py
def fitness_vs(self): "Median Fitness in the validation set" l = [x.fitness_vs for x in self.models] return np.median(l)
def fitness_vs(self): "Median Fitness in the validation set" l = [x.fitness_vs for x in self.models] return np.median(l)
[ "Median", "Fitness", "in", "the", "validation", "set" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L335-L338
[ "def", "fitness_vs", "(", "self", ")", ":", "l", "=", "[", "x", ".", "fitness_vs", "for", "x", "in", "self", ".", "models", "]", "return", "np", ".", "median", "(", "l", ")" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
Ensemble.graphviz
Directory to store the graphviz models
EvoDAG/model.py
def graphviz(self, directory, **kwargs): "Directory to store the graphviz models" import os if not os.path.isdir(directory): os.mkdir(directory) output = os.path.join(directory, 'evodag-%s') for k, m in enumerate(self.models): m.graphviz(output % k, **kwar...
def graphviz(self, directory, **kwargs): "Directory to store the graphviz models" import os if not os.path.isdir(directory): os.mkdir(directory) output = os.path.join(directory, 'evodag-%s') for k, m in enumerate(self.models): m.graphviz(output % k, **kwar...
[ "Directory", "to", "store", "the", "graphviz", "models" ]
mgraffg/EvoDAG
python
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L438-L445
[ "def", "graphviz", "(", "self", ",", "directory", ",", "*", "*", "kwargs", ")", ":", "import", "os", "if", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "os", ".", "mkdir", "(", "directory", ")", "output", "=", "os", ".", "p...
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
train
EnsembleMemberProduct.load_data
Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns:
hagelslag/processing/EnsembleProducts.py
def load_data(self, num_samples=1000, percentiles=None): """ Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns: """ self.percentiles = percentiles self.num_samp...
def load_data(self, num_samples=1000, percentiles=None): """ Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns: """ self.percentiles = percentiles self.num_samp...
[ "Args", ":", "num_samples", ":", "Number", "of", "random", "samples", "at", "each", "grid", "point", "percentiles", ":", "Which", "percentiles", "to", "extract", "from", "the", "random", "samples" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L63-L130
[ "def", "load_data", "(", "self", ",", "num_samples", "=", "1000", ",", "percentiles", "=", "None", ")", ":", "self", ".", "percentiles", "=", "percentiles", "self", ".", "num_samples", "=", "num_samples", "if", "self", ".", "model_name", ".", "lower", "(",...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleMemberProduct.neighborhood_probability
Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns:
hagelslag/processing/EnsembleProducts.py
def neighborhood_probability(self, threshold, radius): """ Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns: """ weights = disk(radius, dtype=np.uint8) thresh...
def neighborhood_probability(self, threshold, radius): """ Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns: """ weights = disk(radius, dtype=np.uint8) thresh...
[ "Calculate", "a", "probability", "based", "on", "the", "number", "of", "grid", "points", "in", "an", "area", "that", "exceed", "a", "threshold", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L221-L244
[ "def", "neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ")", ":", "weights", "=", "disk", "(", "radius", ",", "dtype", "=", "np", ".", "uint8", ")", "thresh_data", "=", "np", ".", "zeros", "(", "self", ".", "data", ".", "shape"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleMemberProduct.encode_grib2_percentile
Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages
hagelslag/processing/EnsembleProducts.py
def encode_grib2_percentile(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.in...
def encode_grib2_percentile(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.in...
[ "Encodes", "member", "percentile", "data", "to", "GRIB2", "format", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L273-L335
[ "def", "encode_grib2_percentile", "(", "self", ")", ":", "lscale", "=", "1e6", "grib_id_start", "=", "[", "7", ",", "0", ",", "14", ",", "14", ",", "2", "]", "gdsinfo", "=", "np", ".", "array", "(", "[", "0", ",", "np", ".", "product", "(", "self...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleMemberProduct.encode_grib2_data
Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages
hagelslag/processing/EnsembleProducts.py
def encode_grib2_data(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.int32) ...
def encode_grib2_data(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.int32) ...
[ "Encodes", "member", "percentile", "data", "to", "GRIB2", "format", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L337-L391
[ "def", "encode_grib2_data", "(", "self", ")", ":", "lscale", "=", "1e6", "grib_id_start", "=", "[", "7", ",", "0", ",", "14", ",", "14", ",", "2", "]", "gdsinfo", "=", "np", ".", "array", "(", "[", "0", ",", "np", ".", "product", "(", "self", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleProducts.load_data
Loads data from each ensemble member.
hagelslag/processing/EnsembleProducts.py
def load_data(self): """ Loads data from each ensemble member. """ for m, member in enumerate(self.members): mo = ModelOutput(self.ensemble_name, member, self.run_date, self.variable, self.start_date, self.end_date, self.path, self.map_file, self....
def load_data(self): """ Loads data from each ensemble member. """ for m, member in enumerate(self.members): mo = ModelOutput(self.ensemble_name, member, self.run_date, self.variable, self.start_date, self.end_date, self.path, self.map_file, self....
[ "Loads", "data", "from", "each", "ensemble", "member", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L439-L458
[ "def", "load_data", "(", "self", ")", ":", "for", "m", ",", "member", "in", "enumerate", "(", "self", ".", "members", ")", ":", "mo", "=", "ModelOutput", "(", "self", ".", "ensemble_name", ",", "member", ",", "self", ".", "run_date", ",", "self", "."...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleProducts.point_consensus
Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic
hagelslag/processing/EnsembleProducts.py
def point_consensus(self, consensus_type): """ Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic """ if "mean" in consensu...
def point_consensus(self, consensus_type): """ Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic """ if "mean" in consensu...
[ "Calculate", "grid", "-", "point", "statistics", "across", "ensemble", "members", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L460-L485
[ "def", "point_consensus", "(", "self", ",", "consensus_type", ")", ":", "if", "\"mean\"", "in", "consensus_type", ":", "consensus_data", "=", "np", ".", "mean", "(", "self", ".", "data", ",", "axis", "=", "0", ")", "elif", "\"std\"", "in", "consensus_type"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleProducts.point_probability
Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus
hagelslag/processing/EnsembleProducts.py
def point_probability(self, threshold): """ Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus ...
def point_probability(self, threshold): """ Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus ...
[ "Determine", "the", "probability", "of", "exceeding", "a", "threshold", "at", "a", "grid", "point", "based", "on", "the", "ensemble", "forecasts", "at", "that", "point", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L487-L504
[ "def", "point_probability", "(", "self", ",", "threshold", ")", ":", "point_prob", "=", "np", ".", "zeros", "(", "self", ".", "data", ".", "shape", "[", "1", ":", "]", ")", "for", "t", "in", "range", "(", "self", ".", "data", ".", "shape", "[", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleProducts.neighborhood_probability
Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from point in number of grid points to include in neighborhood calculation. sigmas ...
hagelslag/processing/EnsembleProducts.py
def neighborhood_probability(self, threshold, radius, sigmas=None): """ Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from po...
def neighborhood_probability(self, threshold, radius, sigmas=None): """ Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from po...
[ "Hourly", "probability", "of", "exceeding", "a", "threshold", "based", "on", "model", "values", "within", "a", "specified", "radius", "of", "a", "point", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L506-L546
[ "def", "neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ",", "sigmas", "=", "None", ")", ":", "if", "sigmas", "is", "None", ":", "sigmas", "=", "[", "0", "]", "weights", "=", "disk", "(", "radius", ")", "filtered_prob", "=", "[...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleProducts.period_max_neighborhood_probability
Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int): distance from point in number of grid points to include in neighborhood calculation. ...
hagelslag/processing/EnsembleProducts.py
def period_max_neighborhood_probability(self, threshold, radius, sigmas=None): """ Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int...
def period_max_neighborhood_probability(self, threshold, radius, sigmas=None): """ Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int...
[ "Calculates", "the", "neighborhood", "probability", "of", "exceeding", "a", "threshold", "at", "any", "time", "over", "the", "period", "loaded", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L548-L585
[ "def", "period_max_neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ",", "sigmas", "=", "None", ")", ":", "if", "sigmas", "is", "None", ":", "sigmas", "=", "[", "0", "]", "weights", "=", "disk", "(", "radius", ")", "neighborhood_pro...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
MachineLearningEnsembleProducts.load_data
Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default num_samples: Number of samples drawn from predicted pdf condition_threshold: Objects are not written to the grid if condition model probability is...
hagelslag/processing/EnsembleProducts.py
def load_data(self, grid_method="gamma", num_samples=1000, condition_threshold=0.5, zero_inflate=False, percentile=None): """ Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default ...
def load_data(self, grid_method="gamma", num_samples=1000, condition_threshold=0.5, zero_inflate=False, percentile=None): """ Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default ...
[ "Reads", "the", "track", "forecasts", "and", "converts", "them", "to", "grid", "point", "values", "based", "on", "random", "sampling", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L631-L721
[ "def", "load_data", "(", "self", ",", "grid_method", "=", "\"gamma\"", ",", "num_samples", "=", "1000", ",", "condition_threshold", "=", "0.5", ",", "zero_inflate", "=", "False", ",", "percentile", "=", "None", ")", ":", "self", ".", "percentile", "=", "pe...
6fb6c3df90bf4867e13a97d3460b14471d107df1