repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
djgagne/hagelslag
hagelslag/util/munkres.py
Munkres.__clear_covers
def __clear_covers(self): """Clear all covered matrix cells""" for i in range(self.n): self.row_covered[i] = False self.col_covered[i] = False
python
def __clear_covers(self): """Clear all covered matrix cells""" for i in range(self.n): self.row_covered[i] = False self.col_covered[i] = False
[ "def", "__clear_covers", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "self", ".", "row_covered", "[", "i", "]", "=", "False", "self", ".", "col_covered", "[", "i", "]", "=", "False" ]
Clear all covered matrix cells
[ "Clear", "all", "covered", "matrix", "cells" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L659-L663
djgagne/hagelslag
hagelslag/util/munkres.py
Munkres.__erase_primes
def __erase_primes(self): """Erase all prime markings""" for i in range(self.n): for j in range(self.n): if self.marked[i][j] == 2: self.marked[i][j] = 0
python
def __erase_primes(self): """Erase all prime markings""" for i in range(self.n): for j in range(self.n): if self.marked[i][j] == 2: self.marked[i][j] = 0
[ "def", "__erase_primes", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n", ")", ":", "for", "j", "in", "range", "(", "self", ".", "n", ")", ":", "if", "self", ".", "marked", "[", "i", "]", "[", "j", "]", "==", "2", ":...
Erase all prime markings
[ "Erase", "all", "prime", "markings" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/munkres.py#L665-L670
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.update
def update(self, a, b, c, d): """ Update contingency table with new values without creating a new object. """ self.table.ravel()[:] = [a, b, c, d] self.N = self.table.sum()
python
def update(self, a, b, c, d): """ Update contingency table with new values without creating a new object. """ self.table.ravel()[:] = [a, b, c, d] self.N = self.table.sum()
[ "def", "update", "(", "self", ",", "a", ",", "b", ",", "c", ",", "d", ")", ":", "self", ".", "table", ".", "ravel", "(", ")", "[", ":", "]", "=", "[", "a", ",", "b", ",", "c", ",", "d", "]", "self", ".", "N", "=", "self", ".", "table", ...
Update contingency table with new values without creating a new object.
[ "Update", "contingency", "table", "with", "new", "values", "without", "creating", "a", "new", "object", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L23-L28
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.bias
def bias(self): """ Frequency Bias. Formula: (a+b)/(a+c)""" return (self.table[0, 0] + self.table[0, 1]) / (self.table[0, 0] + self.table[1, 0])
python
def bias(self): """ Frequency Bias. Formula: (a+b)/(a+c)""" return (self.table[0, 0] + self.table[0, 1]) / (self.table[0, 0] + self.table[1, 0])
[ "def", "bias", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", ")", "/", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table...
Frequency Bias. Formula: (a+b)/(a+c)
[ "Frequency", "Bias", ".", "Formula", ":", "(", "a", "+", "b", ")", "/", "(", "a", "+", "c", ")" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L92-L96
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.csi
def csi(self): """Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)""" return self.table[0, 0] / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0])
python
def csi(self): """Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)""" return self.table[0, 0] / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0])
[ "def", "csi", "(", "self", ")", ":", "return", "self", ".", "table", "[", "0", ",", "0", "]", "/", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", "+", "self", ".", "table", "[", "1"...
Gilbert's Score or Threat Score or Critical Success Index a/(a+b+c)
[ "Gilbert", "s", "Score", "or", "Threat", "Score", "or", "Critical", "Success", "Index", "a", "/", "(", "a", "+", "b", "+", "c", ")" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L102-L104
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.ets
def ets(self): """Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N""" r = (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 0] + self.table[1, 0]) / self.N return (self.table[0, 0] - r) / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0] - r)
python
def ets(self): """Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N""" r = (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 0] + self.table[1, 0]) / self.N return (self.table[0, 0] - r) / (self.table[0, 0] + self.table[0, 1] + self.table[1, 0] - r)
[ "def", "ets", "(", "self", ")", ":", "r", "=", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "table", "[", "0", ",", "1", "]", ")", "*", "(", "self", ".", "table", "[", "0", ",", "0", "]", "+", "self", ".", "tabl...
Equitable Threat Score, Gilbert Skill Score, v, (a - R)/(a + b + c - R), R=(a+b)(a+c)/N
[ "Equitable", "Threat", "Score", "Gilbert", "Skill", "Score", "v", "(", "a", "-", "R", ")", "/", "(", "a", "+", "b", "+", "c", "-", "R", ")", "R", "=", "(", "a", "+", "b", ")", "(", "a", "+", "c", ")", "/", "N" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L106-L109
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.hss
def hss(self): """Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))""" return 2 * (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / ( (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 1] + self.table[1, 1]) + (self.table[0, 0] + ...
python
def hss(self): """Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))""" return 2 * (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / ( (self.table[0, 0] + self.table[0, 1]) * (self.table[0, 1] + self.table[1, 1]) + (self.table[0, 0] + ...
[ "def", "hss", "(", "self", ")", ":", "return", "2", "*", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table"...
Doolittle (Heidke) Skill Score. 2(ad-bc)/((a+b)(b+d) + (a+c)(c+d))
[ "Doolittle", "(", "Heidke", ")", "Skill", "Score", ".", "2", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "b", ")", "(", "b", "+", "d", ")", "+", "(", "a", "+", "c", ")", "(", "c", "+", "d", "))" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L111-L115
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.pss
def pss(self): """Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[1, 0]) * (self.table[0, 1] + self.table[1, 1]))
python
def pss(self): """Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[1, 0]) * (self.table[0, 1] + self.table[1, 1]))
[ "def", "pss", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table", "[", "1"...
Peirce (Hansen-Kuipers, True) Skill Score (ad - bc)/((a+c)(b+d))
[ "Peirce", "(", "Hansen", "-", "Kuipers", "True", ")", "Skill", "Score", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "c", ")", "(", "b", "+", "d", "))" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L117-L120
djgagne/hagelslag
hagelslag/evaluation/ContingencyTable.py
ContingencyTable.css
def css(self): """Clayton Skill Score (ad - bc)/((a+b)(c+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[0, 1]) * (self.table[1, 0] + self.table[1, 1]))
python
def css(self): """Clayton Skill Score (ad - bc)/((a+b)(c+d))""" return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \ ((self.table[0, 0] + self.table[0, 1]) * (self.table[1, 0] + self.table[1, 1]))
[ "def", "css", "(", "self", ")", ":", "return", "(", "self", ".", "table", "[", "0", ",", "0", "]", "*", "self", ".", "table", "[", "1", ",", "1", "]", "-", "self", ".", "table", "[", "0", ",", "1", "]", "*", "self", ".", "table", "[", "1"...
Clayton Skill Score (ad - bc)/((a+b)(c+d))
[ "Clayton", "Skill", "Score", "(", "ad", "-", "bc", ")", "/", "((", "a", "+", "b", ")", "(", "c", "+", "d", "))" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ContingencyTable.py#L122-L125
djgagne/hagelslag
hagelslag/util/output_tree_ensembles.py
load_tree_object
def load_tree_object(filename): """ Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object """ with open(filename) as file_obj: ...
python
def load_tree_object(filename): """ Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object """ with open(filename) as file_obj: ...
[ "def", "load_tree_object", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "file_obj", ":", "tree_ensemble_obj", "=", "pickle", ".", "load", "(", "file_obj", ")", "return", "tree_ensemble_obj" ]
Load scikit-learn decision tree ensemble object from file. Parameters ---------- filename : str Name of the pickle file containing the tree object. Returns ------- tree ensemble object
[ "Load", "scikit", "-", "learn", "decision", "tree", "ensemble", "object", "from", "file", ".", "Parameters", "----------", "filename", ":", "str", "Name", "of", "the", "pickle", "file", "containing", "the", "tree", "object", ".", "Returns", "-------", "tree", ...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L30-L45
djgagne/hagelslag
hagelslag/util/output_tree_ensembles.py
output_tree_ensemble
def output_tree_ensemble(tree_ensemble_obj, output_filename, attribute_names=None): """ Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str ...
python
def output_tree_ensemble(tree_ensemble_obj, output_filename, attribute_names=None): """ Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str ...
[ "def", "output_tree_ensemble", "(", "tree_ensemble_obj", ",", "output_filename", ",", "attribute_names", "=", "None", ")", ":", "for", "t", ",", "tree", "in", "enumerate", "(", "tree_ensemble_obj", ".", "estimators_", ")", ":", "print", "(", "\"Writing Tree {0:d}\...
Write each decision tree in an ensemble to a file. Parameters ---------- tree_ensemble_obj : sklearn.ensemble object Random Forest or Gradient Boosted Regression object output_filename : str File where trees are written attribute_names : list List of attribute names to be us...
[ "Write", "each", "decision", "tree", "in", "an", "ensemble", "to", "a", "file", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L48-L69
djgagne/hagelslag
hagelslag/util/output_tree_ensembles.py
print_tree_recursive
def print_tree_recursive(tree_obj, node_index, attribute_names=None): """ Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being pr...
python
def print_tree_recursive(tree_obj, node_index, attribute_names=None): """ Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being pr...
[ "def", "print_tree_recursive", "(", "tree_obj", ",", "node_index", ",", "attribute_names", "=", "None", ")", ":", "tree_str", "=", "\"\"", "if", "node_index", "==", "0", ":", "tree_str", "+=", "\"{0:d}\\n\"", ".", "format", "(", "tree_obj", ".", "node_count", ...
Recursively writes a string representation of a decision tree object. Parameters ---------- tree_obj : sklearn.tree._tree.Tree object A base decision tree object node_index : int Index of the node being printed attribute_names : list List of attribute names Returns ...
[ "Recursively", "writes", "a", "string", "representation", "of", "a", "decision", "tree", "object", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/output_tree_ensembles.py#L72-L116
mgraffg/EvoDAG
EvoDAG/bagging_fitness.py
BaggingFitness.set_classifier_mask
def set_classifier_mask(self, v, base_mask=True): """Computes the mask used to create the training and validation set""" base = self._base v = tonparray(v) a = np.unique(v) if a[0] != -1 or a[1] != 1: raise RuntimeError("The labels must be -1 and 1 (%s)" % a) ...
python
def set_classifier_mask(self, v, base_mask=True): """Computes the mask used to create the training and validation set""" base = self._base v = tonparray(v) a = np.unique(v) if a[0] != -1 or a[1] != 1: raise RuntimeError("The labels must be -1 and 1 (%s)" % a) ...
[ "def", "set_classifier_mask", "(", "self", ",", "v", ",", "base_mask", "=", "True", ")", ":", "base", "=", "self", ".", "_base", "v", "=", "tonparray", "(", "v", ")", "a", "=", "np", ".", "unique", "(", "v", ")", "if", "a", "[", "0", "]", "!=",...
Computes the mask used to create the training and validation set
[ "Computes", "the", "mask", "used", "to", "create", "the", "training", "and", "validation", "set" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L114-L129
mgraffg/EvoDAG
EvoDAG/bagging_fitness.py
BaggingFitness.set_regression_mask
def set_regression_mask(self, v): """Computes the mask used to create the training and validation set""" base = self._base index = np.arange(v.size()) np.random.shuffle(index) ones = np.ones(v.size()) ones[index[int(base._tr_fraction * v.size()):]] = 0 base._mask ...
python
def set_regression_mask(self, v): """Computes the mask used to create the training and validation set""" base = self._base index = np.arange(v.size()) np.random.shuffle(index) ones = np.ones(v.size()) ones[index[int(base._tr_fraction * v.size()):]] = 0 base._mask ...
[ "def", "set_regression_mask", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "index", "=", "np", ".", "arange", "(", "v", ".", "size", "(", ")", ")", "np", ".", "random", ".", "shuffle", "(", "index", ")", "ones", "=", "np", ...
Computes the mask used to create the training and validation set
[ "Computes", "the", "mask", "used", "to", "create", "the", "training", "and", "validation", "set" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L164-L171
mgraffg/EvoDAG
EvoDAG/bagging_fitness.py
BaggingFitness.fitness
def fitness(self, v): "Fitness function in the training set" base = self._base if base._classifier: if base._multiple_outputs: hy = SparseArray.argmax(v.hy) fit_func = base._fitness_function if fit_func == 'macro-F1' or fit_func == 'a_F...
python
def fitness(self, v): "Fitness function in the training set" base = self._base if base._classifier: if base._multiple_outputs: hy = SparseArray.argmax(v.hy) fit_func = base._fitness_function if fit_func == 'macro-F1' or fit_func == 'a_F...
[ "def", "fitness", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "if", "base", ".", "_classifier", ":", "if", "base", ".", "_multiple_outputs", ":", "hy", "=", "SparseArray", ".", "argmax", "(", "v", ".", "hy", ")", "fit_func", ...
Fitness function in the training set
[ "Fitness", "function", "in", "the", "training", "set" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L212-L300
mgraffg/EvoDAG
EvoDAG/bagging_fitness.py
BaggingFitness.fitness_vs
def fitness_vs(self, v): """Fitness function in the validation set In classification it uses BER and RSE in regression""" base = self._base if base._classifier: if base._multiple_outputs: v.fitness_vs = v._error # if base._fitness_function == '...
python
def fitness_vs(self, v): """Fitness function in the validation set In classification it uses BER and RSE in regression""" base = self._base if base._classifier: if base._multiple_outputs: v.fitness_vs = v._error # if base._fitness_function == '...
[ "def", "fitness_vs", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "if", "base", ".", "_classifier", ":", "if", "base", ".", "_multiple_outputs", ":", "v", ".", "fitness_vs", "=", "v", ".", "_error", "# if base._fitness_function == 'm...
Fitness function in the validation set In classification it uses BER and RSE in regression
[ "Fitness", "function", "in", "the", "validation", "set", "In", "classification", "it", "uses", "BER", "and", "RSE", "in", "regression" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L302-L342
mgraffg/EvoDAG
EvoDAG/bagging_fitness.py
BaggingFitness.set_fitness
def set_fitness(self, v): """Set the fitness to a new node. Returns false in case fitness is not finite""" base = self._base self.fitness(v) if not np.isfinite(v.fitness): self.del_error(v) return False if base._tr_fraction < 1: self.fi...
python
def set_fitness(self, v): """Set the fitness to a new node. Returns false in case fitness is not finite""" base = self._base self.fitness(v) if not np.isfinite(v.fitness): self.del_error(v) return False if base._tr_fraction < 1: self.fi...
[ "def", "set_fitness", "(", "self", ",", "v", ")", ":", "base", "=", "self", ".", "_base", "self", ".", "fitness", "(", "v", ")", "if", "not", "np", ".", "isfinite", "(", "v", ".", "fitness", ")", ":", "self", ".", "del_error", "(", "v", ")", "r...
Set the fitness to a new node. Returns false in case fitness is not finite
[ "Set", "the", "fitness", "to", "a", "new", "node", ".", "Returns", "false", "in", "case", "fitness", "is", "not", "finite" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/bagging_fitness.py#L344-L358
base4sistemas/satcfe
satcfe/resposta/cancelarultimavenda.py
RespostaCancelarUltimaVenda.analisar
def analisar(retorno): """Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='EnviarDadosVenda', ...
python
def analisar(retorno): """Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``. """ resposta = analisar_retorno(forcar_unicode(retorno), funcao='EnviarDadosVenda', ...
[ "def", "analisar", "(", "retorno", ")", ":", "resposta", "=", "analisar_retorno", "(", "forcar_unicode", "(", "retorno", ")", ",", "funcao", "=", "'EnviarDadosVenda'", ",", "classe_resposta", "=", "RespostaCancelarUltimaVenda", ",", "campos", "=", "(", "(", "'nu...
Constrói uma :class:`RespostaCancelarUltimaVenda` a partir do retorno informado. :param unicode retorno: Retorno da função ``CancelarUltimaVenda``.
[ "Constrói", "uma", ":", "class", ":", "RespostaCancelarUltimaVenda", "a", "partir", "do", "retorno", "informado", "." ]
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/cancelarultimavenda.py#L80-L121
nion-software/nionswift
nion/swift/model/ImportExportManager.py
convert_data_element_to_data_and_metadata_1
def convert_data_element_to_data_and_metadata_1(data_element) -> DataAndMetadata.DataAndMetadata: """Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional de...
python
def convert_data_element_to_data_and_metadata_1(data_element) -> DataAndMetadata.DataAndMetadata: """Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional de...
[ "def", "convert_data_element_to_data_and_metadata_1", "(", "data_element", ")", "->", "DataAndMetadata", ".", "DataAndMetadata", ":", "# data. takes ownership.", "data", "=", "data_element", "[", "\"data\"", "]", "dimensional_shape", "=", "Image", ".", "dimensional_shape_fr...
Convert a data element to xdata. No data copying occurs. The data element can have the following keys: data (required) is_sequence, collection_dimension_count, datum_dimension_count (optional description of the data) spatial_calibrations (optional list of spatial calibration dicts, scale, o...
[ "Convert", "a", "data", "element", "to", "xdata", ".", "No", "data", "copying", "occurs", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/ImportExportManager.py#L274-L362
djgagne/hagelslag
hagelslag/util/create_sector_grid_data.py
SectorProcessor.output_sector_csv
def output_sector_csv(self,csv_path,file_dict_key,out_path): """ Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary ke...
python
def output_sector_csv(self,csv_path,file_dict_key,out_path): """ Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary ke...
[ "def", "output_sector_csv", "(", "self", ",", "csv_path", ",", "file_dict_key", ",", "out_path", ")", ":", "csv_file", "=", "csv_path", "+", "\"{0}_{1}_{2}_{3}.csv\"", ".", "format", "(", "file_dict_key", ",", "self", ".", "ensemble_name", ",", "self", ".", "m...
Segment forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: csv_path(str): Path to the full CONUS csv file. file_dict_key(str): Dictionary key for the csv files, currently either 'track_step' or 'track_tot...
[ "Segment", "forecast", "tracks", "to", "only", "output", "data", "contined", "within", "a", "region", "in", "the", "CONUS", "as", "defined", "by", "the", "mapfile", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/create_sector_grid_data.py#L28-L76
djgagne/hagelslag
hagelslag/util/create_sector_grid_data.py
SectorProcessor.output_sector_netcdf
def output_sector_netcdf(self,netcdf_path,out_path,patch_radius,config): """ Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. ...
python
def output_sector_netcdf(self,netcdf_path,out_path,patch_radius,config): """ Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. ...
[ "def", "output_sector_netcdf", "(", "self", ",", "netcdf_path", ",", "out_path", ",", "patch_radius", ",", "config", ")", ":", "nc_data", "=", "self", ".", "load_netcdf_data", "(", "netcdf_path", ",", "patch_radius", ")", "if", "nc_data", "is", "not", "None", ...
Segment patches of forecast tracks to only output data contined within a region in the CONUS, as defined by the mapfile. Args: netcdf_path (str): Path to the full CONUS netcdf patch file. out_path (str): Path to output new segmented netcdf files. patch_radius (int):...
[ "Segment", "patches", "of", "forecast", "tracks", "to", "only", "output", "data", "contined", "within", "a", "region", "in", "the", "CONUS", "as", "defined", "by", "the", "mapfile", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/create_sector_grid_data.py#L108-L234
nion-software/nionswift
nion/swift/model/Utility.py
clean_dict
def clean_dict(d0, clean_item_fn=None): """ Return a json-clean dict. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item d = dict() for key in d0: cleaned_item = clean_item_fn(d0[key]) if cleaned_item is not None: ...
python
def clean_dict(d0, clean_item_fn=None): """ Return a json-clean dict. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item d = dict() for key in d0: cleaned_item = clean_item_fn(d0[key]) if cleaned_item is not None: ...
[ "def", "clean_dict", "(", "d0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "d", "=", "dict", "(", ")", "for", "key", "in", "d0", ":", "cleaned_item", "=", "clean_item_fn", ...
Return a json-clean dict. Will log info message for failures.
[ "Return", "a", "json", "-", "clean", "dict", ".", "Will", "log", "info", "message", "for", "failures", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L102-L112
nion-software/nionswift
nion/swift/model/Utility.py
clean_list
def clean_list(l0, clean_item_fn=None): """ Return a json-clean list. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(l0): cleaned_item = clean_item_fn(item) l.append(cleaned_item) ...
python
def clean_list(l0, clean_item_fn=None): """ Return a json-clean list. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(l0): cleaned_item = clean_item_fn(item) l.append(cleaned_item) ...
[ "def", "clean_list", "(", "l0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "l", "=", "list", "(", ")", "for", "index", ",", "item", "in", "enumerate", "(", "l0", ")", "...
Return a json-clean list. Will log info message for failures.
[ "Return", "a", "json", "-", "clean", "list", ".", "Will", "log", "info", "message", "for", "failures", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L115-L124
nion-software/nionswift
nion/swift/model/Utility.py
clean_tuple
def clean_tuple(t0, clean_item_fn=None): """ Return a json-clean tuple. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(t0): cleaned_item = clean_item_fn(item) l.append(cleaned_item...
python
def clean_tuple(t0, clean_item_fn=None): """ Return a json-clean tuple. Will log info message for failures. """ clean_item_fn = clean_item_fn if clean_item_fn else clean_item l = list() for index, item in enumerate(t0): cleaned_item = clean_item_fn(item) l.append(cleaned_item...
[ "def", "clean_tuple", "(", "t0", ",", "clean_item_fn", "=", "None", ")", ":", "clean_item_fn", "=", "clean_item_fn", "if", "clean_item_fn", "else", "clean_item", "l", "=", "list", "(", ")", "for", "index", ",", "item", "in", "enumerate", "(", "t0", ")", ...
Return a json-clean tuple. Will log info message for failures.
[ "Return", "a", "json", "-", "clean", "tuple", ".", "Will", "log", "info", "message", "for", "failures", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L127-L136
nion-software/nionswift
nion/swift/model/Utility.py
clean_item
def clean_item(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i) elif itype == list: return clean_list(i) elif itype == tuple: return clean_tuple(i) elif itype == numpy.float...
python
def clean_item(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i) elif itype == list: return clean_list(i) elif itype == tuple: return clean_tuple(i) elif itype == numpy.float...
[ "def", "clean_item", "(", "i", ")", ":", "itype", "=", "type", "(", "i", ")", "if", "itype", "==", "dict", ":", "return", "clean_dict", "(", "i", ")", "elif", "itype", "==", "list", ":", "return", "clean_list", "(", "i", ")", "elif", "itype", "==",...
Return a json-clean item or None. Will log info message for failure.
[ "Return", "a", "json", "-", "clean", "item", "or", "None", ".", "Will", "log", "info", "message", "for", "failure", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L139-L179
nion-software/nionswift
nion/swift/model/Utility.py
clean_item_no_list
def clean_item_no_list(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i, clean_item_no_list) elif itype == list: return clean_tuple(i, clean_item_no_list) elif itype == tuple: re...
python
def clean_item_no_list(i): """ Return a json-clean item or None. Will log info message for failure. """ itype = type(i) if itype == dict: return clean_dict(i, clean_item_no_list) elif itype == list: return clean_tuple(i, clean_item_no_list) elif itype == tuple: re...
[ "def", "clean_item_no_list", "(", "i", ")", ":", "itype", "=", "type", "(", "i", ")", "if", "itype", "==", "dict", ":", "return", "clean_dict", "(", "i", ",", "clean_item_no_list", ")", "elif", "itype", "==", "list", ":", "return", "clean_tuple", "(", ...
Return a json-clean item or None. Will log info message for failure.
[ "Return", "a", "json", "-", "clean", "item", "or", "None", ".", "Will", "log", "info", "message", "for", "failure", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L182-L216
nion-software/nionswift
nion/swift/model/Utility.py
sample_stack_all
def sample_stack_all(count=10, interval=0.1): """Sample the stack in a thread and print it at regular intervals.""" def print_stack_all(l, ll): l1 = list() l1.append("*** STACKTRACE - START ***") code = [] for threadId, stack in sys._current_frames().items(): sub_cod...
python
def sample_stack_all(count=10, interval=0.1): """Sample the stack in a thread and print it at regular intervals.""" def print_stack_all(l, ll): l1 = list() l1.append("*** STACKTRACE - START ***") code = [] for threadId, stack in sys._current_frames().items(): sub_cod...
[ "def", "sample_stack_all", "(", "count", "=", "10", ",", "interval", "=", "0.1", ")", ":", "def", "print_stack_all", "(", "l", ",", "ll", ")", ":", "l1", "=", "list", "(", ")", "l1", ".", "append", "(", "\"*** STACKTRACE - START ***\"", ")", "code", "=...
Sample the stack in a thread and print it at regular intervals.
[ "Sample", "the", "stack", "in", "a", "thread", "and", "print", "it", "at", "regular", "intervals", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L312-L350
mgraffg/EvoDAG
EvoDAG/gp.py
Individual.decision_function
def decision_function(self, X): "Decision function i.e. the raw data of the prediction" self._X = Model.convert_features(X) self._eval() return self._ind[0].hy
python
def decision_function(self, X): "Decision function i.e. the raw data of the prediction" self._X = Model.convert_features(X) self._eval() return self._ind[0].hy
[ "def", "decision_function", "(", "self", ",", "X", ")", ":", "self", ".", "_X", "=", "Model", ".", "convert_features", "(", "X", ")", "self", ".", "_eval", "(", ")", "return", "self", ".", "_ind", "[", "0", "]", ".", "hy" ]
Decision function i.e. the raw data of the prediction
[ "Decision", "function", "i", ".", "e", ".", "the", "raw", "data", "of", "the", "prediction" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L37-L41
mgraffg/EvoDAG
EvoDAG/gp.py
Individual._eval
def _eval(self): "Evaluates a individual using recursion and self._pos as pointer" pos = self._pos self._pos += 1 node = self._ind[pos] if isinstance(node, Function): args = [self._eval() for x in range(node.nargs)] node.eval(args) for x in arg...
python
def _eval(self): "Evaluates a individual using recursion and self._pos as pointer" pos = self._pos self._pos += 1 node = self._ind[pos] if isinstance(node, Function): args = [self._eval() for x in range(node.nargs)] node.eval(args) for x in arg...
[ "def", "_eval", "(", "self", ")", ":", "pos", "=", "self", ".", "_pos", "self", ".", "_pos", "+=", "1", "node", "=", "self", ".", "_ind", "[", "pos", "]", "if", "isinstance", "(", "node", ",", "Function", ")", ":", "args", "=", "[", "self", "."...
Evaluates a individual using recursion and self._pos as pointer
[ "Evaluates", "a", "individual", "using", "recursion", "and", "self", ".", "_pos", "as", "pointer" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L43-L56
mgraffg/EvoDAG
EvoDAG/gp.py
Population.create_random_ind_full
def create_random_ind_full(self, depth=0): "Random individual using full method" lst = [] self._create_random_ind_full(depth=depth, output=lst) return lst
python
def create_random_ind_full(self, depth=0): "Random individual using full method" lst = [] self._create_random_ind_full(depth=depth, output=lst) return lst
[ "def", "create_random_ind_full", "(", "self", ",", "depth", "=", "0", ")", ":", "lst", "=", "[", "]", "self", ".", "_create_random_ind_full", "(", "depth", "=", "depth", ",", "output", "=", "lst", ")", "return", "lst" ]
Random individual using full method
[ "Random", "individual", "using", "full", "method" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L82-L86
mgraffg/EvoDAG
EvoDAG/gp.py
Population.grow_use_function
def grow_use_function(self, depth=0): "Select either function or terminal in grow method" if depth == 0: return False if depth == self._depth: return True return np.random.random() < 0.5
python
def grow_use_function(self, depth=0): "Select either function or terminal in grow method" if depth == 0: return False if depth == self._depth: return True return np.random.random() < 0.5
[ "def", "grow_use_function", "(", "self", ",", "depth", "=", "0", ")", ":", "if", "depth", "==", "0", ":", "return", "False", "if", "depth", "==", "self", ".", "_depth", ":", "return", "True", "return", "np", ".", "random", ".", "random", "(", ")", ...
Select either function or terminal in grow method
[ "Select", "either", "function", "or", "terminal", "in", "grow", "method" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L98-L104
mgraffg/EvoDAG
EvoDAG/gp.py
Population.create_random_ind_grow
def create_random_ind_grow(self, depth=0): "Random individual using grow method" lst = [] self._depth = depth self._create_random_ind_grow(depth=depth, output=lst) return lst
python
def create_random_ind_grow(self, depth=0): "Random individual using grow method" lst = [] self._depth = depth self._create_random_ind_grow(depth=depth, output=lst) return lst
[ "def", "create_random_ind_grow", "(", "self", ",", "depth", "=", "0", ")", ":", "lst", "=", "[", "]", "self", ".", "_depth", "=", "depth", "self", ".", "_create_random_ind_grow", "(", "depth", "=", "depth", ",", "output", "=", "lst", ")", "return", "ls...
Random individual using grow method
[ "Random", "individual", "using", "grow", "method" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L106-L111
mgraffg/EvoDAG
EvoDAG/gp.py
Population.create_population
def create_population(self, popsize=1000, min_depth=2, max_depth=4, X=None): "Creates random population using ramped half-and-half method" import itertools args = [x for x in itertools.product(range(min_depth, ...
python
def create_population(self, popsize=1000, min_depth=2, max_depth=4, X=None): "Creates random population using ramped half-and-half method" import itertools args = [x for x in itertools.product(range(min_depth, ...
[ "def", "create_population", "(", "self", ",", "popsize", "=", "1000", ",", "min_depth", "=", "2", ",", "max_depth", "=", "4", ",", "X", "=", "None", ")", ":", "import", "itertools", "args", "=", "[", "x", "for", "x", "in", "itertools", ".", "product"...
Creates random population using ramped half-and-half method
[ "Creates", "random", "population", "using", "ramped", "half", "-", "and", "-", "half", "method" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L123-L152
mgraffg/EvoDAG
EvoDAG/model.py
Model.decision_function
def decision_function(self, X, **kwargs): "Decision function i.e. the raw data of the prediction" if X is None: return self._hy_test X = self.convert_features(X) if len(X) < self.nvar: _ = 'Number of variables differ, trained with %s given %s' % (self.nvar, len(X)...
python
def decision_function(self, X, **kwargs): "Decision function i.e. the raw data of the prediction" if X is None: return self._hy_test X = self.convert_features(X) if len(X) < self.nvar: _ = 'Number of variables differ, trained with %s given %s' % (self.nvar, len(X)...
[ "def", "decision_function", "(", "self", ",", "X", ",", "*", "*", "kwargs", ")", ":", "if", "X", "is", "None", ":", "return", "self", ".", "_hy_test", "X", "=", "self", ".", "convert_features", "(", "X", ")", "if", "len", "(", "X", ")", "<", "sel...
Decision function i.e. the raw data of the prediction
[ "Decision", "function", "i", ".", "e", ".", "the", "raw", "data", "of", "the", "prediction" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L154-L174
mgraffg/EvoDAG
EvoDAG/model.py
Ensemble.fitness_vs
def fitness_vs(self): "Median Fitness in the validation set" l = [x.fitness_vs for x in self.models] return np.median(l)
python
def fitness_vs(self): "Median Fitness in the validation set" l = [x.fitness_vs for x in self.models] return np.median(l)
[ "def", "fitness_vs", "(", "self", ")", ":", "l", "=", "[", "x", ".", "fitness_vs", "for", "x", "in", "self", ".", "models", "]", "return", "np", ".", "median", "(", "l", ")" ]
Median Fitness in the validation set
[ "Median", "Fitness", "in", "the", "validation", "set" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L335-L338
mgraffg/EvoDAG
EvoDAG/model.py
Ensemble.graphviz
def graphviz(self, directory, **kwargs): "Directory to store the graphviz models" import os if not os.path.isdir(directory): os.mkdir(directory) output = os.path.join(directory, 'evodag-%s') for k, m in enumerate(self.models): m.graphviz(output % k, **kwar...
python
def graphviz(self, directory, **kwargs): "Directory to store the graphviz models" import os if not os.path.isdir(directory): os.mkdir(directory) output = os.path.join(directory, 'evodag-%s') for k, m in enumerate(self.models): m.graphviz(output % k, **kwar...
[ "def", "graphviz", "(", "self", ",", "directory", ",", "*", "*", "kwargs", ")", ":", "import", "os", "if", "not", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "os", ".", "mkdir", "(", "directory", ")", "output", "=", "os", ".", "p...
Directory to store the graphviz models
[ "Directory", "to", "store", "the", "graphviz", "models" ]
train
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L438-L445
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleMemberProduct.load_data
def load_data(self, num_samples=1000, percentiles=None): """ Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns: """ self.percentiles = percentiles self.num_samp...
python
def load_data(self, num_samples=1000, percentiles=None): """ Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns: """ self.percentiles = percentiles self.num_samp...
[ "def", "load_data", "(", "self", ",", "num_samples", "=", "1000", ",", "percentiles", "=", "None", ")", ":", "self", ".", "percentiles", "=", "percentiles", "self", ".", "num_samples", "=", "num_samples", "if", "self", ".", "model_name", ".", "lower", "(",...
Args: num_samples: Number of random samples at each grid point percentiles: Which percentiles to extract from the random samples Returns:
[ "Args", ":", "num_samples", ":", "Number", "of", "random", "samples", "at", "each", "grid", "point", "percentiles", ":", "Which", "percentiles", "to", "extract", "from", "the", "random", "samples" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L63-L130
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleMemberProduct.neighborhood_probability
def neighborhood_probability(self, threshold, radius): """ Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns: """ weights = disk(radius, dtype=np.uint8) thresh...
python
def neighborhood_probability(self, threshold, radius): """ Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns: """ weights = disk(radius, dtype=np.uint8) thresh...
[ "def", "neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ")", ":", "weights", "=", "disk", "(", "radius", ",", "dtype", "=", "np", ".", "uint8", ")", "thresh_data", "=", "np", ".", "zeros", "(", "self", ".", "data", ".", "shape"...
Calculate a probability based on the number of grid points in an area that exceed a threshold. Args: threshold: radius: Returns:
[ "Calculate", "a", "probability", "based", "on", "the", "number", "of", "grid", "points", "in", "an", "area", "that", "exceed", "a", "threshold", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L221-L244
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleMemberProduct.encode_grib2_percentile
def encode_grib2_percentile(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.in...
python
def encode_grib2_percentile(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.in...
[ "def", "encode_grib2_percentile", "(", "self", ")", ":", "lscale", "=", "1e6", "grib_id_start", "=", "[", "7", ",", "0", ",", "14", ",", "14", ",", "2", "]", "gdsinfo", "=", "np", ".", "array", "(", "[", "0", ",", "np", ".", "product", "(", "self...
Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages
[ "Encodes", "member", "percentile", "data", "to", "GRIB2", "format", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L273-L335
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleMemberProduct.encode_grib2_data
def encode_grib2_data(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.int32) ...
python
def encode_grib2_data(self): """ Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages """ lscale = 1e6 grib_id_start = [7, 0, 14, 14, 2] gdsinfo = np.array([0, np.product(self.data.shape[-2:]), 0, 0, 30], dtype=np.int32) ...
[ "def", "encode_grib2_data", "(", "self", ")", ":", "lscale", "=", "1e6", "grib_id_start", "=", "[", "7", ",", "0", ",", "14", ",", "14", ",", "2", "]", "gdsinfo", "=", "np", ".", "array", "(", "[", "0", ",", "np", ".", "product", "(", "self", "...
Encodes member percentile data to GRIB2 format. Returns: Series of GRIB2 messages
[ "Encodes", "member", "percentile", "data", "to", "GRIB2", "format", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L337-L391
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleProducts.load_data
def load_data(self): """ Loads data from each ensemble member. """ for m, member in enumerate(self.members): mo = ModelOutput(self.ensemble_name, member, self.run_date, self.variable, self.start_date, self.end_date, self.path, self.map_file, self....
python
def load_data(self): """ Loads data from each ensemble member. """ for m, member in enumerate(self.members): mo = ModelOutput(self.ensemble_name, member, self.run_date, self.variable, self.start_date, self.end_date, self.path, self.map_file, self....
[ "def", "load_data", "(", "self", ")", ":", "for", "m", ",", "member", "in", "enumerate", "(", "self", ".", "members", ")", ":", "mo", "=", "ModelOutput", "(", "self", ".", "ensemble_name", ",", "member", ",", "self", ".", "run_date", ",", "self", "."...
Loads data from each ensemble member.
[ "Loads", "data", "from", "each", "ensemble", "member", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L439-L458
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleProducts.point_consensus
def point_consensus(self, consensus_type): """ Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic """ if "mean" in consensu...
python
def point_consensus(self, consensus_type): """ Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic """ if "mean" in consensu...
[ "def", "point_consensus", "(", "self", ",", "consensus_type", ")", ":", "if", "\"mean\"", "in", "consensus_type", ":", "consensus_data", "=", "np", ".", "mean", "(", "self", ".", "data", ",", "axis", "=", "0", ")", "elif", "\"std\"", "in", "consensus_type"...
Calculate grid-point statistics across ensemble members. Args: consensus_type: mean, std, median, max, or percentile_nn Returns: EnsembleConsensus containing point statistic
[ "Calculate", "grid", "-", "point", "statistics", "across", "ensemble", "members", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L460-L485
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleProducts.point_probability
def point_probability(self, threshold): """ Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus ...
python
def point_probability(self, threshold): """ Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus ...
[ "def", "point_probability", "(", "self", ",", "threshold", ")", ":", "point_prob", "=", "np", ".", "zeros", "(", "self", ".", "data", ".", "shape", "[", "1", ":", "]", ")", "for", "t", "in", "range", "(", "self", ".", "data", ".", "shape", "[", "...
Determine the probability of exceeding a threshold at a grid point based on the ensemble forecasts at that point. Args: threshold: If >= threshold assigns a 1 to member, otherwise 0. Returns: EnsembleConsensus
[ "Determine", "the", "probability", "of", "exceeding", "a", "threshold", "at", "a", "grid", "point", "based", "on", "the", "ensemble", "forecasts", "at", "that", "point", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L487-L504
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleProducts.neighborhood_probability
def neighborhood_probability(self, threshold, radius, sigmas=None): """ Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from po...
python
def neighborhood_probability(self, threshold, radius, sigmas=None): """ Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from po...
[ "def", "neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ",", "sigmas", "=", "None", ")", ":", "if", "sigmas", "is", "None", ":", "sigmas", "=", "[", "0", "]", "weights", "=", "disk", "(", "radius", ")", "filtered_prob", "=", "[...
Hourly probability of exceeding a threshold based on model values within a specified radius of a point. Args: threshold (float): probability of exceeding this threshold radius (int): distance from point in number of grid points to include in neighborhood calculation. sigmas ...
[ "Hourly", "probability", "of", "exceeding", "a", "threshold", "based", "on", "model", "values", "within", "a", "specified", "radius", "of", "a", "point", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L506-L546
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleProducts.period_max_neighborhood_probability
def period_max_neighborhood_probability(self, threshold, radius, sigmas=None): """ Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int...
python
def period_max_neighborhood_probability(self, threshold, radius, sigmas=None): """ Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int...
[ "def", "period_max_neighborhood_probability", "(", "self", ",", "threshold", ",", "radius", ",", "sigmas", "=", "None", ")", ":", "if", "sigmas", "is", "None", ":", "sigmas", "=", "[", "0", "]", "weights", "=", "disk", "(", "radius", ")", "neighborhood_pro...
Calculates the neighborhood probability of exceeding a threshold at any time over the period loaded. Args: threshold (float): splitting threshold for probability calculatations radius (int): distance from point in number of grid points to include in neighborhood calculation. ...
[ "Calculates", "the", "neighborhood", "probability", "of", "exceeding", "a", "threshold", "at", "any", "time", "over", "the", "period", "loaded", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L548-L585
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
MachineLearningEnsembleProducts.load_data
def load_data(self, grid_method="gamma", num_samples=1000, condition_threshold=0.5, zero_inflate=False, percentile=None): """ Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default ...
python
def load_data(self, grid_method="gamma", num_samples=1000, condition_threshold=0.5, zero_inflate=False, percentile=None): """ Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default ...
[ "def", "load_data", "(", "self", ",", "grid_method", "=", "\"gamma\"", ",", "num_samples", "=", "1000", ",", "condition_threshold", "=", "0.5", ",", "zero_inflate", "=", "False", ",", "percentile", "=", "None", ")", ":", "self", ".", "percentile", "=", "pe...
Reads the track forecasts and converts them to grid point values based on random sampling. Args: grid_method: "gamma" by default num_samples: Number of samples drawn from predicted pdf condition_threshold: Objects are not written to the grid if condition model probability is...
[ "Reads", "the", "track", "forecasts", "and", "converts", "them", "to", "grid", "point", "values", "based", "on", "random", "sampling", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L631-L721
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
MachineLearningEnsembleProducts.write_grib2
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: ...
python
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", ")", ":", "if", "self", ".", "percentile", "is", "None", ":", "var_type", "=", "\"mean\"", "else", ":", "var_type", "=", "\"p{0:02d}\"", ".", "format", "(", "self", ".", "percentile", ")", "lscale", "=", ...
Writes data to grib2 file. Currently, grib codes are set by hand to hail. Args: path: Path to directory containing grib2 files. Returns:
[ "Writes", "data", "to", "grib2", "file", ".", "Currently", "grib", "codes", "are", "set", "by", "hand", "to", "hail", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L723-L773
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleConsensus.init_file
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...
python
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\"", ")", ":", "if", "os", ".", "access", "(", "filename", ",", "os", ".", "R_OK", ")", ":", "out_data", "=", "Dataset", "(", "filename", ",", "\"r+\...
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
[ "Initializes", "netCDF", "file", "for", "writing" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L793-L818
djgagne/hagelslag
hagelslag/processing/EnsembleProducts.py
EnsembleConsensus.write_to_file
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 =...
python
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", ")", ":", "full_var_name", "=", "self", ".", "consensus_type", "+", "\"_\"", "+", "self", ".", "variable", "if", "\"-hour\"", "in", "self", ".", "consensus_type", ":", "if", "full_var_name", "not", "in", ...
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
[ "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" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L820-L846
nion-software/nionswift
nion/swift/Workspace.py
Workspace.restore
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...
python
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", ")", ":", "workspace", "=", "next", "(", "(", "workspace", "for", "workspace", "in", "self", ".", "document_model", ".", "workspaces", "if", "workspace", ".", "uuid", "==", "workspace_uuid", ")", ",", "...
Restore the workspace to the given workspace_uuid. If workspace_uuid is None then create a new workspace and use it.
[ "Restore", "the", "workspace", "to", "the", "given", "workspace_uuid", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L338-L347
nion-software/nionswift
nion/swift/Workspace.py
Workspace.new_workspace
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...
python
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", ":", "workspace", "=", "WorkspaceLayout", ".", "Wo...
Create a new workspace, insert into document_model, and return it.
[ "Create", "a", "new", "workspace", "insert", "into", "document_model", "and", "return", "it", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L363-L373
nion-software/nionswift
nion/swift/Workspace.py
Workspace.ensure_workspace
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...
python
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", ")", ":", "workspace", "=", "next", "(", "(", "workspace", "for", "workspace", "in", "self", ".", "document_model", ".", "workspaces", "if", "workspace", ".", "workspace...
Looks for a workspace with workspace_id. If none is found, create a new one, add it, and change to it.
[ "Looks", "for", "a", "workspace", "with", "workspace_id", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L375-L383
nion-software/nionswift
nion/swift/Workspace.py
Workspace.create_workspace
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...
python
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", ":", "def", "create_clicked", "(", "text", ")", ":", "if", "text", ":", "command", "=", "Workspace", ".", "CreateWorkspaceCommand", "(", "self", ",", "text", ")", "command", ".", "perform", "(", ...
Pose a dialog to name and create a workspace.
[ "Pose", "a", "dialog", "to", "name", "and", "create", "a", "workspace", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L549-L560
nion-software/nionswift
nion/swift/Workspace.py
Workspace.rename_workspace
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(...
python
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", ":", "def", "rename_clicked", "(", "text", ")", ":", "if", "len", "(", "text", ")", ">", "0", ":", "command", "=", "Workspace", ".", "RenameWorkspaceCommand", "(", "self", ",", "text", ")", "co...
Pose a dialog to rename the workspace.
[ "Pose", "a", "dialog", "to", "rename", "the", "workspace", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L562-L573
nion-software/nionswift
nion/swift/Workspace.py
Workspace.remove_workspace
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...
python
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", ")", ":", "def", "confirm_clicked", "(", ")", ":", "if", "len", "(", "self", ".", "document_model", ".", "workspaces", ")", ">", "1", ":", "command", "=", "Workspace", ".", "RemoveWorkspaceCommand", "(", "self", ")",...
Pose a dialog to confirm removal then remove workspace.
[ "Pose", "a", "dialog", "to", "confirm", "removal", "then", "remove", "workspace", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L575-L586
nion-software/nionswift
nion/swift/Workspace.py
Workspace.clone_workspace
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...
python
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", ":", "def", "clone_clicked", "(", "text", ")", ":", "if", "text", ":", "command", "=", "Workspace", ".", "CloneWorkspaceCommand", "(", "self", ",", "text", ")", "command", ".", "perform", "(", ")"...
Pose a dialog to name and clone a workspace.
[ "Pose", "a", "dialog", "to", "name", "and", "clone", "a", "workspace", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L588-L599
nion-software/nionswift
nion/swift/Workspace.py
Workspace.__replace_displayed_display_item
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...
python
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", ":", "self", ".", "document_controller", ".", "replaced_display_panel_content", "=", "display_panel", ...
Used in drag/drop support.
[ "Used", "in", "drag", "/", "drop", "support", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L792-L802
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
bootstrap
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...
python
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", ")", ":", "all_samples", "=", "np", ".", "random", ".", "choice", "(", "score_objs", ",", "size", "=", "(", "n_boot", ",", "len", "(", "score_objs", ")", ")", ",", "replace", "=", "Tr...
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): ...
[ "Given", "a", "set", "of", "DistributedROC", "or", "DistributedReliability", "objects", "this", "function", "performs", "a", "bootstrap", "resampling", "of", "the", "objects", "and", "returns", "n_boot", "aggregations", "of", "them", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L537-L550
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.update
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): ...
python
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", ")", ":", "for", "t", ",", "threshold", "in", "enumerate", "(", "self", ".", "thresholds", ")", ":", "tp", "=", "np", ".", "count_nonzero", "(", "(", "forecasts", ">=", "threshold", "...
Update the ROC curve with a set of forecasts and observations Args: forecasts: 1D array of forecast values observations: 1D array of observation values.
[ "Update", "the", "ROC", "curve", "with", "a", "set", "of", "forecasts", "and", "observations" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L76-L92
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.merge
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...
python
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", ")", ":", "if", "other_roc", ".", "thresholds", ".", "size", "==", "self", ".", "thresholds", ".", "size", "and", "np", ".", "all", "(", "other_roc", ".", "thresholds", "==", "self", ".", "thresholds", ")"...
Ingest the values of another DistributedROC object into this one and update the statistics inplace. Args: other_roc: another DistributedROC object.
[ "Ingest", "the", "values", "of", "another", "DistributedROC", "object", "into", "this", "one", "and", "update", "the", "statistics", "inplace", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L108-L118
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.roc_curve
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...
python
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", ")", ":", "pod", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", ".", "astype", "(", "float", ")", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", ...
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.
[ "Generate", "a", "ROC", "curve", "from", "the", "contingency", "table", "by", "calculating", "the", "probability", "of", "detection", "(", "TP", "/", "(", "TP", "+", "FN", "))", "and", "the", "probability", "of", "false", "detection", "(", "FP", "/", "("...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L120-L133
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.performance_curve
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...
python
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", ")", ":", "pod", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", "\"FN\"", "]", ")", "far", ...
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.
[ "Calculate", "the", "Probability", "of", "Detection", "and", "False", "Alarm", "Ratio", "in", "order", "to", "output", "a", "performance", "diagram", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L135-L146
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.auc
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']))
python
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", ")", ":", "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).
[ "Calculate", "the", "Area", "Under", "the", "ROC", "Curve", "(", "AUC", ")", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L148-L153
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.max_csi
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"] + ...
python
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", ")", ":", "csi", "=", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "/", "(", "self", ".", "contingency_tables", "[", "\"TP\"", "]", "+", "self", ".", "contingency_tables", "[", "\"FN\"", "]", "+", "self", ".", "...
Calculate the maximum Critical Success Index across all probability thresholds Returns: The maximum CSI as a float
[ "Calculate", "the", "maximum", "Critical", "Success", "Index", "across", "all", "probability", "thresholds" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L155-L164
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.get_contingency_tables
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])
python
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", ")", ":", "return", "np", ".", "array", "(", "[", "ContingencyTable", "(", "*", "ct", ")", "for", "ct", "in", "self", ".", "contingency_tables", ".", "values", "]", ")" ]
Create an Array of ContingencyTable objects for each probability threshold. Returns: Array of ContingencyTable objects
[ "Create", "an", "Array", "of", "ContingencyTable", "objects", "for", "each", "probability", "threshold", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L171-L178
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedROC.from_str
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...
python
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", ")", ":", "parts", "=", "in_str", ".", "split", "(", "\";\"", ")", "for", "part", "in", "parts", ":", "var_name", ",", "value", "=", "part", ".", "split", "(", "\":\"", ")", "if", "var_name", "==", "\"...
Read the DistributedROC string and parse the contingency table values from it. Args: in_str (str): The string output from the __str__ method
[ "Read", "the", "DistributedROC", "string", "and", "parse", "the", "contingency", "table", "values", "from", "it", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L194-L212
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.update
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...
python
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", ")", ":", "for", "t", ",", "threshold", "in", "enumerate", "(", "self", ".", "thresholds", "[", ":", "-", "1", "]", ")", ":", "self", ".", "frequencies", ".", "loc", "[", "t", ","...
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
[ "Update", "the", "statistics", "with", "a", "set", "of", "forecasts", "and", "observations", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L308-L321
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.merge
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...
python
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", ")", ":", "if", "other_rel", ".", "thresholds", ".", "size", "==", "self", ".", "thresholds", ".", "size", "and", "np", ".", "all", "(", "other_rel", ".", "thresholds", "==", "self", ".", "thresholds", ")"...
Ingest another DistributedReliability and add its contents to the current object. Args: other_rel: a Distributed reliability object.
[ "Ingest", "another", "DistributedReliability", "and", "add", "its", "contents", "to", "the", "current", "object", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L340-L350
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.reliability_curve
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...
python
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", ")", ":", "total", "=", "self", ".", "frequencies", "[", "\"Total_Freq\"", "]", ".", "sum", "(", ")", "curve", "=", "pd", ".", "DataFrame", "(", "columns", "=", "[", "\"Bin_Start\"", ",", "\"Bin_End\"", ",", "\"Bi...
Calculates the reliability diagram statistics. The key columns are Bin_Start and Positive_Relative_Freq Returns: pandas.DataFrame
[ "Calculates", "the", "reliability", "diagram", "statistics", ".", "The", "key", "columns", "are", "Bin_Start", "and", "Positive_Relative_Freq" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L352-L367
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.brier_score_components
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...
python
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", ")", ":", "rel_curve", "=", "self", ".", "reliability_curve", "(", ")", "total", "=", "self", ".", "frequencies", "[", "\"Total_Freq\"", "]", ".", "sum", "(", ")", "climo_freq", "=", "float", "(", "self", ".", ...
Calculate the components of the Brier score decomposition: reliability, resolution, and uncertainty.
[ "Calculate", "the", "components", "of", "the", "Brier", "score", "decomposition", ":", "reliability", "resolution", "and", "uncertainty", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L369-L381
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.brier_score
def brier_score(self): """ Calculate the Brier Score """ reliability, resolution, uncertainty = self.brier_score_components() return reliability - resolution + uncertainty
python
def brier_score(self): """ Calculate the Brier Score """ reliability, resolution, uncertainty = self.brier_score_components() return reliability - resolution + uncertainty
[ "def", "brier_score", "(", "self", ")", ":", "reliability", ",", "resolution", ",", "uncertainty", "=", "self", ".", "brier_score_components", "(", ")", "return", "reliability", "-", "resolution", "+", "uncertainty" ]
Calculate the Brier Score
[ "Calculate", "the", "Brier", "Score" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L390-L395
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedReliability.brier_skill_score
def brier_skill_score(self): """ Calculate the Brier Skill Score """ reliability, resolution, uncertainty = self.brier_score_components() return (resolution - reliability) / uncertainty
python
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", ")", ":", "reliability", ",", "resolution", ",", "uncertainty", "=", "self", ".", "brier_score_components", "(", ")", "return", "(", "resolution", "-", "reliability", ")", "/", "uncertainty" ]
Calculate the Brier Skill Score
[ "Calculate", "the", "Brier", "Skill", "Score" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L397-L402
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedCRPS.update
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...
python
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", ")", ":", "if", "len", "(", "observations", ".", "shape", ")", "==", "1", ":", "obs_cdfs", "=", "np", ".", "zeros", "(", "(", "observations", ".", "size", ",", "self", ".", "thresho...
Update the statistics with forecasts and observations. Args: forecasts: The discrete Cumulative Distribution Functions of observations:
[ "Update", "the", "statistics", "with", "forecasts", "and", "observations", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L455-L473
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedCRPS.crps
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)
python
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", ")", ":", "return", "np", ".", "sum", "(", "self", ".", "errors", "[", "\"F_2\"", "]", ".", "values", "-", "self", ".", "errors", "[", "\"F_O\"", "]", ".", "values", "*", "2.0", "+", "self", ".", "errors", "[", "\"O_2\...
Calculates the continuous ranked probability score.
[ "Calculates", "the", "continuous", "ranked", "probability", "score", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L488-L493
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedCRPS.crps_climo
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...
python
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", ")", ":", "o_bar", "=", "self", ".", "errors", "[", "\"O\"", "]", ".", "values", "/", "float", "(", "self", ".", "num_forecasts", ")", "crps_c", "=", "np", ".", "sum", "(", "self", ".", "num_forecasts", "*", "(", "...
Calculate the climatological CRPS.
[ "Calculate", "the", "climatological", "CRPS", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L495-L502
djgagne/hagelslag
hagelslag/evaluation/ProbabilityMetrics.py
DistributedCRPS.crpss
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)
python
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", ")", ":", "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.
[ "Calculate", "the", "continous", "ranked", "probability", "skill", "score", "from", "existing", "data", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L504-L510
base4sistemas/satcfe
satcfe/alertas.py
checar
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...
python
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", ")", ":", "resposta", "=", "cliente_sat", ".", "consultar_status_operacional", "(", ")", "alertas", "=", "[", "]", "for", "classe_alerta", "in", "AlertaOperacao", ".", "alertas_registrados", ":", "alerta", "=", "classe_alerta",...
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...
[ "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...
train
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/alertas.py#L375-L395
nion-software/nionswift
nion/swift/model/Metadata.py
has_metadata_value
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...
python
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", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d", "=", "getattr", "(", "metadata_source", ",", ...
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...
[ "Return", "whether", "the", "metadata", "value", "for", "the", "given", "key", "exists", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L66-L92
nion-software/nionswift
nion/swift/model/Metadata.py
get_metadata_value
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 ...
python
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", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "v", "=", "getattr", "(", "metadata_...
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...
[ "Get", "the", "metadata", "value", "for", "the", "given", "key", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L94-L118
nion-software/nionswift
nion/swift/model/Metadata.py
set_metadata_value
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...
python
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", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d0", "...
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...
[ "Set", "the", "metadata", "value", "for", "the", "given", "key", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L120-L152
nion-software/nionswift
nion/swift/model/Metadata.py
delete_metadata_value
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 ...
python
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", ":", "desc", "=", "session_key_map", ".", "get", "(", "key", ")", "if", "desc", "is", "not", "None", ":", "d0", "=", "getattr", "(", "metadata_source", ","...
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...
[ "Delete", "the", "metadata", "value", "for", "the", "given", "key", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L154-L185
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
LineGraphAxes.calculate_y_ticks
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...
python
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", ")", ":", "calibrated_data_min", "=", "self", ".", "calibrated_data_min", "calibrated_data_max", "=", "self", ".", "calibrated_data_max", "calibrated_data_range", "=", "calibrated_data_max", "-", "calibrated_dat...
Calculate the y-axis items dependent on the plot height.
[ "Calculate", "the", "y", "-", "axis", "items", "dependent", "on", "the", "plot", "height", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L164-L181
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
LineGraphAxes.calculate_x_ticks
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 ...
python
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", ")", ":", "x_calibration", "=", "self", ".", "x_calibration", "uncalibrated_data_left", "=", "self", ".", "__uncalibrated_left_channel", "uncalibrated_data_right", "=", "self", ".", "__uncalibrated_right_channel"...
Calculate the x-axis items dependent on the plot width.
[ "Calculate", "the", "x", "-", "axis", "items", "dependent", "on", "the", "plot", "width", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L196-L221
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
LineGraphHorizontalAxisLabelCanvasItem.size_to_content
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...
python
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", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_height", "=", "0", "new_sizing", ".", "maximum_height", "=", "0", "axes", "=", "self", ".", "__axes", "if", "axes", "and",...
Size the canvas item to the proper height.
[ "Size", "the", "canvas", "item", "to", "the", "proper", "height", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L783-L793
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
LineGraphVerticalAxisScaleCanvasItem.size_to_content
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: ...
python
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", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_width", "=", "0", "new_sizing", ".", "maximum_width", "=", "0", "axes", "=", "self", ".", "__axe...
Size the canvas item to the proper width, the maximum of any label.
[ "Size", "the", "canvas", "item", "to", "the", "proper", "width", "the", "maximum", "of", "any", "label", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L869-L892
nion-software/nionswift
nion/swift/LineGraphCanvasItem.py
LineGraphVerticalAxisLabelCanvasItem.size_to_content
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...
python
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", ")", ":", "new_sizing", "=", "self", ".", "copy_sizing", "(", ")", "new_sizing", ".", "minimum_width", "=", "0", "new_sizing", ".", "maximum_width", "=", "0", "axes", "=", "self", ".", "__axes", "if", "axes", "and", ...
Size the canvas item to the proper width.
[ "Size", "the", "canvas", "item", "to", "the", "proper", "width", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L936-L946
ajk8/hatchery
hatchery/snippets.py
get_snippet_content
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...
python
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", ")", ":", "filename", "=", "snippet_name", "+", "'.snippet'", "snippet_file", "=", "os", ".", "path", ".", "join", "(", "SNIPPETS_ROOT", ",", "filename", ")", "if", "not", "os...
Load the content from a snippet file which exists in SNIPPETS_ROOT
[ "Load", "the", "content", "from", "a", "snippet", "file", "which", "exists", "in", "SNIPPETS_ROOT" ]
train
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/snippets.py#L7-L16
nion-software/nionswift
nion/swift/LinePlotCanvasItem.py
LinePlotCanvasItem.update_display_properties
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...
python
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", ":", "# may ...
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...
[ "Update", "the", "display", "values", ".", "Called", "from", "display", "panel", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L249-L296
nion-software/nionswift
nion/swift/LinePlotCanvasItem.py
LinePlotCanvasItem.__view_to_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: ...
python
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", ":", "l...
Change the view to encompass the channels and data represented by the given intervals.
[ "Change", "the", "view", "to", "encompass", "the", "channels", "and", "data", "represented", "by", "the", "given", "intervals", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L358-L384
nion-software/nionswift
nion/swift/LinePlotCanvasItem.py
LinePlotCanvasItem.__view_to_selected_graphics
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...
python
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", ":", "all_graphics", "=", "self", ".", "__graphics", "graphics", "=", "[", "graphic", "for", "graphic_index", ",", "grap...
Change the view to encompass the selected graphic intervals.
[ "Change", "the", "view", "to", "encompass", "the", "selected", "graphic", "intervals", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L387-L395
nion-software/nionswift
nion/swift/LinePlotCanvasItem.py
LinePlotCanvasItem.prepare_display
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...
python
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", ")", ":", "displayed_dimensional_calibration", "=", "self", ".", "__displayed_dimensional_calibration", "intensity_calibration", "=", "self", ".", "__intensity_calibration", "calibration_style", "=", "self", ".", "__calibration_style", ...
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. ...
[ "Prepare", "the", "display", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L402-L538
nion-software/nionswift
nion/swift/LinePlotCanvasItem.py
LinePlotCanvasItem.__update_cursor_info
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...
python
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", ")", ":", "if", "not", "self", ".", "delegate", ":", "# allow display to work without delegate", "return", "if", "self", ".", "__mouse_in", "and", "self", ".", "__last_mouse", ":", "pos_1d", "=", "None", "axes", "=", ...
Map the mouse to the 1-d position within the line graph.
[ "Map", "the", "mouse", "to", "the", "1", "-", "d", "position", "within", "the", "line", "graph", "." ]
train
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L937-L955
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.find_model_patch_tracks
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...
python
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", ")", ":", "self", ".", "model_grid", ".", "load_data", "(", ")", "tracked_model_objects", "=", "[", "]", "model_objects", "=", "[", "]", "if", "self", ".", "model_grid", ".", "data", "is", "None", ":", "print"...
Identify storms in gridded model output and extract uniform sized patches around the storm centers of mass. Returns:
[ "Identify", "storms", "in", "gridded", "model", "output", "and", "extract", "uniform", "sized", "patches", "around", "the", "storm", "centers", "of", "mass", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L110-L165
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.find_model_tracks
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...
python
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", ")", ":", "self", ".", "model_grid", ".", "load_data", "(", ")", "model_objects", "=", "[", "]", "tracked_model_objects", "=", "[", "]", "if", "self", ".", "model_grid", ".", "data", "is", "None", ":", "print", "(...
Identify storms at each model time step and link them together with object matching. Returns: List of STObjects containing model track information.
[ "Identify", "storms", "at", "each", "model", "time", "step", "and", "link", "them", "together", "with", "object", "matching", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L167-L247
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.find_mrms_tracks
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: ...
python
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", ")", ":", "obs_objects", "=", "[", "]", "tracked_obs_objects", "=", "[", "]", "if", "self", ".", "mrms_ew", "is", "not", "None", ":", "self", ".", "mrms_grid", ".", "load_data", "(", ")", "if", "len", "(", "self"...
Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information.
[ "Identify", "objects", "from", "MRMS", "timesteps", "and", "link", "them", "together", "with", "object", "matching", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L267-L328
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.match_tracks
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...
python
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", ")", ":", "if", "unique_matches", ":", "pairings", "=", "self", ".", "track_matcher", ".", "match_tracks", "("...
Match forecast and observed tracks. Args: model_tracks: obs_tracks: unique_matches: closest_matches: Returns:
[ "Match", "forecast", "and", "observed", "tracks", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L330-L347
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.extract_model_attributes
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...
python
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", ")", ":", "if", "tendency_variables", "is", "None", ":", "...
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...
[ "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", ...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L352-L427
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.match_hail_sizes
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 ...
python
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", ")", ":", "unpaired", "=", "list", "(", "range", "(", "len", "(", "model_tracks", ")", ")", ")", "for", "p", ",", "pair", "in", "enumerate", "(", "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 intermediate timesteps. Args: model_tracks: List of model trac...
[ "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", ...
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L431-L464
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.match_hail_size_step_distributions
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_...
python
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", ")", ":", "label_columns", "=", "[", "\"Matched\"", ",", "\"Max_Hail_Size\"", ",", "\"Num_Matches\"", ",", "\"Shape\"", ",", "\"Location\"", ",", ...
Given a matching set of observed tracks for each model track, Args: model_tracks: obs_tracks: track_pairings: Returns:
[ "Given", "a", "matching", "set", "of", "observed", "tracks", "for", "each", "model", "track", "Args", ":", "model_tracks", ":", "obs_tracks", ":", "track_pairings", ":" ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L505-L538
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.calc_track_errors
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 ...
python
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", ")", ":", "columns", "=", "[", "'obs_track_id'", ",", "'translation_error_x'", ",", "'translation_error_y'", ",", "'start_time_difference'", ",", "'end_time_difference'", ",", "]"...
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. ...
[ "Calculates", "spatial", "and", "temporal", "translation", "errors", "between", "matched", "forecast", "and", "observed", "tracks", "." ]
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L541-L575