partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
MachineLearningEnsembleProducts.write_grib2
Writes data to grib2 file. Currently, grib codes are set by hand to hail. Args: path: Path to directory containing grib2 files. Returns:
hagelslag/processing/EnsembleProducts.py
def write_grib2(self, path): """ Writes data to grib2 file. Currently, grib codes are set by hand to hail. Args: path: Path to directory containing grib2 files. Returns: """ if self.percentile is None: var_type = "mean" else: ...
def write_grib2(self, path): """ Writes data to grib2 file. Currently, grib codes are set by hand to hail. Args: path: Path to directory containing grib2 files. Returns: """ if self.percentile is None: var_type = "mean" else: ...
[ "Writes", "data", "to", "grib2", "file", ".", "Currently", "grib", "codes", "are", "set", "by", "hand", "to", "hail", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L723-L773
[ "def", "write_grib2", "(", "self", ",", "path", ")", ":", "if", "self", ".", "percentile", "is", "None", ":", "var_type", "=", "\"mean\"", "else", ":", "var_type", "=", "\"p{0:02d}\"", ".", "format", "(", "self", ".", "percentile", ")", "lscale", "=", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleConsensus.init_file
Initializes netCDF file for writing Args: filename: Name of the netCDF file time_units: Units for the time variable in format "<time> since <date string>" Returns: Dataset object
hagelslag/processing/EnsembleProducts.py
def init_file(self, filename, time_units="seconds since 1970-01-01T00:00"): """ Initializes netCDF file for writing Args: filename: Name of the netCDF file time_units: Units for the time variable in format "<time> since <date string>" Returns: Dataset...
def init_file(self, filename, time_units="seconds since 1970-01-01T00:00"): """ Initializes netCDF file for writing Args: filename: Name of the netCDF file time_units: Units for the time variable in format "<time> since <date string>" Returns: Dataset...
[ "Initializes", "netCDF", "file", "for", "writing" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L793-L818
[ "def", "init_file", "(", "self", ",", "filename", ",", "time_units", "=", "\"seconds since 1970-01-01T00:00\"", ")", ":", "if", "os", ".", "access", "(", "filename", ",", "os", ".", "R_OK", ")", ":", "out_data", "=", "Dataset", "(", "filename", ",", "\"r+\...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
EnsembleConsensus.write_to_file
Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables are appended to the current file Args: out_data: Full-path and name of output netCDF file
hagelslag/processing/EnsembleProducts.py
def write_to_file(self, out_data): """ Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables are appended to the current file Args: out_data: Full-path and name of output netCDF file """ full_var_name =...
def write_to_file(self, out_data): """ Outputs data to a netCDF file. If the file does not exist, it will be created. Otherwise, additional variables are appended to the current file Args: out_data: Full-path and name of output netCDF file """ full_var_name =...
[ "Outputs", "data", "to", "a", "netCDF", "file", ".", "If", "the", "file", "does", "not", "exist", "it", "will", "be", "created", ".", "Otherwise", "additional", "variables", "are", "appended", "to", "the", "current", "file" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L820-L846
[ "def", "write_to_file", "(", "self", ",", "out_data", ")", ":", "full_var_name", "=", "self", ".", "consensus_type", "+", "\"_\"", "+", "self", ".", "variable", "if", "\"-hour\"", "in", "self", ".", "consensus_type", ":", "if", "full_var_name", "not", "in", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Workspace.restore
Restore the workspace to the given workspace_uuid. If workspace_uuid is None then create a new workspace and use it.
nion/swift/Workspace.py
def restore(self, workspace_uuid): """ Restore the workspace to the given workspace_uuid. If workspace_uuid is None then create a new workspace and use it. """ workspace = next((workspace for workspace in self.document_model.workspaces if workspace.uuid == workspace_uuid...
def restore(self, workspace_uuid): """ Restore the workspace to the given workspace_uuid. If workspace_uuid is None then create a new workspace and use it. """ workspace = next((workspace for workspace in self.document_model.workspaces if workspace.uuid == workspace_uuid...
[ "Restore", "the", "workspace", "to", "the", "given", "workspace_uuid", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L338-L347
[ "def", "restore", "(", "self", ",", "workspace_uuid", ")", ":", "workspace", "=", "next", "(", "(", "workspace", "for", "workspace", "in", "self", ".", "document_model", ".", "workspaces", "if", "workspace", ".", "uuid", "==", "workspace_uuid", ")", ",", "...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.new_workspace
Create a new workspace, insert into document_model, and return it.
nion/swift/Workspace.py
def new_workspace(self, name=None, layout=None, workspace_id=None, index=None) -> WorkspaceLayout.WorkspaceLayout: """ Create a new workspace, insert into document_model, and return it. """ workspace = WorkspaceLayout.WorkspaceLayout() self.document_model.insert_workspace(index if index is not N...
def new_workspace(self, name=None, layout=None, workspace_id=None, index=None) -> WorkspaceLayout.WorkspaceLayout: """ Create a new workspace, insert into document_model, and return it. """ workspace = WorkspaceLayout.WorkspaceLayout() self.document_model.insert_workspace(index if index is not N...
[ "Create", "a", "new", "workspace", "insert", "into", "document_model", "and", "return", "it", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L363-L373
[ "def", "new_workspace", "(", "self", ",", "name", "=", "None", ",", "layout", "=", "None", ",", "workspace_id", "=", "None", ",", "index", "=", "None", ")", "->", "WorkspaceLayout", ".", "WorkspaceLayout", ":", "workspace", "=", "WorkspaceLayout", ".", "Wo...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.ensure_workspace
Looks for a workspace with workspace_id. If none is found, create a new one, add it, and change to it.
nion/swift/Workspace.py
def ensure_workspace(self, name, layout, workspace_id): """Looks for a workspace with workspace_id. If none is found, create a new one, add it, and change to it. """ workspace = next((workspace for workspace in self.document_model.workspaces if workspace.workspace_id == workspace_id), N...
def ensure_workspace(self, name, layout, workspace_id): """Looks for a workspace with workspace_id. If none is found, create a new one, add it, and change to it. """ workspace = next((workspace for workspace in self.document_model.workspaces if workspace.workspace_id == workspace_id), N...
[ "Looks", "for", "a", "workspace", "with", "workspace_id", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L375-L383
[ "def", "ensure_workspace", "(", "self", ",", "name", ",", "layout", ",", "workspace_id", ")", ":", "workspace", "=", "next", "(", "(", "workspace", "for", "workspace", "in", "self", ".", "document_model", ".", "workspaces", "if", "workspace", ".", "workspace...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.create_workspace
Pose a dialog to name and create a workspace.
nion/swift/Workspace.py
def create_workspace(self) -> None: """ Pose a dialog to name and create a workspace. """ def create_clicked(text): if text: command = Workspace.CreateWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(co...
def create_workspace(self) -> None: """ Pose a dialog to name and create a workspace. """ def create_clicked(text): if text: command = Workspace.CreateWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(co...
[ "Pose", "a", "dialog", "to", "name", "and", "create", "a", "workspace", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L549-L560
[ "def", "create_workspace", "(", "self", ")", "->", "None", ":", "def", "create_clicked", "(", "text", ")", ":", "if", "text", ":", "command", "=", "Workspace", ".", "CreateWorkspaceCommand", "(", "self", ",", "text", ")", "command", ".", "perform", "(", ...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.rename_workspace
Pose a dialog to rename the workspace.
nion/swift/Workspace.py
def rename_workspace(self) -> None: """ Pose a dialog to rename the workspace. """ def rename_clicked(text): if len(text) > 0: command = Workspace.RenameWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(...
def rename_workspace(self) -> None: """ Pose a dialog to rename the workspace. """ def rename_clicked(text): if len(text) > 0: command = Workspace.RenameWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(...
[ "Pose", "a", "dialog", "to", "rename", "the", "workspace", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L562-L573
[ "def", "rename_workspace", "(", "self", ")", "->", "None", ":", "def", "rename_clicked", "(", "text", ")", ":", "if", "len", "(", "text", ")", ">", "0", ":", "command", "=", "Workspace", ".", "RenameWorkspaceCommand", "(", "self", ",", "text", ")", "co...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.remove_workspace
Pose a dialog to confirm removal then remove workspace.
nion/swift/Workspace.py
def remove_workspace(self): """ Pose a dialog to confirm removal then remove workspace. """ def confirm_clicked(): if len(self.document_model.workspaces) > 1: command = Workspace.RemoveWorkspaceCommand(self) command.perform() self.document_con...
def remove_workspace(self): """ Pose a dialog to confirm removal then remove workspace. """ def confirm_clicked(): if len(self.document_model.workspaces) > 1: command = Workspace.RemoveWorkspaceCommand(self) command.perform() self.document_con...
[ "Pose", "a", "dialog", "to", "confirm", "removal", "then", "remove", "workspace", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L575-L586
[ "def", "remove_workspace", "(", "self", ")", ":", "def", "confirm_clicked", "(", ")", ":", "if", "len", "(", "self", ".", "document_model", ".", "workspaces", ")", ">", "1", ":", "command", "=", "Workspace", ".", "RemoveWorkspaceCommand", "(", "self", ")",...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.clone_workspace
Pose a dialog to name and clone a workspace.
nion/swift/Workspace.py
def clone_workspace(self) -> None: """ Pose a dialog to name and clone a workspace. """ def clone_clicked(text): if text: command = Workspace.CloneWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(comman...
def clone_workspace(self) -> None: """ Pose a dialog to name and clone a workspace. """ def clone_clicked(text): if text: command = Workspace.CloneWorkspaceCommand(self, text) command.perform() self.document_controller.push_undo_command(comman...
[ "Pose", "a", "dialog", "to", "name", "and", "clone", "a", "workspace", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L588-L599
[ "def", "clone_workspace", "(", "self", ")", "->", "None", ":", "def", "clone_clicked", "(", "text", ")", ":", "if", "text", ":", "command", "=", "Workspace", ".", "CloneWorkspaceCommand", "(", "self", ",", "text", ")", "command", ".", "perform", "(", ")"...
d43693eaf057b8683b9638e575000f055fede452
train
Workspace.__replace_displayed_display_item
Used in drag/drop support.
nion/swift/Workspace.py
def __replace_displayed_display_item(self, display_panel, display_item, d=None) -> Undo.UndoableCommand: """ Used in drag/drop support. """ self.document_controller.replaced_display_panel_content = display_panel.save_contents() command = DisplayPanel.ReplaceDisplayPanelCommand(self) if d...
def __replace_displayed_display_item(self, display_panel, display_item, d=None) -> Undo.UndoableCommand: """ Used in drag/drop support. """ self.document_controller.replaced_display_panel_content = display_panel.save_contents() command = DisplayPanel.ReplaceDisplayPanelCommand(self) if d...
[ "Used", "in", "drag", "/", "drop", "support", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L792-L802
[ "def", "__replace_displayed_display_item", "(", "self", ",", "display_panel", ",", "display_item", ",", "d", "=", "None", ")", "->", "Undo", ".", "UndoableCommand", ":", "self", ".", "document_controller", ".", "replaced_display_panel_content", "=", "display_panel", ...
d43693eaf057b8683b9638e575000f055fede452
train
bootstrap
Given a set of DistributedROC or DistributedReliability objects, this function performs a bootstrap resampling of the objects and returns n_boot aggregations of them. Args: score_objs: A list of DistributedROC or DistributedReliability objects. Objects must have an __add__ method n_boot (int): ...
hagelslag/evaluation/ProbabilityMetrics.py
def bootstrap(score_objs, n_boot=1000): """ Given a set of DistributedROC or DistributedReliability objects, this function performs a bootstrap resampling of the objects and returns n_boot aggregations of them. Args: score_objs: A list of DistributedROC or DistributedReliability objects. Object...
def bootstrap(score_objs, n_boot=1000): """ Given a set of DistributedROC or DistributedReliability objects, this function performs a bootstrap resampling of the objects and returns n_boot aggregations of them. Args: score_objs: A list of DistributedROC or DistributedReliability objects. Object...
[ "Given", "a", "set", "of", "DistributedROC", "or", "DistributedReliability", "objects", "this", "function", "performs", "a", "bootstrap", "resampling", "of", "the", "objects", "and", "returns", "n_boot", "aggregations", "of", "them", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L537-L550
[ "def", "bootstrap", "(", "score_objs", ",", "n_boot", "=", "1000", ")", ":", "all_samples", "=", "np", ".", "random", ".", "choice", "(", "score_objs", ",", "size", "=", "(", "n_boot", ",", "len", "(", "score_objs", ")", ")", ",", "replace", "=", "Tr...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.update
Update the ROC curve with a set of forecasts and observations Args: forecasts: 1D array of forecast values observations: 1D array of observation values.
hagelslag/evaluation/ProbabilityMetrics.py
def update(self, forecasts, observations): """ Update the ROC curve with a set of forecasts and observations Args: forecasts: 1D array of forecast values observations: 1D array of observation values. """ for t, threshold in enumerate(self.thresholds): ...
def update(self, forecasts, observations): """ Update the ROC curve with a set of forecasts and observations Args: forecasts: 1D array of forecast values observations: 1D array of observation values. """ for t, threshold in enumerate(self.thresholds): ...
[ "Update", "the", "ROC", "curve", "with", "a", "set", "of", "forecasts", "and", "observations" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L76-L92
[ "def", "update", "(", "self", ",", "forecasts", ",", "observations", ")", ":", "for", "t", ",", "threshold", "in", "enumerate", "(", "self", ".", "thresholds", ")", ":", "tp", "=", "np", ".", "count_nonzero", "(", "(", "forecasts", ">=", "threshold", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.merge
Ingest the values of another DistributedROC object into this one and update the statistics inplace. Args: other_roc: another DistributedROC object.
hagelslag/evaluation/ProbabilityMetrics.py
def merge(self, other_roc): """ Ingest the values of another DistributedROC object into this one and update the statistics inplace. Args: other_roc: another DistributedROC object. """ if other_roc.thresholds.size == self.thresholds.size and np.all(other_roc.threshold...
def merge(self, other_roc): """ Ingest the values of another DistributedROC object into this one and update the statistics inplace. Args: other_roc: another DistributedROC object. """ if other_roc.thresholds.size == self.thresholds.size and np.all(other_roc.threshold...
[ "Ingest", "the", "values", "of", "another", "DistributedROC", "object", "into", "this", "one", "and", "update", "the", "statistics", "inplace", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L108-L118
[ "def", "merge", "(", "self", ",", "other_roc", ")", ":", "if", "other_roc", ".", "thresholds", ".", "size", "==", "self", ".", "thresholds", ".", "size", "and", "np", ".", "all", "(", "other_roc", ".", "thresholds", "==", "self", ".", "thresholds", ")"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.roc_curve
Generate a ROC curve from the contingency table by calculating the probability of detection (TP/(TP+FN)) and the probability of false detection (FP/(FP+TN)). Returns: A pandas.DataFrame containing the POD, POFD, and the corresponding probability thresholds.
hagelslag/evaluation/ProbabilityMetrics.py
def roc_curve(self): """ Generate a ROC curve from the contingency table by calculating the probability of detection (TP/(TP+FN)) and the probability of false detection (FP/(FP+TN)). Returns: A pandas.DataFrame containing the POD, POFD, and the corresponding probability thre...
def roc_curve(self): """ Generate a ROC curve from the contingency table by calculating the probability of detection (TP/(TP+FN)) and the probability of false detection (FP/(FP+TN)). Returns: A pandas.DataFrame containing the POD, POFD, and the corresponding probability thre...
[ "Generate", "a", "ROC", "curve", "from", "the", "contingency", "table", "by", "calculating", "the", "probability", "of", "detection", "(", "TP", "/", "(", "TP", "+", "FN", "))", "and", "the", "probability", "of", "false", "detection", "(", "FP", "/", "("...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L120-L133
[ "def", "roc_curve", "(", "self", ")", ":", "pod", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", ".", "astype", "(", "float", ")", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.performance_curve
Calculate the Probability of Detection and False Alarm Ratio in order to output a performance diagram. Returns: pandas.DataFrame containing POD, FAR, and probability thresholds.
hagelslag/evaluation/ProbabilityMetrics.py
def performance_curve(self): """ Calculate the Probability of Detection and False Alarm Ratio in order to output a performance diagram. Returns: pandas.DataFrame containing POD, FAR, and probability thresholds. """ pod = self.contingency_tables["TP"] / (self.continge...
def performance_curve(self): """ Calculate the Probability of Detection and False Alarm Ratio in order to output a performance diagram. Returns: pandas.DataFrame containing POD, FAR, and probability thresholds. """ pod = self.contingency_tables["TP"] / (self.continge...
[ "Calculate", "the", "Probability", "of", "Detection", "and", "False", "Alarm", "Ratio", "in", "order", "to", "output", "a", "performance", "diagram", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L135-L146
[ "def", "performance_curve", "(", "self", ")", ":", "pod", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", "\"FN\"", "]", ")", "far", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.auc
Calculate the Area Under the ROC Curve (AUC).
hagelslag/evaluation/ProbabilityMetrics.py
def auc(self): """ Calculate the Area Under the ROC Curve (AUC). """ roc_curve = self.roc_curve() return np.abs(np.trapz(roc_curve['POD'], x=roc_curve['POFD']))
def auc(self): """ Calculate the Area Under the ROC Curve (AUC). """ roc_curve = self.roc_curve() return np.abs(np.trapz(roc_curve['POD'], x=roc_curve['POFD']))
[ "Calculate", "the", "Area", "Under", "the", "ROC", "Curve", "(", "AUC", ")", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L148-L153
[ "def", "auc", "(", "self", ")", ":", "roc_curve", "=", "self", ".", "roc_curve", "(", ")", "return", "np", ".", "abs", "(", "np", ".", "trapz", "(", "roc_curve", "[", "'POD'", "]", ",", "x", "=", "roc_curve", "[", "'POFD'", "]", ")", ")" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.max_csi
Calculate the maximum Critical Success Index across all probability thresholds Returns: The maximum CSI as a float
hagelslag/evaluation/ProbabilityMetrics.py
def max_csi(self): """ Calculate the maximum Critical Success Index across all probability thresholds Returns: The maximum CSI as a float """ csi = self.contingency_tables["TP"] / (self.contingency_tables["TP"] + self.contingency_tables["FN"] + ...
def max_csi(self): """ Calculate the maximum Critical Success Index across all probability thresholds Returns: The maximum CSI as a float """ csi = self.contingency_tables["TP"] / (self.contingency_tables["TP"] + self.contingency_tables["FN"] + ...
[ "Calculate", "the", "maximum", "Critical", "Success", "Index", "across", "all", "probability", "thresholds" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L155-L164
[ "def", "max_csi", "(", "self", ")", ":", "csi", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", "\"FN\"", "]", "+", "self", ".", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.get_contingency_tables
Create an Array of ContingencyTable objects for each probability threshold. Returns: Array of ContingencyTable objects
hagelslag/evaluation/ProbabilityMetrics.py
def get_contingency_tables(self): """ Create an Array of ContingencyTable objects for each probability threshold. Returns: Array of ContingencyTable objects """ return np.array([ContingencyTable(*ct) for ct in self.contingency_tables.values])
def get_contingency_tables(self): """ Create an Array of ContingencyTable objects for each probability threshold. Returns: Array of ContingencyTable objects """ return np.array([ContingencyTable(*ct) for ct in self.contingency_tables.values])
[ "Create", "an", "Array", "of", "ContingencyTable", "objects", "for", "each", "probability", "threshold", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L171-L178
[ "def", "get_contingency_tables", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "ContingencyTable", "(", "*", "ct", ")", "for", "ct", "in", "self", ".", "contingency_tables", ".", "values", "]", ")" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedROC.from_str
Read the DistributedROC string and parse the contingency table values from it. Args: in_str (str): The string output from the __str__ method
hagelslag/evaluation/ProbabilityMetrics.py
def from_str(self, in_str): """ Read the DistributedROC string and parse the contingency table values from it. Args: in_str (str): The string output from the __str__ method """ parts = in_str.split(";") for part in parts: var_name, value = part.sp...
def from_str(self, in_str): """ Read the DistributedROC string and parse the contingency table values from it. Args: in_str (str): The string output from the __str__ method """ parts = in_str.split(";") for part in parts: var_name, value = part.sp...
[ "Read", "the", "DistributedROC", "string", "and", "parse", "the", "contingency", "table", "values", "from", "it", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L194-L212
[ "def", "from_str", "(", "self", ",", "in_str", ")", ":", "parts", "=", "in_str", ".", "split", "(", "\";\"", ")", "for", "part", "in", "parts", ":", "var_name", ",", "value", "=", "part", ".", "split", "(", "\":\"", ")", "if", "var_name", "==", "\"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.update
Update the statistics with a set of forecasts and observations. Args: forecasts (numpy.ndarray): Array of forecast probability values observations (numpy.ndarray): Array of observation values
hagelslag/evaluation/ProbabilityMetrics.py
def update(self, forecasts, observations): """ Update the statistics with a set of forecasts and observations. Args: forecasts (numpy.ndarray): Array of forecast probability values observations (numpy.ndarray): Array of observation values """ for t, thres...
def update(self, forecasts, observations): """ Update the statistics with a set of forecasts and observations. Args: forecasts (numpy.ndarray): Array of forecast probability values observations (numpy.ndarray): Array of observation values """ for t, thres...
[ "Update", "the", "statistics", "with", "a", "set", "of", "forecasts", "and", "observations", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L308-L321
[ "def", "update", "(", "self", ",", "forecasts", ",", "observations", ")", ":", "for", "t", ",", "threshold", "in", "enumerate", "(", "self", ".", "thresholds", "[", ":", "-", "1", "]", ")", ":", "self", ".", "frequencies", ".", "loc", "[", "t", ","...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.merge
Ingest another DistributedReliability and add its contents to the current object. Args: other_rel: a Distributed reliability object.
hagelslag/evaluation/ProbabilityMetrics.py
def merge(self, other_rel): """ Ingest another DistributedReliability and add its contents to the current object. Args: other_rel: a Distributed reliability object. """ if other_rel.thresholds.size == self.thresholds.size and np.all(other_rel.thresholds == self.thres...
def merge(self, other_rel): """ Ingest another DistributedReliability and add its contents to the current object. Args: other_rel: a Distributed reliability object. """ if other_rel.thresholds.size == self.thresholds.size and np.all(other_rel.thresholds == self.thres...
[ "Ingest", "another", "DistributedReliability", "and", "add", "its", "contents", "to", "the", "current", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L340-L350
[ "def", "merge", "(", "self", ",", "other_rel", ")", ":", "if", "other_rel", ".", "thresholds", ".", "size", "==", "self", ".", "thresholds", ".", "size", "and", "np", ".", "all", "(", "other_rel", ".", "thresholds", "==", "self", ".", "thresholds", ")"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.reliability_curve
Calculates the reliability diagram statistics. The key columns are Bin_Start and Positive_Relative_Freq Returns: pandas.DataFrame
hagelslag/evaluation/ProbabilityMetrics.py
def reliability_curve(self): """ Calculates the reliability diagram statistics. The key columns are Bin_Start and Positive_Relative_Freq Returns: pandas.DataFrame """ total = self.frequencies["Total_Freq"].sum() curve = pd.DataFrame(columns=["Bin_Start", "Bin...
def reliability_curve(self): """ Calculates the reliability diagram statistics. The key columns are Bin_Start and Positive_Relative_Freq Returns: pandas.DataFrame """ total = self.frequencies["Total_Freq"].sum() curve = pd.DataFrame(columns=["Bin_Start", "Bin...
[ "Calculates", "the", "reliability", "diagram", "statistics", ".", "The", "key", "columns", "are", "Bin_Start", "and", "Positive_Relative_Freq" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L352-L367
[ "def", "reliability_curve", "(", "self", ")", ":", "total", "=", "self", ".", "frequencies", "[", "\"Total_Freq\"", "]", ".", "sum", "(", ")", "curve", "=", "pd", ".", "DataFrame", "(", "columns", "=", "[", "\"Bin_Start\"", ",", "\"Bin_End\"", ",", "\"Bi...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.brier_score_components
Calculate the components of the Brier score decomposition: reliability, resolution, and uncertainty.
hagelslag/evaluation/ProbabilityMetrics.py
def brier_score_components(self): """ Calculate the components of the Brier score decomposition: reliability, resolution, and uncertainty. """ rel_curve = self.reliability_curve() total = self.frequencies["Total_Freq"].sum() climo_freq = float(self.frequencies["Positive_F...
def brier_score_components(self): """ Calculate the components of the Brier score decomposition: reliability, resolution, and uncertainty. """ rel_curve = self.reliability_curve() total = self.frequencies["Total_Freq"].sum() climo_freq = float(self.frequencies["Positive_F...
[ "Calculate", "the", "components", "of", "the", "Brier", "score", "decomposition", ":", "reliability", "resolution", "and", "uncertainty", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L369-L381
[ "def", "brier_score_components", "(", "self", ")", ":", "rel_curve", "=", "self", ".", "reliability_curve", "(", ")", "total", "=", "self", ".", "frequencies", "[", "\"Total_Freq\"", "]", ".", "sum", "(", ")", "climo_freq", "=", "float", "(", "self", ".", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.brier_score
Calculate the Brier Score
hagelslag/evaluation/ProbabilityMetrics.py
def brier_score(self): """ Calculate the Brier Score """ reliability, resolution, uncertainty = self.brier_score_components() return reliability - resolution + uncertainty
def brier_score(self): """ Calculate the Brier Score """ reliability, resolution, uncertainty = self.brier_score_components() return reliability - resolution + uncertainty
[ "Calculate", "the", "Brier", "Score" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L390-L395
[ "def", "brier_score", "(", "self", ")", ":", "reliability", ",", "resolution", ",", "uncertainty", "=", "self", ".", "brier_score_components", "(", ")", "return", "reliability", "-", "resolution", "+", "uncertainty" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedReliability.brier_skill_score
Calculate the Brier Skill Score
hagelslag/evaluation/ProbabilityMetrics.py
def brier_skill_score(self): """ Calculate the Brier Skill Score """ reliability, resolution, uncertainty = self.brier_score_components() return (resolution - reliability) / uncertainty
def brier_skill_score(self): """ Calculate the Brier Skill Score """ reliability, resolution, uncertainty = self.brier_score_components() return (resolution - reliability) / uncertainty
[ "Calculate", "the", "Brier", "Skill", "Score" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L397-L402
[ "def", "brier_skill_score", "(", "self", ")", ":", "reliability", ",", "resolution", ",", "uncertainty", "=", "self", ".", "brier_score_components", "(", ")", "return", "(", "resolution", "-", "reliability", ")", "/", "uncertainty" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedCRPS.update
Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations:
hagelslag/evaluation/ProbabilityMetrics.py
def update(self, forecasts, observations): """ Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations: """ if len(observations.shape) == 1: obs_cdfs = np.zeros((ob...
def update(self, forecasts, observations): """ Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations: """ if len(observations.shape) == 1: obs_cdfs = np.zeros((ob...
[ "Update", "the", "statistics", "with", "forecasts", "and", "observations", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L455-L473
[ "def", "update", "(", "self", ",", "forecasts", ",", "observations", ")", ":", "if", "len", "(", "observations", ".", "shape", ")", "==", "1", ":", "obs_cdfs", "=", "np", ".", "zeros", "(", "(", "observations", ".", "size", ",", "self", ".", "thresho...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedCRPS.crps
Calculates the continuous ranked probability score.
hagelslag/evaluation/ProbabilityMetrics.py
def crps(self): """ Calculates the continuous ranked probability score. """ return np.sum(self.errors["F_2"].values - self.errors["F_O"].values * 2.0 + self.errors["O_2"].values) / \ (self.thresholds.size * self.num_forecasts)
def crps(self): """ Calculates the continuous ranked probability score. """ return np.sum(self.errors["F_2"].values - self.errors["F_O"].values * 2.0 + self.errors["O_2"].values) / \ (self.thresholds.size * self.num_forecasts)
[ "Calculates", "the", "continuous", "ranked", "probability", "score", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L488-L493
[ "def", "crps", "(", "self", ")", ":", "return", "np", ".", "sum", "(", "self", ".", "errors", "[", "\"F_2\"", "]", ".", "values", "-", "self", ".", "errors", "[", "\"F_O\"", "]", ".", "values", "*", "2.0", "+", "self", ".", "errors", "[", "\"O_2\...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedCRPS.crps_climo
Calculate the climatological CRPS.
hagelslag/evaluation/ProbabilityMetrics.py
def crps_climo(self): """ Calculate the climatological CRPS. """ o_bar = self.errors["O"].values / float(self.num_forecasts) crps_c = np.sum(self.num_forecasts * (o_bar ** 2) - o_bar * self.errors["O"].values * 2.0 + self.errors["O_2"].values) / float(self...
def crps_climo(self): """ Calculate the climatological CRPS. """ o_bar = self.errors["O"].values / float(self.num_forecasts) crps_c = np.sum(self.num_forecasts * (o_bar ** 2) - o_bar * self.errors["O"].values * 2.0 + self.errors["O_2"].values) / float(self...
[ "Calculate", "the", "climatological", "CRPS", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L495-L502
[ "def", "crps_climo", "(", "self", ")", ":", "o_bar", "=", "self", ".", "errors", "[", "\"O\"", "]", ".", "values", "/", "float", "(", "self", ".", "num_forecasts", ")", "crps_c", "=", "np", ".", "sum", "(", "self", ".", "num_forecasts", "*", "(", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
DistributedCRPS.crpss
Calculate the continous ranked probability skill score from existing data.
hagelslag/evaluation/ProbabilityMetrics.py
def crpss(self): """ Calculate the continous ranked probability skill score from existing data. """ crps_f = self.crps() crps_c = self.crps_climo() return 1.0 - float(crps_f) / float(crps_c)
def crpss(self): """ Calculate the continous ranked probability skill score from existing data. """ crps_f = self.crps() crps_c = self.crps_climo() return 1.0 - float(crps_f) / float(crps_c)
[ "Calculate", "the", "continous", "ranked", "probability", "skill", "score", "from", "existing", "data", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L504-L510
[ "def", "crpss", "(", "self", ")", ":", "crps_f", "=", "self", ".", "crps", "(", ")", "crps_c", "=", "self", ".", "crps_climo", "(", ")", "return", "1.0", "-", "float", "(", "crps_f", ")", "/", "float", "(", "crps_c", ")" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
checar
Checa em sequência os alertas registrados (veja :func:`registrar`) contra os dados da consulta ao status operacional do equipamento SAT. Este método irá então resultar em uma lista dos alertas ativos. :param cliente_sat: Uma instância de :class:`satcfe.clientelocal.ClienteSATLocal` ou :clas...
satcfe/alertas.py
def checar(cliente_sat): """ Checa em sequência os alertas registrados (veja :func:`registrar`) contra os dados da consulta ao status operacional do equipamento SAT. Este método irá então resultar em uma lista dos alertas ativos. :param cliente_sat: Uma instância de :class:`satcfe.clientelo...
def checar(cliente_sat): """ Checa em sequência os alertas registrados (veja :func:`registrar`) contra os dados da consulta ao status operacional do equipamento SAT. Este método irá então resultar em uma lista dos alertas ativos. :param cliente_sat: Uma instância de :class:`satcfe.clientelo...
[ "Checa", "em", "sequência", "os", "alertas", "registrados", "(", "veja", ":", "func", ":", "registrar", ")", "contra", "os", "dados", "da", "consulta", "ao", "status", "operacional", "do", "equipamento", "SAT", ".", "Este", "método", "irá", "então", "resulta...
base4sistemas/satcfe
python
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/alertas.py#L375-L395
[ "def", "checar", "(", "cliente_sat", ")", ":", "resposta", "=", "cliente_sat", ".", "consultar_status_operacional", "(", ")", "alertas", "=", "[", "]", "for", "classe_alerta", "in", "AlertaOperacao", ".", "alertas_registrados", ":", "alerta", "=", "classe_alerta",...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9
train
has_metadata_value
Return whether the metadata value for the given key exists. 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...
nion/swift/model/Metadata.py
def has_metadata_value(metadata_source, key: str) -> bool: """Return whether the metadata value for the given key exists. 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 usi...
def has_metadata_value(metadata_source, key: str) -> bool: """Return whether the metadata value for the given key exists. 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 usi...
[ "Return", "whether", "the", "metadata", "value", "for", "the", "given", "key", "exists", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L66-L92
[ "def", "has_metadata_value", "(", "metadata_source", ",", "key", ":", "str", ")", "->", "bool", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d", "=", "getattr", "(", "metadata_source", ",", ...
d43693eaf057b8683b9638e575000f055fede452
train
get_metadata_value
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>.<attribute>' for...
nion/swift/model/Metadata.py
def get_metadata_value(metadata_source, 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 custom ...
def get_metadata_value(metadata_source, 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 custom ...
[ "Get", "the", "metadata", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L94-L118
[ "def", "get_metadata_value", "(", "metadata_source", ",", "key", ":", "str", ")", "->", "typing", ".", "Any", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "v", "=", "getattr", "(", "metadata_...
d43693eaf057b8683b9638e575000f055fede452
train
set_metadata_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>.<attribute>' for...
nion/swift/model/Metadata.py
def set_metadata_value(metadata_source, 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. If us...
def set_metadata_value(metadata_source, 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. If us...
[ "Set", "the", "metadata", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L120-L152
[ "def", "set_metadata_value", "(", "metadata_source", ",", "key", ":", "str", ",", "value", ":", "typing", ".", "Any", ")", "->", "None", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d0", "...
d43693eaf057b8683b9638e575000f055fede452
train
delete_metadata_value
Delete 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 '<dotted>.<group>.<att...
nion/swift/model/Metadata.py
def delete_metadata_value(metadata_source, key: str) -> None: """Delete 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 ...
def delete_metadata_value(metadata_source, key: str) -> None: """Delete 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 ...
[ "Delete", "the", "metadata", "value", "for", "the", "given", "key", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L154-L185
[ "def", "delete_metadata_value", "(", "metadata_source", ",", "key", ":", "str", ")", "->", "None", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d0", "=", "getattr", "(", "metadata_source", ","...
d43693eaf057b8683b9638e575000f055fede452
train
LineGraphAxes.calculate_y_ticks
Calculate the y-axis items dependent on the plot height.
nion/swift/LineGraphCanvasItem.py
def calculate_y_ticks(self, plot_height): """Calculate the y-axis items dependent on the plot height.""" calibrated_data_min = self.calibrated_data_min calibrated_data_max = self.calibrated_data_max calibrated_data_range = calibrated_data_max - calibrated_data_min ticker = self...
def calculate_y_ticks(self, plot_height): """Calculate the y-axis items dependent on the plot height.""" calibrated_data_min = self.calibrated_data_min calibrated_data_max = self.calibrated_data_max calibrated_data_range = calibrated_data_max - calibrated_data_min ticker = self...
[ "Calculate", "the", "y", "-", "axis", "items", "dependent", "on", "the", "plot", "height", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L164-L181
[ "def", "calculate_y_ticks", "(", "self", ",", "plot_height", ")", ":", "calibrated_data_min", "=", "self", ".", "calibrated_data_min", "calibrated_data_max", "=", "self", ".", "calibrated_data_max", "calibrated_data_range", "=", "calibrated_data_max", "-", "calibrated_dat...
d43693eaf057b8683b9638e575000f055fede452
train
LineGraphAxes.calculate_x_ticks
Calculate the x-axis items dependent on the plot width.
nion/swift/LineGraphCanvasItem.py
def calculate_x_ticks(self, plot_width): """Calculate the x-axis items dependent on the plot width.""" x_calibration = self.x_calibration uncalibrated_data_left = self.__uncalibrated_left_channel uncalibrated_data_right = self.__uncalibrated_right_channel calibrated_data_left ...
def calculate_x_ticks(self, plot_width): """Calculate the x-axis items dependent on the plot width.""" x_calibration = self.x_calibration uncalibrated_data_left = self.__uncalibrated_left_channel uncalibrated_data_right = self.__uncalibrated_right_channel calibrated_data_left ...
[ "Calculate", "the", "x", "-", "axis", "items", "dependent", "on", "the", "plot", "width", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L196-L221
[ "def", "calculate_x_ticks", "(", "self", ",", "plot_width", ")", ":", "x_calibration", "=", "self", ".", "x_calibration", "uncalibrated_data_left", "=", "self", ".", "__uncalibrated_left_channel", "uncalibrated_data_right", "=", "self", ".", "__uncalibrated_right_channel"...
d43693eaf057b8683b9638e575000f055fede452
train
LineGraphHorizontalAxisLabelCanvasItem.size_to_content
Size the canvas item to the proper height.
nion/swift/LineGraphCanvasItem.py
def size_to_content(self): """ Size the canvas item to the proper height. """ new_sizing = self.copy_sizing() new_sizing.minimum_height = 0 new_sizing.maximum_height = 0 axes = self.__axes if axes and axes.is_valid: if axes.x_calibration and axes.x_calibration...
def size_to_content(self): """ Size the canvas item to the proper height. """ new_sizing = self.copy_sizing() new_sizing.minimum_height = 0 new_sizing.maximum_height = 0 axes = self.__axes if axes and axes.is_valid: if axes.x_calibration and axes.x_calibration...
[ "Size", "the", "canvas", "item", "to", "the", "proper", "height", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L783-L793
[ "def", "size_to_content", "(", "self", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_height", "=", "0", "new_sizing", ".", "maximum_height", "=", "0", "axes", "=", "self", ".", "__axes", "if", "axes", "and",...
d43693eaf057b8683b9638e575000f055fede452
train
LineGraphVerticalAxisScaleCanvasItem.size_to_content
Size the canvas item to the proper width, the maximum of any label.
nion/swift/LineGraphCanvasItem.py
def size_to_content(self, get_font_metrics_fn): """ Size the canvas item to the proper width, the maximum of any label. """ new_sizing = self.copy_sizing() new_sizing.minimum_width = 0 new_sizing.maximum_width = 0 axes = self.__axes if axes and axes.is_valid: ...
def size_to_content(self, get_font_metrics_fn): """ Size the canvas item to the proper width, the maximum of any label. """ new_sizing = self.copy_sizing() new_sizing.minimum_width = 0 new_sizing.maximum_width = 0 axes = self.__axes if axes and axes.is_valid: ...
[ "Size", "the", "canvas", "item", "to", "the", "proper", "width", "the", "maximum", "of", "any", "label", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L869-L892
[ "def", "size_to_content", "(", "self", ",", "get_font_metrics_fn", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_width", "=", "0", "new_sizing", ".", "maximum_width", "=", "0", "axes", "=", "self", ".", "__axe...
d43693eaf057b8683b9638e575000f055fede452
train
LineGraphVerticalAxisLabelCanvasItem.size_to_content
Size the canvas item to the proper width.
nion/swift/LineGraphCanvasItem.py
def size_to_content(self): """ Size the canvas item to the proper width. """ new_sizing = self.copy_sizing() new_sizing.minimum_width = 0 new_sizing.maximum_width = 0 axes = self.__axes if axes and axes.is_valid: if axes.y_calibration and axes.y_calibration.un...
def size_to_content(self): """ Size the canvas item to the proper width. """ new_sizing = self.copy_sizing() new_sizing.minimum_width = 0 new_sizing.maximum_width = 0 axes = self.__axes if axes and axes.is_valid: if axes.y_calibration and axes.y_calibration.un...
[ "Size", "the", "canvas", "item", "to", "the", "proper", "width", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L936-L946
[ "def", "size_to_content", "(", "self", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_width", "=", "0", "new_sizing", ".", "maximum_width", "=", "0", "axes", "=", "self", ".", "__axes", "if", "axes", "and", ...
d43693eaf057b8683b9638e575000f055fede452
train
get_snippet_content
Load the content from a snippet file which exists in SNIPPETS_ROOT
hatchery/snippets.py
def get_snippet_content(snippet_name, **format_kwargs): """ Load the content from a snippet file which exists in SNIPPETS_ROOT """ filename = snippet_name + '.snippet' snippet_file = os.path.join(SNIPPETS_ROOT, filename) if not os.path.isfile(snippet_file): raise ValueError('could not find snipp...
def get_snippet_content(snippet_name, **format_kwargs): """ Load the content from a snippet file which exists in SNIPPETS_ROOT """ filename = snippet_name + '.snippet' snippet_file = os.path.join(SNIPPETS_ROOT, filename) if not os.path.isfile(snippet_file): raise ValueError('could not find snipp...
[ "Load", "the", "content", "from", "a", "snippet", "file", "which", "exists", "in", "SNIPPETS_ROOT" ]
ajk8/hatchery
python
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/snippets.py#L7-L16
[ "def", "get_snippet_content", "(", "snippet_name", ",", "*", "*", "format_kwargs", ")", ":", "filename", "=", "snippet_name", "+", "'.snippet'", "snippet_file", "=", "os", ".", "path", ".", "join", "(", "SNIPPETS_ROOT", ",", "filename", ")", "if", "not", "os...
e068c9f5366d2c98225babb03d4cde36c710194f
train
LinePlotCanvasItem.update_display_properties
Update the display values. Called from display panel. This method saves the display values and data and triggers an update. It should be as fast as possible. As a layer, this canvas item will respond to the update by calling prepare_render on the layer's rendering thread. Prepare render will c...
nion/swift/LinePlotCanvasItem.py
def update_display_properties(self, display_calibration_info, display_properties: typing.Mapping, display_layers: typing.Sequence[typing.Mapping]) -> None: """Update the display values. Called from display panel. This method saves the display values and data and triggers an update. It should be as fast...
def update_display_properties(self, display_calibration_info, display_properties: typing.Mapping, display_layers: typing.Sequence[typing.Mapping]) -> None: """Update the display values. Called from display panel. This method saves the display values and data and triggers an update. It should be as fast...
[ "Update", "the", "display", "values", ".", "Called", "from", "display", "panel", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L249-L296
[ "def", "update_display_properties", "(", "self", ",", "display_calibration_info", ",", "display_properties", ":", "typing", ".", "Mapping", ",", "display_layers", ":", "typing", ".", "Sequence", "[", "typing", ".", "Mapping", "]", ")", "->", "None", ":", "# may ...
d43693eaf057b8683b9638e575000f055fede452
train
LinePlotCanvasItem.__view_to_intervals
Change the view to encompass the channels and data represented by the given intervals.
nion/swift/LinePlotCanvasItem.py
def __view_to_intervals(self, data_and_metadata: DataAndMetadata.DataAndMetadata, intervals: typing.List[typing.Tuple[float, float]]) -> None: """Change the view to encompass the channels and data represented by the given intervals.""" left = None right = None for interval in intervals: ...
def __view_to_intervals(self, data_and_metadata: DataAndMetadata.DataAndMetadata, intervals: typing.List[typing.Tuple[float, float]]) -> None: """Change the view to encompass the channels and data represented by the given intervals.""" left = None right = None for interval in intervals: ...
[ "Change", "the", "view", "to", "encompass", "the", "channels", "and", "data", "represented", "by", "the", "given", "intervals", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L358-L384
[ "def", "__view_to_intervals", "(", "self", ",", "data_and_metadata", ":", "DataAndMetadata", ".", "DataAndMetadata", ",", "intervals", ":", "typing", ".", "List", "[", "typing", ".", "Tuple", "[", "float", ",", "float", "]", "]", ")", "->", "None", ":", "l...
d43693eaf057b8683b9638e575000f055fede452
train
LinePlotCanvasItem.__view_to_selected_graphics
Change the view to encompass the selected graphic intervals.
nion/swift/LinePlotCanvasItem.py
def __view_to_selected_graphics(self, data_and_metadata: DataAndMetadata.DataAndMetadata) -> None: """Change the view to encompass the selected graphic intervals.""" all_graphics = self.__graphics graphics = [graphic for graphic_index, graphic in enumerate(all_graphics) if self.__graphic_selecti...
def __view_to_selected_graphics(self, data_and_metadata: DataAndMetadata.DataAndMetadata) -> None: """Change the view to encompass the selected graphic intervals.""" all_graphics = self.__graphics graphics = [graphic for graphic_index, graphic in enumerate(all_graphics) if self.__graphic_selecti...
[ "Change", "the", "view", "to", "encompass", "the", "selected", "graphic", "intervals", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L387-L395
[ "def", "__view_to_selected_graphics", "(", "self", ",", "data_and_metadata", ":", "DataAndMetadata", ".", "DataAndMetadata", ")", "->", "None", ":", "all_graphics", "=", "self", ".", "__graphics", "graphics", "=", "[", "graphic", "for", "graphic_index", ",", "grap...
d43693eaf057b8683b9638e575000f055fede452
train
LinePlotCanvasItem.prepare_display
Prepare the display. This method gets called by the canvas layout/draw engine after being triggered by a call to `update`. When data or display parameters change, the internal state of the line plot gets updated. This method takes that internal state and updates the child canvas items. ...
nion/swift/LinePlotCanvasItem.py
def prepare_display(self): """Prepare the display. This method gets called by the canvas layout/draw engine after being triggered by a call to `update`. When data or display parameters change, the internal state of the line plot gets updated. This method takes that internal state and u...
def prepare_display(self): """Prepare the display. This method gets called by the canvas layout/draw engine after being triggered by a call to `update`. When data or display parameters change, the internal state of the line plot gets updated. This method takes that internal state and u...
[ "Prepare", "the", "display", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L402-L538
[ "def", "prepare_display", "(", "self", ")", ":", "displayed_dimensional_calibration", "=", "self", ".", "__displayed_dimensional_calibration", "intensity_calibration", "=", "self", ".", "__intensity_calibration", "calibration_style", "=", "self", ".", "__calibration_style", ...
d43693eaf057b8683b9638e575000f055fede452
train
LinePlotCanvasItem.__update_cursor_info
Map the mouse to the 1-d position within the line graph.
nion/swift/LinePlotCanvasItem.py
def __update_cursor_info(self): """ Map the mouse to the 1-d position within the line graph. """ if not self.delegate: # allow display to work without delegate return if self.__mouse_in and self.__last_mouse: pos_1d = None axes = self.__axes lin...
def __update_cursor_info(self): """ Map the mouse to the 1-d position within the line graph. """ if not self.delegate: # allow display to work without delegate return if self.__mouse_in and self.__last_mouse: pos_1d = None axes = self.__axes lin...
[ "Map", "the", "mouse", "to", "the", "1", "-", "d", "position", "within", "the", "line", "graph", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L937-L955
[ "def", "__update_cursor_info", "(", "self", ")", ":", "if", "not", "self", ".", "delegate", ":", "# allow display to work without delegate", "return", "if", "self", ".", "__mouse_in", "and", "self", ".", "__last_mouse", ":", "pos_1d", "=", "None", "axes", "=", ...
d43693eaf057b8683b9638e575000f055fede452
train
TrackProcessor.find_model_patch_tracks
Identify storms in gridded model output and extract uniform sized patches around the storm centers of mass. Returns:
hagelslag/processing/TrackProcessing.py
def find_model_patch_tracks(self): """ Identify storms in gridded model output and extract uniform sized patches around the storm centers of mass. Returns: """ self.model_grid.load_data() tracked_model_objects = [] model_objects = [] if self.model_grid.d...
def find_model_patch_tracks(self): """ Identify storms in gridded model output and extract uniform sized patches around the storm centers of mass. Returns: """ self.model_grid.load_data() tracked_model_objects = [] model_objects = [] if self.model_grid.d...
[ "Identify", "storms", "in", "gridded", "model", "output", "and", "extract", "uniform", "sized", "patches", "around", "the", "storm", "centers", "of", "mass", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L110-L165
[ "def", "find_model_patch_tracks", "(", "self", ")", ":", "self", ".", "model_grid", ".", "load_data", "(", ")", "tracked_model_objects", "=", "[", "]", "model_objects", "=", "[", "]", "if", "self", ".", "model_grid", ".", "data", "is", "None", ":", "print"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.find_model_tracks
Identify storms at each model time step and link them together with object matching. Returns: List of STObjects containing model track information.
hagelslag/processing/TrackProcessing.py
def find_model_tracks(self): """ Identify storms at each model time step and link them together with object matching. Returns: List of STObjects containing model track information. """ self.model_grid.load_data() model_objects = [] tracked_model_objec...
def find_model_tracks(self): """ Identify storms at each model time step and link them together with object matching. Returns: List of STObjects containing model track information. """ self.model_grid.load_data() model_objects = [] tracked_model_objec...
[ "Identify", "storms", "at", "each", "model", "time", "step", "and", "link", "them", "together", "with", "object", "matching", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L167-L247
[ "def", "find_model_tracks", "(", "self", ")", ":", "self", ".", "model_grid", ".", "load_data", "(", ")", "model_objects", "=", "[", "]", "tracked_model_objects", "=", "[", "]", "if", "self", ".", "model_grid", ".", "data", "is", "None", ":", "print", "(...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.find_mrms_tracks
Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information.
hagelslag/processing/TrackProcessing.py
def find_mrms_tracks(self): """ Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information. """ obs_objects = [] tracked_obs_objects = [] if self.mrms_ew is not None: ...
def find_mrms_tracks(self): """ Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information. """ obs_objects = [] tracked_obs_objects = [] if self.mrms_ew is not None: ...
[ "Identify", "objects", "from", "MRMS", "timesteps", "and", "link", "them", "together", "with", "object", "matching", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L267-L328
[ "def", "find_mrms_tracks", "(", "self", ")", ":", "obs_objects", "=", "[", "]", "tracked_obs_objects", "=", "[", "]", "if", "self", ".", "mrms_ew", "is", "not", "None", ":", "self", ".", "mrms_grid", ".", "load_data", "(", ")", "if", "len", "(", "self"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.match_tracks
Match forecast and observed tracks. Args: model_tracks: obs_tracks: unique_matches: closest_matches: Returns:
hagelslag/processing/TrackProcessing.py
def match_tracks(self, model_tracks, obs_tracks, unique_matches=True, closest_matches=False): """ Match forecast and observed tracks. Args: model_tracks: obs_tracks: unique_matches: closest_matches: Returns: """ if unique...
def match_tracks(self, model_tracks, obs_tracks, unique_matches=True, closest_matches=False): """ Match forecast and observed tracks. Args: model_tracks: obs_tracks: unique_matches: closest_matches: Returns: """ if unique...
[ "Match", "forecast", "and", "observed", "tracks", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L330-L347
[ "def", "match_tracks", "(", "self", ",", "model_tracks", ",", "obs_tracks", ",", "unique_matches", "=", "True", ",", "closest_matches", "=", "False", ")", ":", "if", "unique_matches", ":", "pairings", "=", "self", ".", "track_matcher", ".", "match_tracks", "("...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.extract_model_attributes
Extract model attribute data for each model track. Storm variables are those that describe the model storm directly, such as radar reflectivity or updraft helicity. Potential variables describe the surrounding environmental conditions of the storm, and should be extracted from the timestep before the st...
hagelslag/processing/TrackProcessing.py
def extract_model_attributes(self, tracked_model_objects, storm_variables, potential_variables, tendency_variables=None, future_variables=None): """ Extract model attribute data for each model track. Storm variables are those that describe the model storm directl...
def extract_model_attributes(self, tracked_model_objects, storm_variables, potential_variables, tendency_variables=None, future_variables=None): """ Extract model attribute data for each model track. Storm variables are those that describe the model storm directl...
[ "Extract", "model", "attribute", "data", "for", "each", "model", "track", ".", "Storm", "variables", "are", "those", "that", "describe", "the", "model", "storm", "directly", "such", "as", "radar", "reflectivity", "or", "updraft", "helicity", ".", "Potential", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L352-L427
[ "def", "extract_model_attributes", "(", "self", ",", "tracked_model_objects", ",", "storm_variables", ",", "potential_variables", ",", "tendency_variables", "=", "None", ",", "future_variables", "=", "None", ")", ":", "if", "tendency_variables", "is", "None", ":", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.match_hail_sizes
Given forecast and observed track pairings, maximum hail sizes are associated with each paired forecast storm track timestep. If the duration of the forecast and observed tracks differ, then interpolation is used for the intermediate timesteps. Args: model_tracks: List of model trac...
hagelslag/processing/TrackProcessing.py
def match_hail_sizes(model_tracks, obs_tracks, track_pairings): """ Given forecast and observed track pairings, maximum hail sizes are associated with each paired forecast storm track timestep. If the duration of the forecast and observed tracks differ, then interpolation is used for the ...
def match_hail_sizes(model_tracks, obs_tracks, track_pairings): """ Given forecast and observed track pairings, maximum hail sizes are associated with each paired forecast storm track timestep. If the duration of the forecast and observed tracks differ, then interpolation is used for the ...
[ "Given", "forecast", "and", "observed", "track", "pairings", "maximum", "hail", "sizes", "are", "associated", "with", "each", "paired", "forecast", "storm", "track", "timestep", ".", "If", "the", "duration", "of", "the", "forecast", "and", "observed", "tracks", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L431-L464
[ "def", "match_hail_sizes", "(", "model_tracks", ",", "obs_tracks", ",", "track_pairings", ")", ":", "unpaired", "=", "list", "(", "range", "(", "len", "(", "model_tracks", ")", ")", ")", "for", "p", ",", "pair", "in", "enumerate", "(", "track_pairings", ")...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.match_hail_size_step_distributions
Given a matching set of observed tracks for each model track, Args: model_tracks: obs_tracks: track_pairings: Returns:
hagelslag/processing/TrackProcessing.py
def match_hail_size_step_distributions(self, model_tracks, obs_tracks, track_pairings): """ Given a matching set of observed tracks for each model track, Args: model_tracks: obs_tracks: track_pairings: Returns: """ label_...
def match_hail_size_step_distributions(self, model_tracks, obs_tracks, track_pairings): """ Given a matching set of observed tracks for each model track, Args: model_tracks: obs_tracks: track_pairings: Returns: """ label_...
[ "Given", "a", "matching", "set", "of", "observed", "tracks", "for", "each", "model", "track", "Args", ":", "model_tracks", ":", "obs_tracks", ":", "track_pairings", ":" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L505-L538
[ "def", "match_hail_size_step_distributions", "(", "self", ",", "model_tracks", ",", "obs_tracks", ",", "track_pairings", ")", ":", "label_columns", "=", "[", "\"Matched\"", ",", "\"Max_Hail_Size\"", ",", "\"Num_Matches\"", ",", "\"Shape\"", ",", "\"Location\"", ",", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackProcessor.calc_track_errors
Calculates spatial and temporal translation errors between matched forecast and observed tracks. Args: model_tracks: List of model track STObjects obs_tracks: List of observed track STObjects track_pairings: List of tuples pairing forecast and observed tracks. ...
hagelslag/processing/TrackProcessing.py
def calc_track_errors(model_tracks, obs_tracks, track_pairings): """ Calculates spatial and temporal translation errors between matched forecast and observed tracks. Args: model_tracks: List of model track STObjects obs_tracks: List of observed track STObjects ...
def calc_track_errors(model_tracks, obs_tracks, track_pairings): """ Calculates spatial and temporal translation errors between matched forecast and observed tracks. Args: model_tracks: List of model track STObjects obs_tracks: List of observed track STObjects ...
[ "Calculates", "spatial", "and", "temporal", "translation", "errors", "between", "matched", "forecast", "and", "observed", "tracks", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L541-L575
[ "def", "calc_track_errors", "(", "model_tracks", ",", "obs_tracks", ",", "track_pairings", ")", ":", "columns", "=", "[", "'obs_track_id'", ",", "'translation_error_x'", ",", "'translation_error_y'", ",", "'start_time_difference'", ",", "'end_time_difference'", ",", "]"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
Connection.persistent_object_context_changed
Override from PersistentObject.
nion/swift/model/Connection.py
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def change_registration(registered_object, unregistered_object): if registered_object and registered_object.uuid == self.parent_uuid: self...
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def change_registration(registered_object, unregistered_object): if registered_object and registered_object.uuid == self.parent_uuid: self...
[ "Override", "from", "PersistentObject", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L86-L97
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "change_registration", "(", "registered_object", ",", "unregistered_object", ")", ":", "if", "registered_object", "and", "r...
d43693eaf057b8683b9638e575000f055fede452
train
PropertyConnection.persistent_object_context_changed
Override from PersistentObject.
nion/swift/model/Connection.py
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def register(): if self.__source is not None and self.__target is not None: assert not self.__binding self.__binding = Bin...
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def register(): if self.__source is not None and self.__target is not None: assert not self.__binding self.__binding = Bin...
[ "Override", "from", "PersistentObject", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L162-L219
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "register", "(", ")", ":", "if", "self", ".", "__source", "is", "not", "None", "and", "self", ".", "__target", "i...
d43693eaf057b8683b9638e575000f055fede452
train
IntervalListConnection.persistent_object_context_changed
Override from PersistentObject.
nion/swift/model/Connection.py
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def detach(): for listener in self.__interval_mutated_listeners: listener.close() self.__interval_mutated_listeners = list() ...
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def detach(): for listener in self.__interval_mutated_listeners: listener.close() self.__interval_mutated_listeners = list() ...
[ "Override", "from", "PersistentObject", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L247-L298
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "detach", "(", ")", ":", "for", "listener", "in", "self", ".", "__interval_mutated_listeners", ":", "listener", ".", ...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.__display_for_tree_node
Return the text display for the given tree node. Based on number of keys associated with tree node.
nion/swift/FilterPanel.py
def __display_for_tree_node(self, tree_node): """ Return the text display for the given tree node. Based on number of keys associated with tree node. """ keys = tree_node.keys if len(keys) == 1: return "{0} ({1})".format(tree_node.keys[-1], tree_node.count) elif len(keys) == ...
def __display_for_tree_node(self, tree_node): """ Return the text display for the given tree node. Based on number of keys associated with tree node. """ keys = tree_node.keys if len(keys) == 1: return "{0} ({1})".format(tree_node.keys[-1], tree_node.count) elif len(keys) == ...
[ "Return", "the", "text", "display", "for", "the", "given", "tree", "node", ".", "Based", "on", "number", "of", "keys", "associated", "with", "tree", "node", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L121-L133
[ "def", "__display_for_tree_node", "(", "self", ",", "tree_node", ")", ":", "keys", "=", "tree_node", ".", "keys", "if", "len", "(", "keys", ")", "==", "1", ":", "return", "\"{0} ({1})\"", ".", "format", "(", "tree_node", ".", "keys", "[", "-", "1", "]"...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.__insert_child
Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller.
nion/swift/FilterPanel.py
def __insert_child(self, parent_tree_node, index, tree_node): """ Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller. """ # manage the item mo...
def __insert_child(self, parent_tree_node, index, tree_node): """ Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller. """ # manage the item mo...
[ "Called", "from", "the", "root", "tree", "node", "when", "a", "new", "node", "is", "inserted", "into", "tree", ".", "This", "method", "creates", "properties", "to", "represent", "the", "node", "for", "display", "and", "inserts", "it", "into", "the", "item"...
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L135-L150
[ "def", "__insert_child", "(", "self", ",", "parent_tree_node", ",", "index", ",", "tree_node", ")", ":", "# manage the item model", "parent_item", "=", "self", ".", "__mapping", "[", "id", "(", "parent_tree_node", ")", "]", "self", ".", "item_model_controller", ...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.__remove_child
Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller.
nion/swift/FilterPanel.py
def __remove_child(self, parent_tree_node, index): """ Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller. """ # get parent and item parent_item = self.__mapping[id(parent_tree_node)] ...
def __remove_child(self, parent_tree_node, index): """ Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller. """ # get parent and item parent_item = self.__mapping[id(parent_tree_node)] ...
[ "Called", "from", "the", "root", "tree", "node", "when", "a", "node", "is", "removed", "from", "the", "tree", ".", "This", "method", "removes", "it", "into", "the", "item", "model", "controller", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L152-L164
[ "def", "__remove_child", "(", "self", ",", "parent_tree_node", ",", "index", ")", ":", "# get parent and item", "parent_item", "=", "self", ".", "__mapping", "[", "id", "(", "parent_tree_node", ")", "]", "# manage the item model", "self", ".", "item_model_controller...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.update_all_nodes
Update all tree item displays if needed. Usually for count updates.
nion/swift/FilterPanel.py
def update_all_nodes(self): """ Update all tree item displays if needed. Usually for count updates. """ item_model_controller = self.item_model_controller if item_model_controller: if self.__node_counts_dirty: for item in self.__mapping.values(): i...
def update_all_nodes(self): """ Update all tree item displays if needed. Usually for count updates. """ item_model_controller = self.item_model_controller if item_model_controller: if self.__node_counts_dirty: for item in self.__mapping.values(): i...
[ "Update", "all", "tree", "item", "displays", "if", "needed", ".", "Usually", "for", "count", "updates", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L170-L180
[ "def", "update_all_nodes", "(", "self", ")", ":", "item_model_controller", "=", "self", ".", "item_model_controller", "if", "item_model_controller", ":", "if", "self", ".", "__node_counts_dirty", ":", "for", "item", "in", "self", ".", "__mapping", ".", "values", ...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.date_browser_selection_changed
Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides date_filter to filter data items based on the list of keys. It then sets th...
nion/swift/FilterPanel.py
def date_browser_selection_changed(self, selected_indexes): """ Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides dat...
def date_browser_selection_changed(self, selected_indexes): """ Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides dat...
[ "Called", "to", "handle", "selection", "changes", "in", "the", "tree", "widget", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L182-L205
[ "def", "date_browser_selection_changed", "(", "self", ",", "selected_indexes", ")", ":", "partial_date_filters", "=", "list", "(", ")", "for", "index", ",", "parent_row", ",", "parent_id", "in", "selected_indexes", ":", "item_model_controller", "=", "self", ".", "...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.text_filter_changed
Called to handle changes to the text filter. :param text: The text for the filter.
nion/swift/FilterPanel.py
def text_filter_changed(self, text): """ Called to handle changes to the text filter. :param text: The text for the filter. """ text = text.strip() if text else None if text is not None: self.__text_filter = ListModel.TextFilter("text_for_filter", te...
def text_filter_changed(self, text): """ Called to handle changes to the text filter. :param text: The text for the filter. """ text = text.strip() if text else None if text is not None: self.__text_filter = ListModel.TextFilter("text_for_filter", te...
[ "Called", "to", "handle", "changes", "to", "the", "text", "filter", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L207-L220
[ "def", "text_filter_changed", "(", "self", ",", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "text", "else", "None", "if", "text", "is", "not", "None", ":", "self", ".", "__text_filter", "=", "ListModel", ".", "TextFilter", "(",...
d43693eaf057b8683b9638e575000f055fede452
train
FilterController.__update_filter
Create a combined filter. Set the resulting filter into the document controller.
nion/swift/FilterPanel.py
def __update_filter(self): """ Create a combined filter. Set the resulting filter into the document controller. """ filters = list() if self.__date_filter: filters.append(self.__date_filter) if self.__text_filter: filters.append(self.__text_fil...
def __update_filter(self): """ Create a combined filter. Set the resulting filter into the document controller. """ filters = list() if self.__date_filter: filters.append(self.__date_filter) if self.__text_filter: filters.append(self.__text_fil...
[ "Create", "a", "combined", "filter", ".", "Set", "the", "resulting", "filter", "into", "the", "document", "controller", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L222-L231
[ "def", "__update_filter", "(", "self", ")", ":", "filters", "=", "list", "(", ")", "if", "self", ".", "__date_filter", ":", "filters", ".", "append", "(", "self", ".", "__date_filter", ")", "if", "self", ".", "__text_filter", ":", "filters", ".", "append...
d43693eaf057b8683b9638e575000f055fede452
train
TreeNode.__get_keys
Return the keys associated with this node by adding its key and then adding parent keys recursively.
nion/swift/FilterPanel.py
def __get_keys(self): """ Return the keys associated with this node by adding its key and then adding parent keys recursively. """ keys = list() tree_node = self while tree_node is not None and tree_node.key is not None: keys.insert(0, tree_node.key) tree_node = t...
def __get_keys(self): """ Return the keys associated with this node by adding its key and then adding parent keys recursively. """ keys = list() tree_node = self while tree_node is not None and tree_node.key is not None: keys.insert(0, tree_node.key) tree_node = t...
[ "Return", "the", "keys", "associated", "with", "this", "node", "by", "adding", "its", "key", "and", "then", "adding", "parent", "keys", "recursively", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L348-L355
[ "def", "__get_keys", "(", "self", ")", ":", "keys", "=", "list", "(", ")", "tree_node", "=", "self", "while", "tree_node", "is", "not", "None", "and", "tree_node", ".", "key", "is", "not", "None", ":", "keys", ".", "insert", "(", "0", ",", "tree_node...
d43693eaf057b8683b9638e575000f055fede452
train
TreeNode.insert_value
Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count.
nion/swift/FilterPanel.py
def insert_value(self, keys, value): """ Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count. """ ...
def insert_value(self, keys, value): """ Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count. """ ...
[ "Insert", "a", "value", "(", "data", "item", ")", "into", "this", "tree", "node", "and", "then", "its", "children", ".", "This", "will", "be", "called", "in", "response", "to", "a", "new", "data", "item", "being", "inserted", "into", "the", "document", ...
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L358-L385
[ "def", "insert_value", "(", "self", ",", "keys", ",", "value", ")", ":", "self", ".", "count", "+=", "1", "if", "not", "self", ".", "key", ":", "self", ".", "__value_reverse_mapping", "[", "value", "]", "=", "keys", "if", "len", "(", "keys", ")", "...
d43693eaf057b8683b9638e575000f055fede452
train
TreeNode.remove_value
Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count.
nion/swift/FilterPanel.py
def remove_value(self, keys, value): """ Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count. """ self.count -= 1 if not self.key: keys = self.__value_reverse_mapping[value] d...
def remove_value(self, keys, value): """ Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count. """ self.count -= 1 if not self.key: keys = self.__value_reverse_mapping[value] d...
[ "Remove", "a", "value", "(", "data", "item", ")", "from", "this", "tree", "node", "and", "its", "children", ".", "Also", "updates", "the", "tree", "node", "s", "cumulative", "child", "count", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L387-L408
[ "def", "remove_value", "(", "self", ",", "keys", ",", "value", ")", ":", "self", ".", "count", "-=", "1", "if", "not", "self", ".", "key", ":", "keys", "=", "self", ".", "__value_reverse_mapping", "[", "value", "]", "del", "self", ".", "__value_reverse...
d43693eaf057b8683b9638e575000f055fede452
train
label_storm_objects
From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args: data: the gridded data to be labeled. Should be a 2D numpy array in (y, x) coordinate order or a 3D numpy array in (time, y, x) coordinate order ...
hagelslag/processing/tracker.py
def label_storm_objects(data, method, min_intensity, max_intensity, min_area=1, max_area=100, max_range=1, increment=1, gaussian_sd=0): """ From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args:...
def label_storm_objects(data, method, min_intensity, max_intensity, min_area=1, max_area=100, max_range=1, increment=1, gaussian_sd=0): """ From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args:...
[ "From", "a", "2D", "grid", "or", "time", "series", "of", "2D", "grids", "this", "method", "labels", "storm", "objects", "with", "either", "the", "Enhanced", "Watershed", "or", "Hysteresis", "methods", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L9-L48
[ "def", "label_storm_objects", "(", "data", ",", "method", ",", "min_intensity", ",", "max_intensity", ",", "min_area", "=", "1", ",", "max_area", "=", "100", ",", "max_range", "=", "1", ",", "increment", "=", "1", ",", "gaussian_sd", "=", "0", ")", ":", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
extract_storm_objects
After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep. Args: label_grid: 2D or 3D array output by label_storm_objects. data: 2D or 3D array...
hagelslag/processing/tracker.py
def extract_storm_objects(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, obj_buffer=0): """ After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep....
def extract_storm_objects(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, obj_buffer=0): """ After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep....
[ "After", "storms", "are", "labeled", "this", "method", "extracts", "the", "storm", "objects", "from", "the", "grid", "and", "places", "them", "into", "STObjects", ".", "The", "STObjects", "contain", "intensity", "location", "and", "shape", "information", "about"...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L51-L118
[ "def", "extract_storm_objects", "(", "label_grid", ",", "data", ",", "x_grid", ",", "y_grid", ",", "times", ",", "dx", "=", "1", ",", "dt", "=", "1", ",", "obj_buffer", "=", "0", ")", ":", "storm_objects", "=", "[", "]", "if", "len", "(", "label_grid...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
extract_storm_patches
After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep. Args: label_grid: 2D or 3D array output by label_storm_objects....
hagelslag/processing/tracker.py
def extract_storm_patches(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, patch_radius=16): """ After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about ...
def extract_storm_patches(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, patch_radius=16): """ After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about ...
[ "After", "storms", "are", "labeled", "this", "method", "extracts", "boxes", "of", "equal", "size", "centered", "on", "each", "storm", "from", "the", "grid", "and", "places", "them", "into", "STObjects", ".", "The", "STObjects", "contain", "intensity", "locatio...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L121-L185
[ "def", "extract_storm_patches", "(", "label_grid", ",", "data", ",", "x_grid", ",", "y_grid", ",", "times", ",", "dx", "=", "1", ",", "dt", "=", "1", ",", "patch_radius", "=", "16", ")", ":", "storm_objects", "=", "[", "]", "if", "len", "(", "label_g...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
track_storms
Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of STObjects that have not been tracked. times: List of times associated with each set of STObjects distance_componen...
hagelslag/processing/tracker.py
def track_storms(storm_objects, times, distance_components, distance_maxima, distance_weights, tracked_objects=None): """ Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of ...
def track_storms(storm_objects, times, distance_components, distance_maxima, distance_weights, tracked_objects=None): """ Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of ...
[ "Given", "the", "output", "of", "extract_storm_objects", "this", "method", "tracks", "storms", "through", "time", "and", "merges", "individual", "STObjects", "into", "a", "set", "of", "tracks", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L188-L222
[ "def", "track_storms", "(", "storm_objects", ",", "times", ",", "distance_components", ",", "distance_maxima", ",", "distance_weights", ",", "tracked_objects", "=", "None", ")", ":", "obj_matcher", "=", "ObjectMatcher", "(", "distance_components", ",", "distance_weigh...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
MulticlassContingencyTable.peirce_skill_score
Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score)
hagelslag/evaluation/MulticlassContingencyTable.py
def peirce_skill_score(self): """ Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score) """ n = float(self.table.sum()) nf = self.table.sum(axis=1) no = self.table.sum(axis=0) correct = float(self.table.trace()) return (correct /...
def peirce_skill_score(self): """ Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score) """ n = float(self.table.sum()) nf = self.table.sum(axis=1) no = self.table.sum(axis=0) correct = float(self.table.trace()) return (correct /...
[ "Multiclass", "Peirce", "Skill", "Score", "(", "also", "Hanssen", "and", "Kuipers", "score", "True", "Skill", "Score", ")" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MulticlassContingencyTable.py#L35-L43
[ "def", "peirce_skill_score", "(", "self", ")", ":", "n", "=", "float", "(", "self", ".", "table", ".", "sum", "(", ")", ")", "nf", "=", "self", ".", "table", ".", "sum", "(", "axis", "=", "1", ")", "no", "=", "self", ".", "table", ".", "sum", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
MulticlassContingencyTable.gerrity_score
Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return:
hagelslag/evaluation/MulticlassContingencyTable.py
def gerrity_score(self): """ Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return: """ k = self.table.shape[0] n = float(self.table.sum()) p_o = self.table.sum(axis=0) / n p_sum = np.cumsum(p_o)[:-1] ...
def gerrity_score(self): """ Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return: """ k = self.table.shape[0] n = float(self.table.sum()) p_o = self.table.sum(axis=0) / n p_sum = np.cumsum(p_o)[:-1] ...
[ "Gerrity", "Score", "which", "weights", "each", "cell", "in", "the", "contingency", "table", "by", "its", "observed", "relative", "frequency", ".", ":", "return", ":" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MulticlassContingencyTable.py#L45-L63
[ "def", "gerrity_score", "(", "self", ")", ":", "k", "=", "self", ".", "table", ".", "shape", "[", "0", "]", "n", "=", "float", "(", "self", ".", "table", ".", "sum", "(", ")", ")", "p_o", "=", "self", ".", "table", ".", "sum", "(", "axis", "=...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
centroid_distance
Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distan...
hagelslag/processing/ObjectMatcher.py
def centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher ...
def centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher ...
[ "Euclidean", "distance", "between", "the", "centroids", "of", "item_a", "and", "item_b", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L246-L262
[ "def", "centroid_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "ax", ",", "ay", "=", "item_a", ".", "center_of_mass", "(", "time_a", ")", "bx", ",", "by", "=", "item_b", ".", "center_of_mass", "(", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
shifted_centroid_distance
Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distance value used as sca...
hagelslag/processing/ObjectMatcher.py
def shifted_centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time...
def shifted_centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time...
[ "Centroid", "distance", "with", "motion", "corrections", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L269-L291
[ "def", "shifted_centroid_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "ax", ",", "ay", "=", "item_a", ".", "center_of_mass", "(", "time_a", ")", "bx", ",", "by", "=", "item_b", ".", "center_of_mass", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
closest_distance
Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_va...
hagelslag/processing/ObjectMatcher.py
def closest_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set...
def closest_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set...
[ "Euclidean", "distance", "between", "the", "pixels", "in", "item_a", "and", "item_b", "closest", "to", "each", "other", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L294-L308
[ "def", "closest_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "return", "np", ".", "minimum", "(", "item_a", ".", "closest_distance", "(", "time_a", ",", "item_b", ",", "time_b", ")", ",", "max_value", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ellipse_distance
Calculate differences in the properties of ellipses fitted to each object. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Ma...
hagelslag/processing/ObjectMatcher.py
def ellipse_distance(item_a, time_a, item_b, time_b, max_value): """ Calculate differences in the properties of ellipses fitted to each object. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in Obj...
def ellipse_distance(item_a, time_a, item_b, time_b, max_value): """ Calculate differences in the properties of ellipses fitted to each object. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in Obj...
[ "Calculate", "differences", "in", "the", "properties", "of", "ellipses", "fitted", "to", "each", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L311-L331
[ "def", "ellipse_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "ts", "=", "np", ".", "array", "(", "[", "0", ",", "np", ".", "pi", "]", ")", "ell_a", "=", "item_a", ".", "get_ellipse_model", "(", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
nonoverlap
Percentage of pixels in each object that do not overlap with the other object Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value:...
hagelslag/processing/ObjectMatcher.py
def nonoverlap(item_a, time_a, item_b, time_b, max_value): """ Percentage of pixels in each object that do not overlap with the other object Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in Object...
def nonoverlap(item_a, time_a, item_b, time_b, max_value): """ Percentage of pixels in each object that do not overlap with the other object Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in Object...
[ "Percentage", "of", "pixels", "in", "each", "object", "that", "do", "not", "overlap", "with", "the", "other", "object" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L334-L348
[ "def", "nonoverlap", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "return", "np", ".", "minimum", "(", "1", "-", "item_a", ".", "count_overlap", "(", "time_a", ",", "item_b", ",", "time_b", ")", ",", "max_valu...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
max_intensity
RMS difference in maximum intensity Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distance value used as scaling va...
hagelslag/processing/ObjectMatcher.py
def max_intensity(item_a, time_a, item_b, time_b, max_value): """ RMS difference in maximum intensity Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer be...
def max_intensity(item_a, time_a, item_b, time_b, max_value): """ RMS difference in maximum intensity Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer be...
[ "RMS", "difference", "in", "maximum", "intensity" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L351-L368
[ "def", "max_intensity", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "intensity_a", "=", "item_a", ".", "max_intensity", "(", "time_a", ")", "intensity_b", "=", "item_b", ".", "max_intensity", "(", "time_b", ")", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
area_difference
RMS Difference in object areas. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distance value used as scaling value ...
hagelslag/processing/ObjectMatcher.py
def area_difference(item_a, time_a, item_b, time_b, max_value): """ RMS Difference in object areas. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer bein...
def area_difference(item_a, time_a, item_b, time_b, max_value): """ RMS Difference in object areas. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer bein...
[ "RMS", "Difference", "in", "object", "areas", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L371-L388
[ "def", "area_difference", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "size_a", "=", "item_a", ".", "size", "(", "time_a", ")", "size_b", "=", "item_b", ".", "size", "(", "time_b", ")", "diff", "=", "np", "...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
mean_minimum_centroid_distance
RMS difference in the minimum distances from the centroids of one track to the centroids of another track Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constrai...
hagelslag/processing/ObjectMatcher.py
def mean_minimum_centroid_distance(item_a, item_b, max_value): """ RMS difference in the minimum distances from the centroids of one track to the centroids of another track Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher ...
def mean_minimum_centroid_distance(item_a, item_b, max_value): """ RMS difference in the minimum distances from the centroids of one track to the centroids of another track Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher ...
[ "RMS", "difference", "in", "the", "minimum", "distances", "from", "the", "centroids", "of", "one", "track", "to", "the", "centroids", "of", "another", "track" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L391-L407
[ "def", "mean_minimum_centroid_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "centroids_a", "=", "np", ".", "array", "(", "[", "item_a", ".", "center_of_mass", "(", "t", ")", "for", "t", "in", "item_a", ".", "times", "]", ")", "cent...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
mean_min_time_distance
Calculate the mean time difference among the time steps in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constraint. Returns: Distance...
hagelslag/processing/ObjectMatcher.py
def mean_min_time_distance(item_a, item_b, max_value): """ Calculate the mean time difference among the time steps in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as...
def mean_min_time_distance(item_a, item_b, max_value): """ Calculate the mean time difference among the time steps in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as...
[ "Calculate", "the", "mean", "time", "difference", "among", "the", "time", "steps", "in", "each", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L410-L426
[ "def", "mean_min_time_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "times_a", "=", "item_a", ".", "times", ".", "reshape", "(", "(", "item_a", ".", "times", ".", "size", ",", "1", ")", ")", "times_b", "=", "item_b", ".", "times"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
start_centroid_distance
Distance between the centroids of the first step in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constraint. Returns: Distance value ...
hagelslag/processing/ObjectMatcher.py
def start_centroid_distance(item_a, item_b, max_value): """ Distance between the centroids of the first step in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scali...
def start_centroid_distance(item_a, item_b, max_value): """ Distance between the centroids of the first step in each object. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scali...
[ "Distance", "between", "the", "centroids", "of", "the", "first", "step", "in", "each", "object", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L429-L444
[ "def", "start_centroid_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "start_a", "=", "item_a", ".", "center_of_mass", "(", "item_a", ".", "times", "[", "0", "]", ")", "start_b", "=", "item_b", ".", "center_of_mass", "(", "item_b", "....
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
start_time_distance
Absolute difference between the starting times of each item. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constraint. Returns: Distance value betw...
hagelslag/processing/ObjectMatcher.py
def start_time_distance(item_a, item_b, max_value): """ Absolute difference between the starting times of each item. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value...
def start_time_distance(item_a, item_b, max_value): """ Absolute difference between the starting times of each item. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value...
[ "Absolute", "difference", "between", "the", "starting", "times", "of", "each", "item", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L447-L460
[ "def", "start_time_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "start_time_diff", "=", "np", ".", "abs", "(", "item_a", ".", "times", "[", "0", "]", "-", "item_b", ".", "times", "[", "0", "]", ")", "return", "np", ".", "minim...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
duration_distance
Absolute difference in the duration of two items Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constraint. Returns: Distance value between 0 and 1.
hagelslag/processing/ObjectMatcher.py
def duration_distance(item_a, item_b, max_value): """ Absolute difference in the duration of two items Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper con...
def duration_distance(item_a, item_b, max_value): """ Absolute difference in the duration of two items Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper con...
[ "Absolute", "difference", "in", "the", "duration", "of", "two", "items" ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L463-L477
[ "def", "duration_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "duration_a", "=", "item_a", ".", "times", ".", "size", "duration_b", "=", "item_b", ".", "times", ".", "size", "return", "np", ".", "minimum", "(", "np", ".", "abs", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
mean_area_distance
Absolute difference in the means of the areas of each track over time. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scaling value and upper constraint. Returns: Distance ...
hagelslag/processing/ObjectMatcher.py
def mean_area_distance(item_a, item_b, max_value): """ Absolute difference in the means of the areas of each track over time. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scal...
def mean_area_distance(item_a, item_b, max_value): """ Absolute difference in the means of the areas of each track over time. Args: item_a: STObject from the first set in TrackMatcher item_b: STObject from the second set in TrackMatcher max_value: Maximum distance value used as scal...
[ "Absolute", "difference", "in", "the", "means", "of", "the", "areas", "of", "each", "track", "over", "time", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L480-L494
[ "def", "mean_area_distance", "(", "item_a", ",", "item_b", ",", "max_value", ")", ":", "mean_area_a", "=", "np", ".", "mean", "(", "[", "item_a", ".", "size", "(", "t", ")", "for", "t", "in", "item_a", ".", "times", "]", ")", "mean_area_b", "=", "np"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ObjectMatcher.match_objects
Match two sets of objects at particular times. Args: set_a: list of STObjects set_b: list of STObjects time_a: time at which set_a is being evaluated for matching time_b: time at which set_b is being evaluated for matching Returns: List of tu...
hagelslag/processing/ObjectMatcher.py
def match_objects(self, set_a, set_b, time_a, time_b): """ Match two sets of objects at particular times. Args: set_a: list of STObjects set_b: list of STObjects time_a: time at which set_a is being evaluated for matching time_b: time at which set...
def match_objects(self, set_a, set_b, time_a, time_b): """ Match two sets of objects at particular times. Args: set_a: list of STObjects set_b: list of STObjects time_a: time at which set_a is being evaluated for matching time_b: time at which set...
[ "Match", "two", "sets", "of", "objects", "at", "particular", "times", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L27-L53
[ "def", "match_objects", "(", "self", ",", "set_a", ",", "set_b", ",", "time_a", ",", "time_b", ")", ":", "costs", "=", "self", ".", "cost_matrix", "(", "set_a", ",", "set_b", ",", "time_a", ",", "time_b", ")", "*", "100", "min_row_costs", "=", "costs",...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ObjectMatcher.cost_matrix
Calculates the costs (distances) between the items in set a and set b at the specified times. Args: set_a: List of STObjects set_b: List of STObjects time_a: time at which objects in set_a are evaluated time_b: time at whcih object in set_b are evaluated ...
hagelslag/processing/ObjectMatcher.py
def cost_matrix(self, set_a, set_b, time_a, time_b): """ Calculates the costs (distances) between the items in set a and set b at the specified times. Args: set_a: List of STObjects set_b: List of STObjects time_a: time at which objects in set_a are evaluated...
def cost_matrix(self, set_a, set_b, time_a, time_b): """ Calculates the costs (distances) between the items in set a and set b at the specified times. Args: set_a: List of STObjects set_b: List of STObjects time_a: time at which objects in set_a are evaluated...
[ "Calculates", "the", "costs", "(", "distances", ")", "between", "the", "items", "in", "set", "a", "and", "set", "b", "at", "the", "specified", "times", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L55-L73
[ "def", "cost_matrix", "(", "self", ",", "set_a", ",", "set_b", ",", "time_a", ",", "time_b", ")", ":", "costs", "=", "np", ".", "zeros", "(", "(", "len", "(", "set_a", ")", ",", "len", "(", "set_b", ")", ")", ")", "for", "a", ",", "item_a", "in...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ObjectMatcher.total_cost_function
Calculate total cost function between two items. Args: item_a: STObject item_b: STObject time_a: Timestep in item_a at which cost function is evaluated time_b: Timestep in item_b at which cost function is evaluated Returns: The total weighted...
hagelslag/processing/ObjectMatcher.py
def total_cost_function(self, item_a, item_b, time_a, time_b): """ Calculate total cost function between two items. Args: item_a: STObject item_b: STObject time_a: Timestep in item_a at which cost function is evaluated time_b: Timestep in item_b a...
def total_cost_function(self, item_a, item_b, time_a, time_b): """ Calculate total cost function between two items. Args: item_a: STObject item_b: STObject time_a: Timestep in item_a at which cost function is evaluated time_b: Timestep in item_b a...
[ "Calculate", "total", "cost", "function", "between", "two", "items", "." ]
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L75-L92
[ "def", "total_cost_function", "(", "self", ",", "item_a", ",", "item_b", ",", "time_a", ",", "time_b", ")", ":", "distances", "=", "np", ".", "zeros", "(", "len", "(", "self", ".", "weights", ")", ")", "for", "c", ",", "component", "in", "enumerate", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackMatcher.match_tracks
Find the optimal set of matching assignments between set a and set b. This function supports optimal 1:1 matching using the Munkres method and matching from every object in set a to the closest object in set b. In this situation set b accepts multiple matches from set a. Args: set_a...
hagelslag/processing/ObjectMatcher.py
def match_tracks(self, set_a, set_b, closest_matches=False): """ Find the optimal set of matching assignments between set a and set b. This function supports optimal 1:1 matching using the Munkres method and matching from every object in set a to the closest object in set b. In this situ...
def match_tracks(self, set_a, set_b, closest_matches=False): """ Find the optimal set of matching assignments between set a and set b. This function supports optimal 1:1 matching using the Munkres method and matching from every object in set a to the closest object in set b. In this situ...
[ "Find", "the", "optimal", "set", "of", "matching", "assignments", "between", "set", "a", "and", "set", "b", ".", "This", "function", "supports", "optimal", "1", ":", "1", "matching", "using", "the", "Munkres", "method", "and", "matching", "from", "every", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L112-L145
[ "def", "match_tracks", "(", "self", ",", "set_a", ",", "set_b", ",", "closest_matches", "=", "False", ")", ":", "costs", "=", "self", ".", "track_cost_matrix", "(", "set_a", ",", "set_b", ")", "*", "100", "min_row_costs", "=", "costs", ".", "min", "(", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
TrackStepMatcher.match
For each step in each track from set_a, identify all steps in all tracks from set_b that meet all cost function criteria Args: set_a: List of STObjects set_b: List of STObjects Returns: track_pairings: pandas.DataFrame
hagelslag/processing/ObjectMatcher.py
def match(self, set_a, set_b): """ For each step in each track from set_a, identify all steps in all tracks from set_b that meet all cost function criteria Args: set_a: List of STObjects set_b: List of STObjects Returns: track_pairing...
def match(self, set_a, set_b): """ For each step in each track from set_a, identify all steps in all tracks from set_b that meet all cost function criteria Args: set_a: List of STObjects set_b: List of STObjects Returns: track_pairing...
[ "For", "each", "step", "in", "each", "track", "from", "set_a", "identify", "all", "steps", "in", "all", "tracks", "from", "set_b", "that", "meet", "all", "cost", "function", "criteria", "Args", ":", "set_a", ":", "List", "of", "STObjects", "set_b", ":", ...
djgagne/hagelslag
python
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L190-L224
[ "def", "match", "(", "self", ",", "set_a", ",", "set_b", ")", ":", "track_step_matches", "=", "[", "[", "]", "*", "len", "(", "set_a", ")", "]", "costs", "=", "self", ".", "cost_matrix", "(", "set_a", ",", "set_b", ")", "valid_costs", "=", "np", "....
6fb6c3df90bf4867e13a97d3460b14471d107df1
train
ComputationVariable.variable_specifier
Return the variable specifier for this variable. The specifier can be used to lookup the value of this variable in a computation context.
nion/swift/model/Symbolic.py
def variable_specifier(self) -> dict: """Return the variable specifier for this variable. The specifier can be used to lookup the value of this variable in a computation context. """ if self.value_type is not None: return {"type": "variable", "version": 1, "uuid": str(self.u...
def variable_specifier(self) -> dict: """Return the variable specifier for this variable. The specifier can be used to lookup the value of this variable in a computation context. """ if self.value_type is not None: return {"type": "variable", "version": 1, "uuid": str(self.u...
[ "Return", "the", "variable", "specifier", "for", "this", "variable", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L228-L236
[ "def", "variable_specifier", "(", "self", ")", "->", "dict", ":", "if", "self", ".", "value_type", "is", "not", "None", ":", "return", "{", "\"type\"", ":", "\"variable\"", ",", "\"version\"", ":", "1", ",", "\"uuid\"", ":", "str", "(", "self", ".", "u...
d43693eaf057b8683b9638e575000f055fede452
train
ComputationVariable.bound_variable
Return an object with a value property and a changed_event. The value property returns the value of the variable. The changed_event is fired whenever the value changes.
nion/swift/model/Symbolic.py
def bound_variable(self): """Return an object with a value property and a changed_event. The value property returns the value of the variable. The changed_event is fired whenever the value changes. """ class BoundVariable: def __init__(self, variable): ...
def bound_variable(self): """Return an object with a value property and a changed_event. The value property returns the value of the variable. The changed_event is fired whenever the value changes. """ class BoundVariable: def __init__(self, variable): ...
[ "Return", "an", "object", "with", "a", "value", "property", "and", "a", "changed_event", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L239-L261
[ "def", "bound_variable", "(", "self", ")", ":", "class", "BoundVariable", ":", "def", "__init__", "(", "self", ",", "variable", ")", ":", "self", ".", "__variable", "=", "variable", "self", ".", "changed_event", "=", "Event", ".", "Event", "(", ")", "sel...
d43693eaf057b8683b9638e575000f055fede452
train
ComputationContext.resolve_object_specifier
Resolve the object specifier. First lookup the object specifier in the enclosing computation. If it's not found, then lookup in the computation's context. Otherwise it should be a value type variable. In that case, return the bound variable.
nion/swift/model/Symbolic.py
def resolve_object_specifier(self, object_specifier, secondary_specifier=None, property_name=None, objects_model=None): """Resolve the object specifier. First lookup the object specifier in the enclosing computation. If it's not found, then lookup in the computation's context. Otherwise it shou...
def resolve_object_specifier(self, object_specifier, secondary_specifier=None, property_name=None, objects_model=None): """Resolve the object specifier. First lookup the object specifier in the enclosing computation. If it's not found, then lookup in the computation's context. Otherwise it shou...
[ "Resolve", "the", "object", "specifier", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L435-L447
[ "def", "resolve_object_specifier", "(", "self", ",", "object_specifier", ",", "secondary_specifier", "=", "None", ",", "property_name", "=", "None", ",", "objects_model", "=", "None", ")", ":", "variable", "=", "self", ".", "__computation", "(", ")", ".", "res...
d43693eaf057b8683b9638e575000f055fede452
train
Computation.parse_names
Return the list of identifiers used in the expression.
nion/swift/model/Symbolic.py
def parse_names(cls, expression): """Return the list of identifiers used in the expression.""" names = set() try: ast_node = ast.parse(expression, "ast") class Visitor(ast.NodeVisitor): def visit_Name(self, node): names.add(node.id) ...
def parse_names(cls, expression): """Return the list of identifiers used in the expression.""" names = set() try: ast_node = ast.parse(expression, "ast") class Visitor(ast.NodeVisitor): def visit_Name(self, node): names.add(node.id) ...
[ "Return", "the", "list", "of", "identifiers", "used", "in", "the", "expression", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L686-L699
[ "def", "parse_names", "(", "cls", ",", "expression", ")", ":", "names", "=", "set", "(", ")", "try", ":", "ast_node", "=", "ast", ".", "parse", "(", "expression", ",", "\"ast\"", ")", "class", "Visitor", "(", "ast", ".", "NodeVisitor", ")", ":", "def...
d43693eaf057b8683b9638e575000f055fede452
train
Computation.bind
Bind a context to this computation. The context allows the computation to convert object specifiers to actual objects.
nion/swift/model/Symbolic.py
def bind(self, context) -> None: """Bind a context to this computation. The context allows the computation to convert object specifiers to actual objects. """ # make a computation context based on the enclosing context. self.__computation_context = ComputationContext(self, cont...
def bind(self, context) -> None: """Bind a context to this computation. The context allows the computation to convert object specifiers to actual objects. """ # make a computation context based on the enclosing context. self.__computation_context = ComputationContext(self, cont...
[ "Bind", "a", "context", "to", "this", "computation", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L863-L884
[ "def", "bind", "(", "self", ",", "context", ")", "->", "None", ":", "# make a computation context based on the enclosing context.", "self", ".", "__computation_context", "=", "ComputationContext", "(", "self", ",", "context", ")", "# re-bind is not valid. be careful to set ...
d43693eaf057b8683b9638e575000f055fede452
train
Computation.unbind
Unlisten and close each bound item.
nion/swift/model/Symbolic.py
def unbind(self): """Unlisten and close each bound item.""" for variable in self.variables: self.__unbind_variable(variable) for result in self.results: self.__unbind_result(result)
def unbind(self): """Unlisten and close each bound item.""" for variable in self.variables: self.__unbind_variable(variable) for result in self.results: self.__unbind_result(result)
[ "Unlisten", "and", "close", "each", "bound", "item", "." ]
nion-software/nionswift
python
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Symbolic.py#L886-L891
[ "def", "unbind", "(", "self", ")", ":", "for", "variable", "in", "self", ".", "variables", ":", "self", ".", "__unbind_variable", "(", "variable", ")", "for", "result", "in", "self", ".", "results", ":", "self", ".", "__unbind_result", "(", "result", ")"...
d43693eaf057b8683b9638e575000f055fede452
train
ClienteSATLocal.ativar_sat
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.ativar_sat`. :return: Uma resposta SAT especilizada em ``AtivarSAT``. :rtype: satcfe.resposta.ativarsat.RespostaAtivarSAT
satcfe/clientelocal.py
def ativar_sat(self, tipo_certificado, cnpj, codigo_uf): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.ativar_sat`. :return: Uma resposta SAT especilizada em ``AtivarSAT``. :rtype: satcfe.resposta.ativarsat.RespostaAtivarSAT """ retorno = super(ClienteSATLocal, self).ativar_sat( ...
def ativar_sat(self, tipo_certificado, cnpj, codigo_uf): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.ativar_sat`. :return: Uma resposta SAT especilizada em ``AtivarSAT``. :rtype: satcfe.resposta.ativarsat.RespostaAtivarSAT """ retorno = super(ClienteSATLocal, self).ativar_sat( ...
[ "Sobrepõe", ":", "meth", ":", "~satcfe", ".", "base", ".", "FuncoesSAT", ".", "ativar_sat", "." ]
base4sistemas/satcfe
python
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/clientelocal.py#L46-L54
[ "def", "ativar_sat", "(", "self", ",", "tipo_certificado", ",", "cnpj", ",", "codigo_uf", ")", ":", "retorno", "=", "super", "(", "ClienteSATLocal", ",", "self", ")", ".", "ativar_sat", "(", "tipo_certificado", ",", "cnpj", ",", "codigo_uf", ")", "return", ...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9
train
ClienteSATLocal.comunicar_certificado_icpbrasil
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT
satcfe/clientelocal.py
def comunicar_certificado_icpbrasil(self, certificado): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT """ retorno = super(ClienteSATLocal, self).\ comunica...
def comunicar_certificado_icpbrasil(self, certificado): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`. :return: Uma resposta SAT padrão. :rtype: satcfe.resposta.padrao.RespostaSAT """ retorno = super(ClienteSATLocal, self).\ comunica...
[ "Sobrepõe", ":", "meth", ":", "~satcfe", ".", "base", ".", "FuncoesSAT", ".", "comunicar_certificado_icpbrasil", "." ]
base4sistemas/satcfe
python
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/clientelocal.py#L57-L65
[ "def", "comunicar_certificado_icpbrasil", "(", "self", ",", "certificado", ")", ":", "retorno", "=", "super", "(", "ClienteSATLocal", ",", "self", ")", ".", "comunicar_certificado_icpbrasil", "(", "certificado", ")", "return", "RespostaSAT", ".", "comunicar_certificad...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9
train
ClienteSATLocal.enviar_dados_venda
Sobrepõe :meth:`~satcfe.base.FuncoesSAT.enviar_dados_venda`. :return: Uma resposta SAT especializada em ``EnviarDadosVenda``. :rtype: satcfe.resposta.enviardadosvenda.RespostaEnviarDadosVenda
satcfe/clientelocal.py
def enviar_dados_venda(self, dados_venda): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.enviar_dados_venda`. :return: Uma resposta SAT especializada em ``EnviarDadosVenda``. :rtype: satcfe.resposta.enviardadosvenda.RespostaEnviarDadosVenda """ retorno = super(ClienteSATLocal, self...
def enviar_dados_venda(self, dados_venda): """Sobrepõe :meth:`~satcfe.base.FuncoesSAT.enviar_dados_venda`. :return: Uma resposta SAT especializada em ``EnviarDadosVenda``. :rtype: satcfe.resposta.enviardadosvenda.RespostaEnviarDadosVenda """ retorno = super(ClienteSATLocal, self...
[ "Sobrepõe", ":", "meth", ":", "~satcfe", ".", "base", ".", "FuncoesSAT", ".", "enviar_dados_venda", "." ]
base4sistemas/satcfe
python
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/clientelocal.py#L68-L75
[ "def", "enviar_dados_venda", "(", "self", ",", "dados_venda", ")", ":", "retorno", "=", "super", "(", "ClienteSATLocal", ",", "self", ")", ".", "enviar_dados_venda", "(", "dados_venda", ")", "return", "RespostaEnviarDadosVenda", ".", "analisar", "(", "retorno", ...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9