repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L115-L124
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L127-L136
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L139-L179
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L182-L216
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Utility.py#L312-L350
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L37-L41
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L43-L56
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L82-L86
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L98-L104
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L106-L111
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/gp.py#L123-L152
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L154-L174
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L335-L338
train
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" ]
e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5
https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/model.py#L438-L445
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L63-L130
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L221-L244
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L273-L335
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L337-L391
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L439-L458
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L460-L485
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L487-L504
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L506-L546
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L548-L585
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L631-L721
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L723-L773
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L793-L818
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnsembleProducts.py#L820-L846
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L338-L347
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L363-L373
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L375-L383
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L549-L560
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L562-L573
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L575-L586
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L588-L599
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Workspace.py#L792-L802
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L537-L550
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L76-L92
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L108-L118
train
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", "/", "("...
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L120-L133
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L135-L146
train
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", ")", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L148-L153
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L155-L164
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L171-L178
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L194-L212
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L308-L321
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L340-L350
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L352-L367
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L369-L381
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L390-L395
train
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" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L397-L402
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L455-L473
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L488-L493
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L495-L502
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ProbabilityMetrics.py#L504-L510
train
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...
cb8e8815f4133d3e3d94cf526fa86767b4521ed9
https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/alertas.py#L375-L395
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L66-L92
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L94-L118
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L120-L152
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Metadata.py#L154-L185
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L164-L181
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L196-L221
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L783-L793
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L869-L892
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LineGraphCanvasItem.py#L936-L946
train
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" ]
e068c9f5366d2c98225babb03d4cde36c710194f
https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/snippets.py#L7-L16
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L249-L296
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L358-L384
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L387-L395
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L402-L538
train
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", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/LinePlotCanvasItem.py#L937-L955
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L110-L165
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L167-L247
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L267-L328
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L330-L347
train
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", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L352-L427
train
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", ...
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L431-L464
train
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", ":" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L505-L538
train
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", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L541-L575
train
nion-software/nionswift
nion/swift/model/Connection.py
Connection.persistent_object_context_changed
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def change_registration(registered_object, unregistered_object): if registered_object and registered_object.uuid == self.parent_uuid: self...
python
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def change_registration(registered_object, unregistered_object): if registered_object and registered_object.uuid == self.parent_uuid: self...
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "change_registration", "(", "registered_object", ",", "unregistered_object", ")", ":", "if", "registered_object", "and", "r...
Override from PersistentObject.
[ "Override", "from", "PersistentObject", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L86-L97
train
nion-software/nionswift
nion/swift/model/Connection.py
PropertyConnection.persistent_object_context_changed
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def register(): if self.__source is not None and self.__target is not None: assert not self.__binding self.__binding = Bin...
python
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def register(): if self.__source is not None and self.__target is not None: assert not self.__binding self.__binding = Bin...
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "register", "(", ")", ":", "if", "self", ".", "__source", "is", "not", "None", "and", "self", ".", "__target", "i...
Override from PersistentObject.
[ "Override", "from", "PersistentObject", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L162-L219
train
nion-software/nionswift
nion/swift/model/Connection.py
IntervalListConnection.persistent_object_context_changed
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def detach(): for listener in self.__interval_mutated_listeners: listener.close() self.__interval_mutated_listeners = list() ...
python
def persistent_object_context_changed(self): """ Override from PersistentObject. """ super().persistent_object_context_changed() def detach(): for listener in self.__interval_mutated_listeners: listener.close() self.__interval_mutated_listeners = list() ...
[ "def", "persistent_object_context_changed", "(", "self", ")", ":", "super", "(", ")", ".", "persistent_object_context_changed", "(", ")", "def", "detach", "(", ")", ":", "for", "listener", "in", "self", ".", "__interval_mutated_listeners", ":", "listener", ".", ...
Override from PersistentObject.
[ "Override", "from", "PersistentObject", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Connection.py#L247-L298
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.__display_for_tree_node
def __display_for_tree_node(self, tree_node): """ Return the text display for the given tree node. Based on number of keys associated with tree node. """ keys = tree_node.keys if len(keys) == 1: return "{0} ({1})".format(tree_node.keys[-1], tree_node.count) elif len(keys) == ...
python
def __display_for_tree_node(self, tree_node): """ Return the text display for the given tree node. Based on number of keys associated with tree node. """ keys = tree_node.keys if len(keys) == 1: return "{0} ({1})".format(tree_node.keys[-1], tree_node.count) elif len(keys) == ...
[ "def", "__display_for_tree_node", "(", "self", ",", "tree_node", ")", ":", "keys", "=", "tree_node", ".", "keys", "if", "len", "(", "keys", ")", "==", "1", ":", "return", "\"{0} ({1})\"", ".", "format", "(", "tree_node", ".", "keys", "[", "-", "1", "]"...
Return the text display for the given tree node. Based on number of keys associated with tree node.
[ "Return", "the", "text", "display", "for", "the", "given", "tree", "node", ".", "Based", "on", "number", "of", "keys", "associated", "with", "tree", "node", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L121-L133
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.__insert_child
def __insert_child(self, parent_tree_node, index, tree_node): """ Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller. """ # manage the item mo...
python
def __insert_child(self, parent_tree_node, index, tree_node): """ Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller. """ # manage the item mo...
[ "def", "__insert_child", "(", "self", ",", "parent_tree_node", ",", "index", ",", "tree_node", ")", ":", "# manage the item model", "parent_item", "=", "self", ".", "__mapping", "[", "id", "(", "parent_tree_node", ")", "]", "self", ".", "item_model_controller", ...
Called from the root tree node when a new node is inserted into tree. This method creates properties to represent the node for display and inserts it into the item model controller.
[ "Called", "from", "the", "root", "tree", "node", "when", "a", "new", "node", "is", "inserted", "into", "tree", ".", "This", "method", "creates", "properties", "to", "represent", "the", "node", "for", "display", "and", "inserts", "it", "into", "the", "item"...
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L135-L150
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.__remove_child
def __remove_child(self, parent_tree_node, index): """ Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller. """ # get parent and item parent_item = self.__mapping[id(parent_tree_node)] ...
python
def __remove_child(self, parent_tree_node, index): """ Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller. """ # get parent and item parent_item = self.__mapping[id(parent_tree_node)] ...
[ "def", "__remove_child", "(", "self", ",", "parent_tree_node", ",", "index", ")", ":", "# get parent and item", "parent_item", "=", "self", ".", "__mapping", "[", "id", "(", "parent_tree_node", ")", "]", "# manage the item model", "self", ".", "item_model_controller...
Called from the root tree node when a node is removed from the tree. This method removes it into the item model controller.
[ "Called", "from", "the", "root", "tree", "node", "when", "a", "node", "is", "removed", "from", "the", "tree", ".", "This", "method", "removes", "it", "into", "the", "item", "model", "controller", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L152-L164
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.update_all_nodes
def update_all_nodes(self): """ Update all tree item displays if needed. Usually for count updates. """ item_model_controller = self.item_model_controller if item_model_controller: if self.__node_counts_dirty: for item in self.__mapping.values(): i...
python
def update_all_nodes(self): """ Update all tree item displays if needed. Usually for count updates. """ item_model_controller = self.item_model_controller if item_model_controller: if self.__node_counts_dirty: for item in self.__mapping.values(): i...
[ "def", "update_all_nodes", "(", "self", ")", ":", "item_model_controller", "=", "self", ".", "item_model_controller", "if", "item_model_controller", ":", "if", "self", ".", "__node_counts_dirty", ":", "for", "item", "in", "self", ".", "__mapping", ".", "values", ...
Update all tree item displays if needed. Usually for count updates.
[ "Update", "all", "tree", "item", "displays", "if", "needed", ".", "Usually", "for", "count", "updates", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L170-L180
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.date_browser_selection_changed
def date_browser_selection_changed(self, selected_indexes): """ Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides dat...
python
def date_browser_selection_changed(self, selected_indexes): """ Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides dat...
[ "def", "date_browser_selection_changed", "(", "self", ",", "selected_indexes", ")", ":", "partial_date_filters", "=", "list", "(", ")", "for", "index", ",", "parent_row", ",", "parent_id", "in", "selected_indexes", ":", "item_model_controller", "=", "self", ".", "...
Called to handle selection changes in the tree widget. This method should be connected to the on_selection_changed event. This method builds a list of keys represented by all selected items. It then provides date_filter to filter data items based on the list of keys. It then sets th...
[ "Called", "to", "handle", "selection", "changes", "in", "the", "tree", "widget", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L182-L205
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.text_filter_changed
def text_filter_changed(self, text): """ Called to handle changes to the text filter. :param text: The text for the filter. """ text = text.strip() if text else None if text is not None: self.__text_filter = ListModel.TextFilter("text_for_filter", te...
python
def text_filter_changed(self, text): """ Called to handle changes to the text filter. :param text: The text for the filter. """ text = text.strip() if text else None if text is not None: self.__text_filter = ListModel.TextFilter("text_for_filter", te...
[ "def", "text_filter_changed", "(", "self", ",", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "text", "else", "None", "if", "text", "is", "not", "None", ":", "self", ".", "__text_filter", "=", "ListModel", ".", "TextFilter", "(",...
Called to handle changes to the text filter. :param text: The text for the filter.
[ "Called", "to", "handle", "changes", "to", "the", "text", "filter", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L207-L220
train
nion-software/nionswift
nion/swift/FilterPanel.py
FilterController.__update_filter
def __update_filter(self): """ Create a combined filter. Set the resulting filter into the document controller. """ filters = list() if self.__date_filter: filters.append(self.__date_filter) if self.__text_filter: filters.append(self.__text_fil...
python
def __update_filter(self): """ Create a combined filter. Set the resulting filter into the document controller. """ filters = list() if self.__date_filter: filters.append(self.__date_filter) if self.__text_filter: filters.append(self.__text_fil...
[ "def", "__update_filter", "(", "self", ")", ":", "filters", "=", "list", "(", ")", "if", "self", ".", "__date_filter", ":", "filters", ".", "append", "(", "self", ".", "__date_filter", ")", "if", "self", ".", "__text_filter", ":", "filters", ".", "append...
Create a combined filter. Set the resulting filter into the document controller.
[ "Create", "a", "combined", "filter", ".", "Set", "the", "resulting", "filter", "into", "the", "document", "controller", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L222-L231
train
nion-software/nionswift
nion/swift/FilterPanel.py
TreeNode.__get_keys
def __get_keys(self): """ Return the keys associated with this node by adding its key and then adding parent keys recursively. """ keys = list() tree_node = self while tree_node is not None and tree_node.key is not None: keys.insert(0, tree_node.key) tree_node = t...
python
def __get_keys(self): """ Return the keys associated with this node by adding its key and then adding parent keys recursively. """ keys = list() tree_node = self while tree_node is not None and tree_node.key is not None: keys.insert(0, tree_node.key) tree_node = t...
[ "def", "__get_keys", "(", "self", ")", ":", "keys", "=", "list", "(", ")", "tree_node", "=", "self", "while", "tree_node", "is", "not", "None", "and", "tree_node", ".", "key", "is", "not", "None", ":", "keys", ".", "insert", "(", "0", ",", "tree_node...
Return the keys associated with this node by adding its key and then adding parent keys recursively.
[ "Return", "the", "keys", "associated", "with", "this", "node", "by", "adding", "its", "key", "and", "then", "adding", "parent", "keys", "recursively", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L348-L355
train
nion-software/nionswift
nion/swift/FilterPanel.py
TreeNode.insert_value
def insert_value(self, keys, value): """ Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count. """ ...
python
def insert_value(self, keys, value): """ Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count. """ ...
[ "def", "insert_value", "(", "self", ",", "keys", ",", "value", ")", ":", "self", ".", "count", "+=", "1", "if", "not", "self", ".", "key", ":", "self", ".", "__value_reverse_mapping", "[", "value", "]", "=", "keys", "if", "len", "(", "keys", ")", "...
Insert a value (data item) into this tree node and then its children. This will be called in response to a new data item being inserted into the document. Also updates the tree node's cumulative child count.
[ "Insert", "a", "value", "(", "data", "item", ")", "into", "this", "tree", "node", "and", "then", "its", "children", ".", "This", "will", "be", "called", "in", "response", "to", "a", "new", "data", "item", "being", "inserted", "into", "the", "document", ...
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L358-L385
train
nion-software/nionswift
nion/swift/FilterPanel.py
TreeNode.remove_value
def remove_value(self, keys, value): """ Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count. """ self.count -= 1 if not self.key: keys = self.__value_reverse_mapping[value] d...
python
def remove_value(self, keys, value): """ Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count. """ self.count -= 1 if not self.key: keys = self.__value_reverse_mapping[value] d...
[ "def", "remove_value", "(", "self", ",", "keys", ",", "value", ")", ":", "self", ".", "count", "-=", "1", "if", "not", "self", ".", "key", ":", "keys", "=", "self", ".", "__value_reverse_mapping", "[", "value", "]", "del", "self", ".", "__value_reverse...
Remove a value (data item) from this tree node and its children. Also updates the tree node's cumulative child count.
[ "Remove", "a", "value", "(", "data", "item", ")", "from", "this", "tree", "node", "and", "its", "children", ".", "Also", "updates", "the", "tree", "node", "s", "cumulative", "child", "count", "." ]
d43693eaf057b8683b9638e575000f055fede452
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/FilterPanel.py#L387-L408
train
djgagne/hagelslag
hagelslag/processing/tracker.py
label_storm_objects
def label_storm_objects(data, method, min_intensity, max_intensity, min_area=1, max_area=100, max_range=1, increment=1, gaussian_sd=0): """ From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args:...
python
def label_storm_objects(data, method, min_intensity, max_intensity, min_area=1, max_area=100, max_range=1, increment=1, gaussian_sd=0): """ From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args:...
[ "def", "label_storm_objects", "(", "data", ",", "method", ",", "min_intensity", ",", "max_intensity", ",", "min_area", "=", "1", ",", "max_area", "=", "100", ",", "max_range", "=", "1", ",", "increment", "=", "1", ",", "gaussian_sd", "=", "0", ")", ":", ...
From a 2D grid or time series of 2D grids, this method labels storm objects with either the Enhanced Watershed or Hysteresis methods. Args: data: the gridded data to be labeled. Should be a 2D numpy array in (y, x) coordinate order or a 3D numpy array in (time, y, x) coordinate order ...
[ "From", "a", "2D", "grid", "or", "time", "series", "of", "2D", "grids", "this", "method", "labels", "storm", "objects", "with", "either", "the", "Enhanced", "Watershed", "or", "Hysteresis", "methods", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L9-L48
train
djgagne/hagelslag
hagelslag/processing/tracker.py
extract_storm_objects
def extract_storm_objects(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, obj_buffer=0): """ After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep....
python
def extract_storm_objects(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, obj_buffer=0): """ After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep....
[ "def", "extract_storm_objects", "(", "label_grid", ",", "data", ",", "x_grid", ",", "y_grid", ",", "times", ",", "dx", "=", "1", ",", "dt", "=", "1", ",", "obj_buffer", "=", "0", ")", ":", "storm_objects", "=", "[", "]", "if", "len", "(", "label_grid...
After storms are labeled, this method extracts the storm objects from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep. Args: label_grid: 2D or 3D array output by label_storm_objects. data: 2D or 3D array...
[ "After", "storms", "are", "labeled", "this", "method", "extracts", "the", "storm", "objects", "from", "the", "grid", "and", "places", "them", "into", "STObjects", ".", "The", "STObjects", "contain", "intensity", "location", "and", "shape", "information", "about"...
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L51-L118
train
djgagne/hagelslag
hagelslag/processing/tracker.py
extract_storm_patches
def extract_storm_patches(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, patch_radius=16): """ After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about ...
python
def extract_storm_patches(label_grid, data, x_grid, y_grid, times, dx=1, dt=1, patch_radius=16): """ After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about ...
[ "def", "extract_storm_patches", "(", "label_grid", ",", "data", ",", "x_grid", ",", "y_grid", ",", "times", ",", "dx", "=", "1", ",", "dt", "=", "1", ",", "patch_radius", "=", "16", ")", ":", "storm_objects", "=", "[", "]", "if", "len", "(", "label_g...
After storms are labeled, this method extracts boxes of equal size centered on each storm from the grid and places them into STObjects. The STObjects contain intensity, location, and shape information about each storm at each timestep. Args: label_grid: 2D or 3D array output by label_storm_objects....
[ "After", "storms", "are", "labeled", "this", "method", "extracts", "boxes", "of", "equal", "size", "centered", "on", "each", "storm", "from", "the", "grid", "and", "places", "them", "into", "STObjects", ".", "The", "STObjects", "contain", "intensity", "locatio...
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L121-L185
train
djgagne/hagelslag
hagelslag/processing/tracker.py
track_storms
def track_storms(storm_objects, times, distance_components, distance_maxima, distance_weights, tracked_objects=None): """ Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of ...
python
def track_storms(storm_objects, times, distance_components, distance_maxima, distance_weights, tracked_objects=None): """ Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of ...
[ "def", "track_storms", "(", "storm_objects", ",", "times", ",", "distance_components", ",", "distance_maxima", ",", "distance_weights", ",", "tracked_objects", "=", "None", ")", ":", "obj_matcher", "=", "ObjectMatcher", "(", "distance_components", ",", "distance_weigh...
Given the output of extract_storm_objects, this method tracks storms through time and merges individual STObjects into a set of tracks. Args: storm_objects: list of list of STObjects that have not been tracked. times: List of times associated with each set of STObjects distance_componen...
[ "Given", "the", "output", "of", "extract_storm_objects", "this", "method", "tracks", "storms", "through", "time", "and", "merges", "individual", "STObjects", "into", "a", "set", "of", "tracks", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/tracker.py#L188-L222
train
djgagne/hagelslag
hagelslag/evaluation/MulticlassContingencyTable.py
MulticlassContingencyTable.peirce_skill_score
def peirce_skill_score(self): """ Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score) """ n = float(self.table.sum()) nf = self.table.sum(axis=1) no = self.table.sum(axis=0) correct = float(self.table.trace()) return (correct /...
python
def peirce_skill_score(self): """ Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score) """ n = float(self.table.sum()) nf = self.table.sum(axis=1) no = self.table.sum(axis=0) correct = float(self.table.trace()) return (correct /...
[ "def", "peirce_skill_score", "(", "self", ")", ":", "n", "=", "float", "(", "self", ".", "table", ".", "sum", "(", ")", ")", "nf", "=", "self", ".", "table", ".", "sum", "(", "axis", "=", "1", ")", "no", "=", "self", ".", "table", ".", "sum", ...
Multiclass Peirce Skill Score (also Hanssen and Kuipers score, True Skill Score)
[ "Multiclass", "Peirce", "Skill", "Score", "(", "also", "Hanssen", "and", "Kuipers", "score", "True", "Skill", "Score", ")" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MulticlassContingencyTable.py#L35-L43
train
djgagne/hagelslag
hagelslag/evaluation/MulticlassContingencyTable.py
MulticlassContingencyTable.gerrity_score
def gerrity_score(self): """ Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return: """ k = self.table.shape[0] n = float(self.table.sum()) p_o = self.table.sum(axis=0) / n p_sum = np.cumsum(p_o)[:-1] ...
python
def gerrity_score(self): """ Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return: """ k = self.table.shape[0] n = float(self.table.sum()) p_o = self.table.sum(axis=0) / n p_sum = np.cumsum(p_o)[:-1] ...
[ "def", "gerrity_score", "(", "self", ")", ":", "k", "=", "self", ".", "table", ".", "shape", "[", "0", "]", "n", "=", "float", "(", "self", ".", "table", ".", "sum", "(", ")", ")", "p_o", "=", "self", ".", "table", ".", "sum", "(", "axis", "=...
Gerrity Score, which weights each cell in the contingency table by its observed relative frequency. :return:
[ "Gerrity", "Score", "which", "weights", "each", "cell", "in", "the", "contingency", "table", "by", "its", "observed", "relative", "frequency", ".", ":", "return", ":" ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/MulticlassContingencyTable.py#L45-L63
train
djgagne/hagelslag
hagelslag/processing/ObjectMatcher.py
centroid_distance
def centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher ...
python
def centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher ...
[ "def", "centroid_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "ax", ",", "ay", "=", "item_a", ".", "center_of_mass", "(", "time_a", ")", "bx", ",", "by", "=", "item_b", ".", "center_of_mass", "(", "...
Euclidean distance between the centroids of item_a and item_b. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distan...
[ "Euclidean", "distance", "between", "the", "centroids", "of", "item_a", "and", "item_b", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L246-L262
train
djgagne/hagelslag
hagelslag/processing/ObjectMatcher.py
shifted_centroid_distance
def shifted_centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time...
python
def shifted_centroid_distance(item_a, time_a, item_b, time_b, max_value): """ Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time...
[ "def", "shifted_centroid_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "ax", ",", "ay", "=", "item_a", ".", "center_of_mass", "(", "time_a", ")", "bx", ",", "by", "=", "item_b", ".", "center_of_mass", ...
Centroid distance with motion corrections. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_value: Maximum distance value used as sca...
[ "Centroid", "distance", "with", "motion", "corrections", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L269-L291
train
djgagne/hagelslag
hagelslag/processing/ObjectMatcher.py
closest_distance
def closest_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set...
python
def closest_distance(item_a, time_a, item_b, time_b, max_value): """ Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set...
[ "def", "closest_distance", "(", "item_a", ",", "time_a", ",", "item_b", ",", "time_b", ",", "max_value", ")", ":", "return", "np", ".", "minimum", "(", "item_a", ".", "closest_distance", "(", "time_a", ",", "item_b", ",", "time_b", ")", ",", "max_value", ...
Euclidean distance between the pixels in item_a and item_b closest to each other. Args: item_a: STObject from the first set in ObjectMatcher time_a: Time integer being evaluated item_b: STObject from the second set in ObjectMatcher time_b: Time integer being evaluated max_va...
[ "Euclidean", "distance", "between", "the", "pixels", "in", "item_a", "and", "item_b", "closest", "to", "each", "other", "." ]
6fb6c3df90bf4867e13a97d3460b14471d107df1
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/ObjectMatcher.py#L294-L308
train