repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
nion-software/nionswift | nion/swift/command.py | bootstrap_main | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | python | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | [
"def",
"bootstrap_main",
"(",
"args",
")",
":",
"version_info",
"=",
"sys",
".",
"version_info",
"if",
"version_info",
".",
"major",
"!=",
"3",
"or",
"version_info",
".",
"minor",
"<",
"6",
":",
"return",
"None",
",",
"\"python36\"",
"main_fn",
"=",
"load_... | Main function explicitly called from the C++ code.
Return the main application object. | [
"Main",
"function",
"explicitly",
"called",
"from",
"the",
"C",
"++",
"code",
".",
"Return",
"the",
"main",
"application",
"object",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/command.py#L49-L60 |
nion-software/nionswift | nion/swift/model/Profile.py | _migrate_library | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | python | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | [
"def",
"_migrate_library",
"(",
"workspace_dir",
":",
"pathlib",
".",
"Path",
",",
"do_logging",
":",
"bool",
"=",
"True",
")",
"->",
"pathlib",
".",
"Path",
":",
"library_path_11",
"=",
"workspace_dir",
"/",
"\"Nion Swift Workspace.nslib\"",
"library_path_12",
"=... | Migrate library to latest version. | [
"Migrate",
"library",
"to",
"latest",
"version",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Profile.py#L99-L117 |
base4sistemas/satcfe | satcfe/resposta/consultarstatusoperacional.py | RespostaConsultarStatusOperacional.status | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | python | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | [
"def",
"status",
"(",
"self",
")",
":",
"for",
"valor",
",",
"rotulo",
"in",
"ESTADOS_OPERACAO",
":",
"if",
"self",
".",
"ESTADO_OPERACAO",
"==",
"valor",
":",
"return",
"rotulo",
"return",
"u'(desconhecido: {})'",
".",
"format",
"(",
"self",
".",
"ESTADO_OP... | Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT". | [
"Nome",
"amigável",
"do",
"campo",
"ESTADO_OPERACAO",
"conforme",
"a",
"Tabela",
"de",
"Informações",
"do",
"Status",
"do",
"SAT",
"."
] | train | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L123-L130 |
base4sistemas/satcfe | satcfe/resposta/consultarstatusoperacional.py | RespostaConsultarStatusOperacional.analisar | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | python | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConsultarStatusOperacional'",
",",
"classe_resposta",
"=",
"RespostaConsultarStatusOperacional",
",",
"campos",
"=",
"... | Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaConsultarStatusOperacional",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | train | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L134-L175 |
djgagne/hagelslag | hagelslag/util/merge_forecast_data.py | merge_input_csv_forecast_json | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | python | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | [
"def",
"merge_input_csv_forecast_json",
"(",
"input_csv_file",
",",
"forecast_json_path",
",",
"condition_models",
",",
"dist_models",
")",
":",
"try",
":",
"run_date",
"=",
"input_csv_file",
"[",
":",
"-",
"4",
"]",
".",
"split",
"(",
"\"_\"",
")",
"[",
"-",
... | Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Path to the forecast json files toplevel directory
condition_models: List of models used to forecast hail or... | [
"Reads",
"forecasts",
"from",
"json",
"files",
"and",
"merges",
"them",
"with",
"the",
"input",
"data",
"from",
"the",
"step",
"csv",
"files",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/merge_forecast_data.py#L53-L107 |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.mark_data_dirty | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | python | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | [
"def",
"mark_data_dirty",
"(",
"self",
")",
":",
"self",
".",
"__cache",
".",
"set_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
".",
"__cache_property_name",
")",
"self",
".",
"__initialize_cache",
"(",
")",
"self",
".",
"__cached_value_... | Called from item to indicate its data or metadata has changed. | [
"Called",
"from",
"item",
"to",
"indicate",
"its",
"data",
"or",
"metadata",
"has",
"changed",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L56-L60 |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.__initialize_cache | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | python | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | [
"def",
"__initialize_cache",
"(",
"self",
")",
":",
"if",
"self",
".",
"__cached_value_dirty",
"is",
"None",
":",
"self",
".",
"__cached_value_dirty",
"=",
"self",
".",
"__cache",
".",
"is_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
"... | Initialize the cache values (cache values are used for optimization). | [
"Initialize",
"the",
"cache",
"values",
"(",
"cache",
"values",
"are",
"used",
"for",
"optimization",
")",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L62-L66 |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.recompute_if_necessary | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | python | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | [
"def",
"recompute_if_necessary",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"if",
"self",
".",
"__cached_value_dirty",
":",
"with",
"self",
".",
"__is_recomputing_lock",
":",
"is_recomputing",
"=",
"self",
".",
"__is_recomputi... | Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing. | [
"Recompute",
"the",
"data",
"on",
"a",
"thread",
"if",
"necessary",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L68-L100 |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.recompute_data | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | python | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | [
"def",
"recompute_data",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"with",
"self",
".",
"__recompute_lock",
":",
"if",
"self",
".",
"__cached_value_dirty",
":",
"try",
":",
"calculated_data",
"=",
"self",
".",
"get_calcul... | Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will not be marked dirty. | [
"Compute",
"the",
"data",
"associated",
"with",
"this",
"processor",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L102-L142 |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailManager.thumbnail_source_for_display_item | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | python | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | [
"def",
"thumbnail_source_for_display_item",
"(",
"self",
",",
"ui",
",",
"display_item",
":",
"DisplayItem",
".",
"DisplayItem",
")",
"->",
"ThumbnailSource",
":",
"with",
"self",
".",
"__lock",
":",
"thumbnail_source",
"=",
"self",
".",
"__thumbnail_sources",
"."... | Returned ThumbnailSource must be closed. | [
"Returned",
"ThumbnailSource",
"must",
"be",
"closed",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L242-L256 |
nion-software/nionswift | nion/swift/model/PlugInManager.py | load_plug_ins | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | python | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | [
"def",
"load_plug_ins",
"(",
"app",
",",
"root_dir",
")",
":",
"global",
"extensions",
"ui",
"=",
"app",
".",
"ui",
"# a list of directories in which sub-directories PlugIns will be searched.",
"subdirectories",
"=",
"[",
"]",
"# the default location is where the directory ma... | Load plug-ins. | [
"Load",
"plug",
"-",
"ins",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/PlugInManager.py#L140-L283 |
softvar/simplegist | simplegist/comments.py | Comments.getMyID | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | python | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | [
"def",
"getMyID",
"(",
"self",
",",
"gist_name",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s'",
"%",
"BASE_URL",
"+",
"'/users/%s/gists'",
"%",
"self",
".",
"user",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"if",
"(",
... | Getting gistID of a gist in order to make the workflow
easy and uninterrupted. | [
"Getting",
"gistID",
"of",
"a",
"gist",
"in",
"order",
"to",
"make",
"the",
"workflow",
"easy",
"and",
"uninterrupted",
"."
] | train | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/comments.py#L10-L29 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.close | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | python | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | [
"def",
"close",
"(",
"self",
")",
":",
"assert",
"self",
".",
"__closed",
"==",
"False",
"self",
".",
"__closed",
"=",
"True",
"self",
".",
"finish_periodic",
"(",
")",
"# required to finish periodic operations during tests",
"# dialogs",
"for",
"weak_dialog",
"in... | Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close each
document con... | [
"Close",
"the",
"document",
"controller",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L130-L194 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.add_periodic | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | python | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | [
"def",
"add_periodic",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"class",
"PeriodicListener",
":",
"def",
"__init__",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"self",
".",
"interval",
"=",
... | Add a listener function and return listener token. Token can be closed or deleted to unlisten. | [
"Add",
"a",
"listener",
"function",
"and",
"return",
"listener",
"token",
".",
"Token",
"can",
"be",
"closed",
"or",
"deleted",
"to",
"unlisten",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L562-L589 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.__update_display_items_model | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | python | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | [
"def",
"__update_display_items_model",
"(",
"self",
",",
"display_items_model",
":",
"ListModel",
".",
"FilteredListModel",
",",
"data_group",
":",
"typing",
".",
"Optional",
"[",
"DataGroup",
".",
"DataGroup",
"]",
",",
"filter_id",
":",
"typing",
".",
"Optional"... | Update the data item model with a new container, filter, and sorting.
This is called when the data item model is created or when the user changes
the data group or sorting settings. | [
"Update",
"the",
"data",
"item",
"model",
"with",
"a",
"new",
"container",
"filter",
"and",
"sorting",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L658-L694 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.focused_data_item | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | python | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | [
"def",
"focused_data_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DataItem",
".",
"DataItem",
"]",
":",
"return",
"self",
".",
"__focused_display_item",
".",
"data_item",
"if",
"self",
".",
"__focused_display_item",
"else",
"None"
] | Return the data item with keyboard focus. | [
"Return",
"the",
"data",
"item",
"with",
"keyboard",
"focus",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L772-L774 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.selected_display_item | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | python | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | [
"def",
"selected_display_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DisplayItem",
".",
"DisplayItem",
"]",
":",
"# first check for the [focused] data browser",
"display_item",
"=",
"self",
".",
"focused_display_item",
"if",
"not",
"display_item",
... | Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel. | [
"Return",
"the",
"selected",
"display",
"item",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L795-L805 |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController._get_two_data_sources | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | python | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | [
"def",
"_get_two_data_sources",
"(",
"self",
")",
":",
"selected_display_items",
"=",
"self",
".",
"selected_display_items",
"if",
"len",
"(",
"selected_display_items",
")",
"<",
"2",
":",
"selected_display_items",
"=",
"list",
"(",
")",
"display_item",
"=",
"self... | Get two sensible data sources, which may be the same. | [
"Get",
"two",
"sensible",
"data",
"sources",
"which",
"may",
"be",
"the",
"same",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L2053-L2092 |
nion-software/nionswift | nion/swift/ImageCanvasItem.py | calculate_origin_and_size | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | python | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | [
"def",
"calculate_origin_and_size",
"(",
"canvas_size",
",",
"data_shape",
",",
"image_canvas_mode",
",",
"image_zoom",
",",
"image_position",
")",
"->",
"typing",
".",
"Tuple",
"[",
"typing",
".",
"Any",
",",
"typing",
".",
"Any",
"]",
":",
"if",
"data_shape"... | Calculate origin and size for canvas size, data shape, and image display parameters. | [
"Calculate",
"origin",
"and",
"size",
"for",
"canvas",
"size",
"data",
"shape",
"and",
"image",
"display",
"parameters",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/ImageCanvasItem.py#L332-L360 |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | read_library | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | python | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | [
"def",
"read_library",
"(",
"persistent_storage_system",
",",
"ignore_older_files",
")",
"->",
"typing",
".",
"Dict",
":",
"data_item_uuids",
"=",
"set",
"(",
")",
"utilized_deletions",
"=",
"set",
"(",
")",
"# the uuid's skipped due to being deleted",
"deletions",
"=... | Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items. | [
"Read",
"data",
"items",
"from",
"the",
"data",
"reference",
"handler",
"and",
"return",
"as",
"a",
"list",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L419-L567 |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | auto_migrate_storage_system | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | python | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | [
"def",
"auto_migrate_storage_system",
"(",
"*",
",",
"persistent_storage_system",
"=",
"None",
",",
"new_persistent_storage_system",
"=",
"None",
",",
"data_item_uuids",
"=",
"None",
",",
"deletions",
":",
"typing",
".",
"List",
"[",
"uuid",
".",
"UUID",
"]",
"=... | Migrate items from the storage system to the object context.
Files in data_item_uuids have already been loaded and are ignored (not migrated).
Files in deletes have been deleted in object context and are ignored (not migrated) and then added
to the utilized deletions list.
Data items will have persis... | [
"Migrate",
"items",
"from",
"the",
"storage",
"system",
"to",
"the",
"object",
"context",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L601-L658 |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | FileStorageSystem.rewrite_properties | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | python | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | [
"def",
"rewrite_properties",
"(",
"self",
",",
"properties",
")",
":",
"with",
"self",
".",
"__properties_lock",
":",
"self",
".",
"__properties",
"=",
"properties",
"self",
".",
"__write_properties",
"(",
"None",
")"
] | Set the properties and write to disk. | [
"Set",
"the",
"properties",
"and",
"write",
"to",
"disk",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L137-L141 |
base4sistemas/satcfe | satcfe/resposta/ativarsat.py | RespostaAtivarSAT.analisar | def analisar(retorno):
"""Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtivarSAT',
classe_resposta=... | python | def analisar(retorno):
"""Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtivarSAT',
classe_resposta=... | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AtivarSAT'",
",",
"classe_resposta",
"=",
"RespostaAtivarSAT",
",",
"campos",
"=",
"(",
"(",
"'numeroSessao'",
"... | Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaAtivarSAT",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | train | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/ativarsat.py#L57-L84 |
nion-software/nionswift | nion/typeshed/HardwareSource_1_0.py | HardwareSource.create_view_task | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | python | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | [
"def",
"create_view_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"buffer_size",
":",
"int",
"=",
"1",
")",
"->",
"ViewTask",
":",
"..."
] | Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the view. Pass None for defaults.... | [
"Create",
"a",
"view",
"task",
"for",
"this",
"hardware",
"source",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/typeshed/HardwareSource_1_0.py#L135-L153 |
ajk8/hatchery | hatchery/config.py | from_yaml | def from_yaml():
""" Load configuration from yaml source(s), cached to only run once """
default_yaml_str = snippets.get_snippet_content('hatchery.yml')
ret = yaml.load(default_yaml_str, Loader=yaml.RoundTripLoader)
for config_path in CONFIG_LOCATIONS:
config_path = os.path.expanduser(config_pat... | python | def from_yaml():
""" Load configuration from yaml source(s), cached to only run once """
default_yaml_str = snippets.get_snippet_content('hatchery.yml')
ret = yaml.load(default_yaml_str, Loader=yaml.RoundTripLoader)
for config_path in CONFIG_LOCATIONS:
config_path = os.path.expanduser(config_pat... | [
"def",
"from_yaml",
"(",
")",
":",
"default_yaml_str",
"=",
"snippets",
".",
"get_snippet_content",
"(",
"'hatchery.yml'",
")",
"ret",
"=",
"yaml",
".",
"load",
"(",
"default_yaml_str",
",",
"Loader",
"=",
"yaml",
".",
"RoundTripLoader",
")",
"for",
"config_pa... | Load configuration from yaml source(s), cached to only run once | [
"Load",
"configuration",
"from",
"yaml",
"source",
"(",
"s",
")",
"cached",
"to",
"only",
"run",
"once"
] | train | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L23-L40 |
ajk8/hatchery | hatchery/config.py | from_pypirc | def from_pypirc(pypi_repository):
""" Load configuration from .pypirc file, cached to only run once """
ret = {}
pypirc_locations = PYPIRC_LOCATIONS
for pypirc_path in pypirc_locations:
pypirc_path = os.path.expanduser(pypirc_path)
if os.path.isfile(pypirc_path):
parser = con... | python | def from_pypirc(pypi_repository):
""" Load configuration from .pypirc file, cached to only run once """
ret = {}
pypirc_locations = PYPIRC_LOCATIONS
for pypirc_path in pypirc_locations:
pypirc_path = os.path.expanduser(pypirc_path)
if os.path.isfile(pypirc_path):
parser = con... | [
"def",
"from_pypirc",
"(",
"pypi_repository",
")",
":",
"ret",
"=",
"{",
"}",
"pypirc_locations",
"=",
"PYPIRC_LOCATIONS",
"for",
"pypirc_path",
"in",
"pypirc_locations",
":",
"pypirc_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"pypirc_path",
")",
"... | Load configuration from .pypirc file, cached to only run once | [
"Load",
"configuration",
"from",
".",
"pypirc",
"file",
"cached",
"to",
"only",
"run",
"once"
] | train | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L47-L70 |
ajk8/hatchery | hatchery/config.py | pypirc_temp | def pypirc_temp(index_url):
""" Create a temporary pypirc file for interaction with twine """
pypirc_file = tempfile.NamedTemporaryFile(suffix='.pypirc', delete=False)
print(pypirc_file.name)
with open(pypirc_file.name, 'w') as fh:
fh.write(PYPIRC_TEMPLATE.format(index_name=PYPIRC_TEMP_INDEX_NAM... | python | def pypirc_temp(index_url):
""" Create a temporary pypirc file for interaction with twine """
pypirc_file = tempfile.NamedTemporaryFile(suffix='.pypirc', delete=False)
print(pypirc_file.name)
with open(pypirc_file.name, 'w') as fh:
fh.write(PYPIRC_TEMPLATE.format(index_name=PYPIRC_TEMP_INDEX_NAM... | [
"def",
"pypirc_temp",
"(",
"index_url",
")",
":",
"pypirc_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"'.pypirc'",
",",
"delete",
"=",
"False",
")",
"print",
"(",
"pypirc_file",
".",
"name",
")",
"with",
"open",
"(",
"pypirc_file",... | Create a temporary pypirc file for interaction with twine | [
"Create",
"a",
"temporary",
"pypirc",
"file",
"for",
"interaction",
"with",
"twine"
] | train | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L87-L93 |
nion-software/nionswift | nion/swift/Facade.py | get_api | def get_api(version: str, ui_version: str=None) -> API_1:
"""Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2".
"""
ui_version = ui_version if ui_version else "~1.0"
return _get_api_with_app(version, ui_version, ApplicationModule.app) | python | def get_api(version: str, ui_version: str=None) -> API_1:
"""Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2".
"""
ui_version = ui_version if ui_version else "~1.0"
return _get_api_with_app(version, ui_version, ApplicationModule.app) | [
"def",
"get_api",
"(",
"version",
":",
"str",
",",
"ui_version",
":",
"str",
"=",
"None",
")",
"->",
"API_1",
":",
"ui_version",
"=",
"ui_version",
"if",
"ui_version",
"else",
"\"~1.0\"",
"return",
"_get_api_with_app",
"(",
"version",
",",
"ui_version",
",",... | Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2". | [
"Get",
"a",
"versioned",
"interface",
"matching",
"the",
"given",
"version",
"and",
"ui_version",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3315-L3321 |
nion-software/nionswift | nion/swift/Facade.py | Graphic.mask_xdata_with_shape | def mask_xdata_with_shape(self, shape: DataAndMetadata.ShapeType) -> DataAndMetadata.DataAndMetadata:
"""Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
mask = self._graphic.get_mask(shape)
return DataAndMetadata.DataA... | python | def mask_xdata_with_shape(self, shape: DataAndMetadata.ShapeType) -> DataAndMetadata.DataAndMetadata:
"""Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
mask = self._graphic.get_mask(shape)
return DataAndMetadata.DataA... | [
"def",
"mask_xdata_with_shape",
"(",
"self",
",",
"shape",
":",
"DataAndMetadata",
".",
"ShapeType",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"mask",
"=",
"self",
".",
"_graphic",
".",
"get_mask",
"(",
"shape",
")",
"return",
"DataAndMetadata",... | Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"mask",
"created",
"by",
"this",
"graphic",
"as",
"extended",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L760-L768 |
nion-software/nionswift | nion/swift/Facade.py | Graphic.end | def end(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("end", value) | python | def end(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("end", value) | [
"def",
"end",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Union",
"[",
"float",
",",
"NormPointType",
"]",
")",
"->",
"None",
":",
"self",
".",
"set_property",
"(",
"\"end\"",
",",
"value",
")"
] | Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line. | [
"Set",
"the",
"end",
"property",
"in",
"relative",
"coordinates",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L818-L822 |
nion-software/nionswift | nion/swift/Facade.py | Graphic.start | def start(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("start", value) | python | def start(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("start", value) | [
"def",
"start",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Union",
"[",
"float",
",",
"NormPointType",
"]",
")",
"->",
"None",
":",
"self",
".",
"set_property",
"(",
"\"start\"",
",",
"value",
")"
] | Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line. | [
"Set",
"the",
"end",
"property",
"in",
"relative",
"coordinates",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L874-L878 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.data | def data(self, data: numpy.ndarray) -> None:
"""Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes
"""
self.__data_item.set_data(numpy.copy(data)) | python | def data(self, data: numpy.ndarray) -> None:
"""Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes
"""
self.__data_item.set_data(numpy.copy(data)) | [
"def",
"data",
"(",
"self",
",",
"data",
":",
"numpy",
".",
"ndarray",
")",
"->",
"None",
":",
"self",
".",
"__data_item",
".",
"set_data",
"(",
"numpy",
".",
"copy",
"(",
"data",
")",
")"
] | Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes | [
"Set",
"the",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L994-L1003 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.display_xdata | def display_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__disp... | python | def display_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__disp... | [
"def",
"display_xdata",
"(",
"self",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"display_data_channel",
"=",
"self",
".",
"__display_item",
".",
"display_data_channel",
"return",
"display_data_channel",
".",
"get_calculated_display_values",
"(",
"True",
... | Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"extended",
"data",
"of",
"this",
"data",
"item",
"display",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1037-L1047 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.set_dimensional_calibrations | def set_dimensional_calibrations(self, dimensional_calibrations: typing.List[CalibrationModule.Calibration]) -> None:
"""Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: ... | python | def set_dimensional_calibrations(self, dimensional_calibrations: typing.List[CalibrationModule.Calibration]) -> None:
"""Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: ... | [
"def",
"set_dimensional_calibrations",
"(",
"self",
",",
"dimensional_calibrations",
":",
"typing",
".",
"List",
"[",
"CalibrationModule",
".",
"Calibration",
"]",
")",
"->",
"None",
":",
"self",
".",
"__data_item",
".",
"set_dimensional_calibrations",
"(",
"dimensi... | Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: Yes | [
"Set",
"the",
"dimensional",
"calibrations",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1080-L1089 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.get_metadata_value | def get_metadata_value(self, key: str) -> typing.Any:
"""Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a cu... | python | def get_metadata_value(self, key: str) -> typing.Any:
"""Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a cu... | [
"def",
"get_metadata_value",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"typing",
".",
"Any",
":",
"return",
"self",
".",
"_data_item",
".",
"get_metadata_value",
"(",
"key",
")"
] | Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the '<group>.<att... | [
"Get",
"the",
"metadata",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1138-L1154 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.set_metadata_value | def set_metadata_value(self, key: str, value: typing.Any) -> None:
"""Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
... | python | def set_metadata_value(self, key: str, value: typing.Any) -> None:
"""Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
... | [
"def",
"set_metadata_value",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"typing",
".",
"Any",
")",
"->",
"None",
":",
"self",
".",
"_data_item",
".",
"set_metadata_value",
"(",
"key",
",",
"value",
")"
] | Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the '<group>.<att... | [
"Set",
"the",
"metadata",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1156-L1172 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.graphics | def graphics(self) -> typing.List[Graphic]:
"""Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes
"""
return [Graphic(graphic) for graphic in self.__display_item.graphics] | python | def graphics(self) -> typing.List[Graphic]:
"""Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes
"""
return [Graphic(graphic) for graphic in self.__display_item.graphics] | [
"def",
"graphics",
"(",
"self",
")",
"->",
"typing",
".",
"List",
"[",
"Graphic",
"]",
":",
"return",
"[",
"Graphic",
"(",
"graphic",
")",
"for",
"graphic",
"in",
"self",
".",
"__display_item",
".",
"graphics",
"]"
] | Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"graphics",
"attached",
"to",
"this",
"data",
"item",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1228-L1235 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.add_point_region | def add_point_region(self, y: float, x: float) -> Graphic:
"""Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.... | python | def add_point_region(self, y: float, x: float) -> Graphic:
"""Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.... | [
"def",
"add_point_region",
"(",
"self",
",",
"y",
":",
"float",
",",
"x",
":",
"float",
")",
"->",
"Graphic",
":",
"graphic",
"=",
"Graphics",
".",
"PointGraphic",
"(",
")",
"graphic",
".",
"position",
"=",
"Geometry",
".",
"FloatPoint",
"(",
"y",
",",... | Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.
.. versionadded:: 1.0
Scriptable: Yes | [
"Add",
"a",
"point",
"graphic",
"to",
"the",
"data",
"item",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1241-L1255 |
nion-software/nionswift | nion/swift/Facade.py | DataItem.mask_xdata | def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__display_item.display_data_channel
shape = display_data_... | python | def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__display_item.display_data_channel
shape = display_data_... | [
"def",
"mask_xdata",
"(",
"self",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"display_data_channel",
"=",
"self",
".",
"__display_item",
".",
"display_data_channel",
"shape",
"=",
"display_data_channel",
".",
"display_data_shape",
"mask",
"=",
"numpy",... | Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"mask",
"by",
"combining",
"any",
"mask",
"graphics",
"on",
"this",
"data",
"item",
"as",
"extended",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1294-L1307 |
nion-software/nionswift | nion/swift/Facade.py | DisplayPanel.data_item | def data_item(self) -> DataItem:
"""Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_panel = self.__display_panel
if not display_panel:
return None
data_item = display_panel.data_item
... | python | def data_item(self) -> DataItem:
"""Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_panel = self.__display_panel
if not display_panel:
return None
data_item = display_panel.data_item
... | [
"def",
"data_item",
"(",
"self",
")",
"->",
"DataItem",
":",
"display_panel",
"=",
"self",
".",
"__display_panel",
"if",
"not",
"display_panel",
":",
"return",
"None",
"data_item",
"=",
"display_panel",
".",
"data_item",
"return",
"DataItem",
"(",
"data_item",
... | Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"data",
"item",
"associated",
"with",
"this",
"display",
"panel",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1384-L1395 |
nion-software/nionswift | nion/swift/Facade.py | DisplayPanel.set_data_item | def set_data_item(self, data_item: DataItem) -> None:
"""Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the sin... | python | def set_data_item(self, data_item: DataItem) -> None:
"""Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the sin... | [
"def",
"set_data_item",
"(",
"self",
",",
"data_item",
":",
"DataItem",
")",
"->",
"None",
":",
"display_panel",
"=",
"self",
".",
"__display_panel",
"if",
"display_panel",
":",
"display_item",
"=",
"data_item",
".",
"_data_item",
".",
"container",
".",
"get_d... | Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the single
data item.
.. versionadded:: 1.0
Sc... | [
"Set",
"the",
"data",
"item",
"associated",
"with",
"this",
"display",
"panel",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1397-L1412 |
nion-software/nionswift | nion/swift/Facade.py | DataGroup.add_data_item | def add_data_item(self, data_item: DataItem) -> None:
"""Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_item = data_item._data_item.container.get_display_item_f... | python | def add_data_item(self, data_item: DataItem) -> None:
"""Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_item = data_item._data_item.container.get_display_item_f... | [
"def",
"add_data_item",
"(",
"self",
",",
"data_item",
":",
"DataItem",
")",
"->",
"None",
":",
"display_item",
"=",
"data_item",
".",
"_data_item",
".",
"container",
".",
"get_display_item_for_data_item",
"(",
"data_item",
".",
"_data_item",
")",
"if",
"data_it... | Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes | [
"Add",
"a",
"data",
"item",
"to",
"the",
"group",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1503-L1514 |
nion-software/nionswift | nion/swift/Facade.py | ViewTask.close | def close(self) -> None:
"""Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed.
"""
self.__data_channel_buffer.stop()
self.__data_channel_buffer.close()
self.__data_channel_buffer = None
if not self.__was_p... | python | def close(self) -> None:
"""Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed.
"""
self.__data_channel_buffer.stop()
self.__data_channel_buffer.close()
self.__data_channel_buffer = None
if not self.__was_p... | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"__data_channel_buffer",
".",
"stop",
"(",
")",
"self",
".",
"__data_channel_buffer",
".",
"close",
"(",
")",
"self",
".",
"__data_channel_buffer",
"=",
"None",
"if",
"not",
"self",
".",
"... | Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed. | [
"Close",
"the",
"task",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1613-L1624 |
nion-software/nionswift | nion/swift/Facade.py | HardwareSource.record | def record(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for t... | python | def record(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for t... | [
"def",
"record",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"timeout",
":",
"float",
"=",
"None",
")",
"->",
"typing",
".",
"List",
"[",
"Da... | Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the record. Pass... | [
"Record",
"data",
"and",
"return",
"a",
"list",
"of",
"data_and_metadata",
"objects",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1764-L1783 |
nion-software/nionswift | nion/swift/Facade.py | HardwareSource.create_record_task | def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask:
"""Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_p... | python | def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask:
"""Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_p... | [
"def",
"create_record_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
")",
"->",
"RecordTask",
":",
"return",
"RecordTask",
"(",
"self",
".",
"__hard... | Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the record. Pass None for def... | [
"Create",
"a",
"record",
"task",
"for",
"this",
"hardware",
"source",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1785-L1801 |
nion-software/nionswift | nion/swift/Facade.py | HardwareSource.create_view_task | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | python | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | [
"def",
"create_view_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"buffer_size",
":",
"int",
"=",
"1",
")",
"->",
"ViewTask",
":",
"return",... | Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the view. Pass None for defaults.... | [
"Create",
"a",
"view",
"task",
"for",
"this",
"hardware",
"source",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1803-L1821 |
nion-software/nionswift | nion/swift/Facade.py | HardwareSource.grab_next_to_finish | 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... | python | 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",
"]",
":",
"self",
".",
"start_playing",
"(",
")",
"return",
"self",
".",
"__hardware_sourc... | 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... | [
"Grabs",
"the",
"next",
"frame",
"to",
"finish",
"and",
"returns",
"it",
"as",
"data",
"and",
"metadata",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1823-L1837 |
nion-software/nionswift | nion/swift/Facade.py | Instrument.set_control_output | 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 ... | python | 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",
":",
"self",
".",
"__instrument",
".",
"set_control_output",
"(",
"name",
",",
"value"... | 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... | [
"Set",
"the",
"value",
"of",
"a",
"control",
"asynchronously",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1911-L1942 |
nion-software/nionswift | nion/swift/Facade.py | Instrument.get_property_as_float | 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... | python | 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",
"float",
"(",
"self",
".",
"__instrument",
".",
"get_property",
"(",
"name",
")",
")"
] | 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",
"the",
"value",
"of",
"a",
"float",
"property",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1961-L1972 |
nion-software/nionswift | nion/swift/Facade.py | Instrument.set_property_as_float | 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
... | python | 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",
":",
"self",
".",
"__instrument",
".",
"set_property",
"(",
"name",
",",
"float",
"(",
"value",
")",
")"
] | 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 | [
"Set",
"the",
"value",
"of",
"a",
"float",
"property",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1974-L1986 |
nion-software/nionswift | nion/swift/Facade.py | Library.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... | python | 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",
"[",
"DataItem",
"(",
"data_item",
")",
"for",
"data_item",
"in",
"self",
".",
"__document_model",
".",
"data_items",
"]"
] | Return the list of data items.
:return: The list of :py:class:`nion.swift.Facade.DataItem` objects.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"list",
"of",
"data",
"items",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2205-L2214 |
nion-software/nionswift | nion/swift/Facade.py | Library.display_items | 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... | python | 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",
"[",
"Display",
"(",
"display_item",
")",
"for",
"display_item",
"in",
"self",
".",
"__document_model",
".",
"display_items",
"]"
] | Return the list of display items.
:return: The list of :py:class:`nion.swift.Facade.Display` objects.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"list",
"of",
"display",
"items",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2217-L2226 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_source_data_items | 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... | python | 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",
"[",
"DataItem",
"(",
"data_item",
")",
"for",
"data_item",
"in",
"self",
".",
"_document_model",
".",
"g... | 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 | [
"Return",
"the",
"list",
"of",
"data",
"items",
"that",
"are",
"data",
"sources",
"for",
"the",
"data",
"item",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2228-L2237 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_dependent_data_items | 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(... | python | 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",
"[",
"DataItem",
"(",
"data_item",
")",
"for",
"data_item",
"in",
"self",
".",
"_document_model",
".",
... | 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",
"the",
"dependent",
"data",
"items",
"the",
"data",
"item",
"argument",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2239-L2248 |
nion-software/nionswift | nion/swift/Facade.py | Library.create_data_item | 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... | python | 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",
":",
"data_item",
"=",
"DataItemModule",
".",
"DataItem",
"(",
")",
"data_item",
".",
"ensure_data_source",
"(",
")",
"if",
"title",
"is",
"not",
"None",
... | 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 | [
"Create",
"an",
"empty",
"data",
"item",
"in",
"the",
"library",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2250-L2266 |
nion-software/nionswift | nion/swift/Facade.py | Library.create_data_item_from_data | 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... | python | 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",
":",
"return",
"self",
".",
"create_data_item_from_data_and_metadata",
"(",
"DataAndMetadata",
".",
"DataAn... | 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... | [
"Create",
"a",
"data",
"item",
"in",
"the",
"library",
"from",
"an",
"ndarray",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2268-L2284 |
nion-software/nionswift | nion/swift/Facade.py | Library.create_data_item_from_data_and_metadata | 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 ... | python | 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",
":",
"data_item",
"=",
"DataItemModule",
".",
"new_data_item",
"(",... | 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.
... | [
"Create",
"a",
"data",
"item",
"in",
"the",
"library",
"from",
"a",
"data",
"and",
"metadata",
"object",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2286-L2306 |
nion-software/nionswift | nion/swift/Facade.py | Library.copy_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) | python | 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",
":",
"data_item",
"=",
"copy",
".",
"deepcopy",
"(",
"data_item",
".",
"_data_item",
")",
"self",
".",
"__document_model",
".",
"append_data_item",
"(",
"data_item"... | Copy a data item.
.. versionadded:: 1.0
Scriptable: No | [
"Copy",
"a",
"data",
"item",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2308-L2317 |
nion-software/nionswift | nion/swift/Facade.py | Library.snapshot_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)
... | python | 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",
":",
"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.
.. versionadded:: 1.0
Scriptable: No | [
"Snapshot",
"a",
"data",
"item",
".",
"Similar",
"to",
"copy",
"but",
"with",
"a",
"data",
"snapshot",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2319-L2328 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_or_create_data_group | 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
... | python | 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",
":",
"return",
"DataGroup",
"(",
"self",
".",
"__document_model",
".",
"get_or_create_data_group",
"(",
"title",
")",
")"
] | 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 | [
"Get",
"(",
"or",
"create",
")",
"a",
"data",
"group",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2330-L2341 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_data_item_for_hardware_source | 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.
... | python | 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",
"="... | 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... | [
"Get",
"the",
"data",
"item",
"associated",
"with",
"hardware",
"source",
"and",
"(",
"optional",
")",
"channel",
"id",
"and",
"processor_id",
".",
"Optionally",
"create",
"if",
"missing",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2376-L2394 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_data_item_for_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.
... | python | 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",
":",
"document_model",
"=",... | 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... | [
"Get",
"the",
"data",
"item",
"associated",
"with",
"data",
"item",
"reference",
"key",
".",
"Optionally",
"create",
"if",
"missing",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2396-L2418 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_data_item_by_uuid | 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... | python | 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",
":",
"data_item",
"=",
"self",
".",
"_document_model",
".",
"get_data_item_by_uuid",
"(",
"data_item_uuid",
")",
"return",
"DataItem",
"(",
... | Get the data item with the given UUID.
.. versionadded:: 1.0
Status: Provisional
Scriptable: Yes | [
"Get",
"the",
"data",
"item",
"with",
"the",
"given",
"UUID",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2420-L2429 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_graphic_by_uuid | 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... | python | 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",
":",
"for",
"display_item",
"in",
"self",
".",
"_document_model",
".",
"display_items",
":",
"for",
"graphic",
"in",
"display_item",
".",
"gr... | Get the graphic with the given UUID.
.. versionadded:: 1.0
Status: Provisional
Scriptable: Yes | [
"Get",
"the",
"graphic",
"with",
"the",
"given",
"UUID",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2431-L2443 |
nion-software/nionswift | nion/swift/Facade.py | Library.has_library_value | 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)
... | python | 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",
":",
"desc",
"=",
"Metadata",
".",
"session_key_map",
".",
"get",
"(",
"key",
")",
"if",
"desc",
"is",
"not",
"None",
":",
"field_id",
"=",
"desc",
"[",
"'path'",
"]"... | 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 | [
"Return",
"whether",
"the",
"library",
"value",
"for",
"the",
"given",
"key",
"exists",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2445-L2458 |
nion-software/nionswift | nion/swift/Facade.py | Library.get_library_value | 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... | python | 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",
":",
"desc",
"=",
"Metadata",
".",
"session_key_map",
".",
"get",
"(",
"key",
")",
"if",
"desc",
"is",
"not",
"None",
":",
"field_id",
"=",
"desc",
"[",... | Get the library value for the given key.
Please consult the developer documentation for a list of valid keys.
.. versionadded:: 1.0
Scriptable: Yes | [
"Get",
"the",
"library",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2460-L2473 |
nion-software/nionswift | nion/swift/Facade.py | Library.set_library_value | 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)
... | python | 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",
":",
"desc",
"=",
"Metadata",
".",
"session_key_map",
".",
"get",
"(",
"key",
")",
"if",
"desc",
"is",
"not",
"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 | [
"Set",
"the",
"library",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2475-L2489 |
nion-software/nionswift | nion/swift/Facade.py | Library.delete_library_value | 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... | python | 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",
":",
"desc",
"=",
"Metadata",
".",
"session_key_map",
".",
"get",
"(",
"key",
")",
"if",
"desc",
"is",
"not",
"None",
":",
"field_id",
"=",
"desc",
"[",
"'path'",
... | Delete the library value for the given key.
Please consult the developer documentation for a list of valid keys.
.. versionadded:: 1.0
Scriptable: Yes | [
"Delete",
"the",
"library",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2491-L2505 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.all_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] | python | 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",
"[",
"DisplayPanel",
"(",
"display_panel",
")",
"for",
"display_panel",
"in",
"self",
".",
"__document_controller",
".",
"workspace_controller",
... | Return the list of display panels currently visible.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"list",
"of",
"display",
"panels",
"currently",
"visible",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2585-L2592 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.get_display_panel_by_id | 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... | python | 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",
":",
"display_panel",
"=",
"next",
"(",
"(",
"display_panel",
"for",
"display_panel",
"in",
"self",
".",
"__document_controller",
".",
"workspace_controller",
... | Return display panel with the identifier.
.. versionadded:: 1.0
Status: Provisional
Scriptable: Yes | [
"Return",
"display",
"panel",
"with",
"the",
"identifier",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2594-L2605 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.display_data_item | 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... | python | 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",
")",
":",
"for",
"display_panel",
"in",
"self",
".",
"__document_controller",
".",
"workspace_controller",
"... | 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 | [
"Display",
"a",
"new",
"data",
"item",
"and",
"gives",
"it",
"keyboard",
"focus",
".",
"Uses",
"existing",
"display",
"if",
"it",
"is",
"already",
"displayed",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2607-L2625 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.show_get_string_message_box | 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... | python | 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",
")",
... | 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... | [
"Show",
"a",
"dialog",
"box",
"and",
"ask",
"for",
"a",
"string",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2644-L2659 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.create_data_item_from_data | 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
... | python | 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",
":",
"return",
"DataItem",
"(",
"self",
".",
"__document_controller",
".",
"add_data",
"(",
"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 | [
"Create",
"a",
"data",
"item",
"in",
"the",
"library",
"from",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2685-L2694 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.create_data_item_from_data_and_metadata | 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... | python | 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",
":",
"data_item",
"=",
"DataItemModule",
".",
"new_data_item",
"(",... | 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 | [
"Create",
"a",
"data",
"item",
"in",
"the",
"library",
"from",
"the",
"data",
"and",
"metadata",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2696-L2709 |
nion-software/nionswift | nion/swift/Facade.py | DocumentWindow.get_or_create_data_group | 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... | python | 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",
":",
"return",
"DataGroup",
"(",
"self",
".",
"__document_controller",
".",
"document_model",
".",
"get_or_create_data_group",
"(",
"title",
")",
")"
] | 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 | [
"Get",
"(",
"or",
"create",
")",
"a",
"data",
"group",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2711-L2720 |
nion-software/nionswift | nion/swift/Facade.py | Application.document_windows | 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] | python | 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",
"[",
"DocumentWindow",
"(",
"document_controller",
")",
"for",
"document_controller",
"in",
"self",
".",
"__application",
".",
"document_controller... | Return the document windows.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"document",
"windows",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2761-L2768 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_calibration | 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... | python | 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",
":",
"return",
"CalibrationModule",
".",... | 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... | [
"Create",
"a",
"calibration",
"object",
"with",
"offset",
"scale",
"and",
"units",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2895-L2910 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_data_descriptor | 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... | python | 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",
":",
"return",
"DataAndMetadata",
".",
"DataD... | 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.
... | [
"Create",
"a",
"data",
"descriptor",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2912-L2923 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_data_and_metadata | 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... | python | 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",... | 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... | [
"Create",
"a",
"data_and_metadata",
"object",
"from",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2925-L2941 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_data_and_metadata_from_data | 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... | python | 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",
"[",
"Calibrati... | 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 | [
"Create",
"a",
"data_and_metadata",
"object",
"from",
"data",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2943-L2952 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_data_and_metadata_io_handler | 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
"""
... | python | 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",
")",
":",
"class",
"DelegateIOHandler",
"(",
"ImportExportManager",
".",
"ImportExportHandler",
")",
":",
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"__in... | 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",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L2954-L3008 |
nion-software/nionswift | nion/swift/Facade.py | API_1.create_panel | 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
... | python | 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",
")",
":",
"panel_id",
"=",
"panel_delegate",
".",
"panel_id",
"panel_name",
"=",
"panel_delegate",
".",
"panel_name",
"panel_positions",
"=",
"getattr",
"(",
"panel_delegate",
",",
"\"panel_positions\"",
","... | 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 ... | [
"Create",
"a",
"utility",
"panel",
"that",
"can",
"be",
"attached",
"to",
"a",
"window",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3107-L3155 |
nion-software/nionswift | nion/swift/Facade.py | API_1.get_hardware_source_by_id | 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... | python | 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",
")",
":",
"actual_version",
"=",
"\"1.0.0\"",
"if",
"Utility",
".",
"compare_versions",
"(",
"version",
",",
"actual_version",
")",
">",
"0",
":... | Return the hardware source API matching the hardware_source_id and version.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"hardware",
"source",
"API",
"matching",
"the",
"hardware_source_id",
"and",
"version",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3166-L3177 |
nion-software/nionswift | nion/swift/Facade.py | API_1.library | def library(self) -> Library:
"""Return the library object.
.. versionadded:: 1.0
Scriptable: Yes
"""
assert self.__app.document_model
return Library(self.__app.document_model) | python | 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",
":",
"assert",
"self",
".",
"__app",
".",
"document_model",
"return",
"Library",
"(",
"self",
".",
"__app",
".",
"document_model",
")"
] | Return the library object.
.. versionadded:: 1.0
Scriptable: Yes | [
"Return",
"the",
"library",
"object",
"."
] | train | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3197-L3205 |
djgagne/hagelslag | hagelslag/util/munkres.py | make_cost_matrix | 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... | python | 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",
")",
":",
"cost_matrix",
"=",
"[",
"]",
"for",
"row",
"in",
"profit_matrix",
":",
"cost_matrix",
".",
"append",
"(",
"[",
"inversion_function",
"(",
"value",
")",
"for",
"value",
"in",... | 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... | [
"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",... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L676-L709 |
djgagne/hagelslag | hagelslag/util/munkres.py | print_matrix | 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... | python | 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",
")",
":",
"import",
"math",
"if",
"msg",
"is",
"not",
"None",
":",
"print",
"(",
"msg",
")",
"# Calculate the appropriate format width.",
"width",
"=",
"0",
"for",
"row",
"in",
"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 | [
"Convenience",
"function",
":",
"Displays",
"the",
"contents",
"of",
"a",
"matrix",
"of",
"integers",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L711-L742 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.pad_matrix | 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... | python | 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",
")",
":",
"max_columns",
"=",
"0",
"total_rows",
"=",
"len",
"(",
"matrix",
")",
"for",
"row",
"in",
"matrix",
":",
"max_columns",
"=",
"max",
"(",
"max_columns",
",",
"len",
... | 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 | [
"Pad",
"a",
"possibly",
"non",
"-",
"square",
"matrix",
"to",
"make",
"it",
"square",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L331-L365 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.compute | 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... | python | 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",
")",
":",
"self",
".",
"C",
"=",
"self",
".",
"pad_matrix",
"(",
"cost_matrix",
")",
"self",
".",
"n",
"=",
"len",
"(",
"self",
".",
"C",
")",
"self",
".",
"original_length",
"=",
"len",
"(",
"cost... | 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
... | [
"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... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L367-L423 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__make_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 | python | 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",
")",
":",
"matrix",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"n",
")",
":",
"matrix",
"+=",
"[",
"[",
"val",
"for",
"j",
"in",
"range",
"(",
"n",
")",
"]",
"]",
"return",
"matri... | Create an *n*x*n* matrix, populating it with the specific value. | [
"Create",
"an",
"*",
"n",
"*",
"x",
"*",
"n",
"*",
"matrix",
"populating",
"it",
"with",
"the",
"specific",
"value",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L429-L434 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step1 | 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... | python | 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",
")",
":",
"C",
"=",
"self",
".",
"C",
"n",
"=",
"self",
".",
"n",
"for",
"i",
"in",
"range",
"(",
"n",
")",
":",
"minval",
"=",
"min",
"(",
"self",
".",
"C",
"[",
"i",
"]",
")",
"# Find the minimum value for this ro... | For each row of the matrix, find the smallest element and
subtract it from every element in its row. Go to Step 2. | [
"For",
"each",
"row",
"of",
"the",
"matrix",
"find",
"the",
"smallest",
"element",
"and",
"subtract",
"it",
"from",
"every",
"element",
"in",
"its",
"row",
".",
"Go",
"to",
"Step",
"2",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L436-L450 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step2 | 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... | python | 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",
")",
":",
"n",
"=",
"self",
".",
"n",
"for",
"i",
"in",
"range",
"(",
"n",
")",
":",
"for",
"j",
"in",
"range",
"(",
"n",
")",
":",
"if",
"(",
"self",
".",
"C",
"[",
"i",
"]",
"[",
"j",
"]",
"==",
"0",
")"... | 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. | [
"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",
"... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L452-L469 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step3 | 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):
... | python | 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",
")",
":",
"n",
"=",
"self",
".",
"n",
"count",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"n",
")",
":",
"for",
"j",
"in",
"range",
"(",
"n",
")",
":",
"if",
"self",
".",
"marked",
"[",
"i",
"]",
"[",
"j",
"]... | 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. | [
"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... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L471-L490 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step4 | 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
... | python | 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",
")",
":",
"step",
"=",
"0",
"done",
"=",
"False",
"row",
"=",
"-",
"1",
"col",
"=",
"-",
"1",
"star_col",
"=",
"-",
"1",
"while",
"not",
"done",
":",
"(",
"row",
",",
"col",
")",
"=",
"self",
".",
"__find_a_zero",... | 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... | [
"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",
... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L492-L523 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step5 | 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... | python | 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",
")",
":",
"count",
"=",
"0",
"path",
"=",
"self",
".",
"path",
"path",
"[",
"count",
"]",
"[",
"0",
"]",
"=",
"self",
".",
"Z0_r",
"path",
"[",
"count",
"]",
"[",
"1",
"]",
"=",
"self",
".",
"Z0_c",
"done",
"=",... | 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... | [
"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... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L525-L559 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__step6 | 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()
... | python | 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",
")",
":",
"minval",
"=",
"self",
".",
"__find_smallest",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"if",
"self",
".",
"row_co... | 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. | [
"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",
... | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L561-L575 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__find_smallest | 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]:
... | python | 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",
")",
":",
"minval",
"=",
"sys",
".",
"maxsize",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"n",
")",
":",
"if",
"(",
"not",
"self",
".",
"row_c... | Find the smallest uncovered value in the matrix. | [
"Find",
"the",
"smallest",
"uncovered",
"value",
"in",
"the",
"matrix",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L577-L585 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__find_a_zero | 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... | python | 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",
")",
":",
"row",
"=",
"-",
"1",
"col",
"=",
"-",
"1",
"i",
"=",
"0",
"n",
"=",
"self",
".",
"n",
"done",
"=",
"False",
"while",
"not",
"done",
":",
"j",
"=",
"0",
"while",
"True",
":",
"if",
"(",
"self",
... | Find the first uncovered element with value 0 | [
"Find",
"the",
"first",
"uncovered",
"element",
"with",
"value",
"0"
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L587-L611 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__find_star_in_row | 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
... | python | 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",
")",
":",
"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. | [
"Find",
"the",
"first",
"starred",
"element",
"in",
"the",
"specified",
"row",
".",
"Returns",
"the",
"column",
"index",
"or",
"-",
"1",
"if",
"no",
"starred",
"element",
"was",
"found",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L613-L624 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__find_star_in_col | 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
... | python | 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",
")",
":",
"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. | [
"Find",
"the",
"first",
"starred",
"element",
"in",
"the",
"specified",
"row",
".",
"Returns",
"the",
"row",
"index",
"or",
"-",
"1",
"if",
"no",
"starred",
"element",
"was",
"found",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L626-L637 |
djgagne/hagelslag | hagelslag/util/munkres.py | Munkres.__find_prime_in_row | 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
... | python | 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",
")",
":",
"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. | [
"Find",
"the",
"first",
"prime",
"element",
"in",
"the",
"specified",
"row",
".",
"Returns",
"the",
"column",
"index",
"or",
"-",
"1",
"if",
"no",
"starred",
"element",
"was",
"found",
"."
] | train | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L639-L650 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.