partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | RespostaSAT.bloquear_sat | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`. | satcfe/resposta/padrao.py | def bloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='BloquearSAT')
if resposta.EEEEE not in ('16000',):
... | def bloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='BloquearSAT')
if resposta.EEEEE not in ('16000',):
... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"bloquear_sat",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L140-L148 | [
"def",
"bloquear_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'BloquearSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'16000'",
",",
")",
":",
"raise",... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.desbloquear_sat | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`. | satcfe/resposta/padrao.py | def desbloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='DesbloquearSAT')
if resposta.EEEEE not in ('1700... | def desbloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='DesbloquearSAT')
if resposta.EEEEE not in ('1700... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"desbloquear_sat",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L152-L160 | [
"def",
"desbloquear_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'DesbloquearSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'17000'",
",",
")",
":",
"r... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.trocar_codigo_de_ativacao | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`. | satcfe/resposta/padrao.py | def trocar_codigo_de_ativacao(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='TrocarCodigoDeAtivacao')
if ... | def trocar_codigo_de_ativacao(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='TrocarCodigoDeAtivacao')
if ... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"trocar_codigo_de_ativacao",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L164-L172 | [
"def",
"trocar_codigo_de_ativacao",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'TrocarCodigoDeAtivacao'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'18000'",
",",
... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | ModelOutput.load_data | Load the specified variable from the ensemble files, then close the files. | hagelslag/data/ModelOutput.py | def load_data(self):
"""
Load the specified variable from the ensemble files, then close the files.
"""
if self.ensemble_name.upper() == "SSEF":
if self.variable[0:2] == "rh":
pressure_level = self.variable[2:]
relh_vars = ["sph", "tmp"]
... | def load_data(self):
"""
Load the specified variable from the ensemble files, then close the files.
"""
if self.ensemble_name.upper() == "SSEF":
if self.variable[0:2] == "rh":
pressure_level = self.variable[2:]
relh_vars = ["sph", "tmp"]
... | [
"Load",
"the",
"specified",
"variable",
"from",
"the",
"ensemble",
"files",
"then",
"close",
"the",
"files",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelOutput.py#L67-L172 | [
"def",
"load_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"ensemble_name",
".",
"upper",
"(",
")",
"==",
"\"SSEF\"",
":",
"if",
"self",
".",
"variable",
"[",
"0",
":",
"2",
"]",
"==",
"\"rh\"",
":",
"pressure_level",
"=",
"self",
".",
"variable",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ModelOutput.load_map_info | Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information. | hagelslag/data/ModelOutput.py | def load_map_info(self, map_file):
"""
Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information.
"""
if self.ensemble_name.upper() == "SSEF":
proj_d... | def load_map_info(self, map_file):
"""
Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information.
"""
if self.ensemble_name.upper() == "SSEF":
proj_d... | [
"Load",
"map",
"projection",
"information",
"and",
"create",
"latitude",
"longitude",
"x",
"y",
"i",
"and",
"j",
"grids",
"for",
"the",
"projection",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelOutput.py#L174-L204 | [
"def",
"load_map_info",
"(",
"self",
",",
"map_file",
")",
":",
"if",
"self",
".",
"ensemble_name",
".",
"upper",
"(",
")",
"==",
"\"SSEF\"",
":",
"proj_dict",
",",
"grid_dict",
"=",
"read_arps_map_file",
"(",
"map_file",
")",
"self",
".",
"dx",
"=",
"in... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | read_geojson | Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject | hagelslag/processing/STObject.py | def read_geojson(filename):
"""
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject
"""
json_file = open(filename)
data = json.load(json_file)
json_fil... | def read_geojson(filename):
"""
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject
"""
json_file = open(filename)
data = json.load(json_file)
json_fil... | [
"Reads",
"a",
"geojson",
"file",
"containing",
"an",
"STObject",
"and",
"initializes",
"a",
"new",
"STObject",
"from",
"the",
"information",
"in",
"the",
"file",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L540-L572 | [
"def",
"read_geojson",
"(",
"filename",
")",
":",
"json_file",
"=",
"open",
"(",
"filename",
")",
"data",
"=",
"json",
".",
"load",
"(",
"json_file",
")",
"json_file",
".",
"close",
"(",
")",
"times",
"=",
"data",
"[",
"\"properties\"",
"]",
"[",
"\"ti... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.center_of_mass | Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass. | hagelslag/processing/STObject.py | def center_of_mass(self, time):
"""
Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass.
"""
if self.start_time <= time <=... | def center_of_mass(self, time):
"""
Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass.
"""
if self.start_time <= time <=... | [
"Calculate",
"the",
"center",
"of",
"mass",
"at",
"a",
"given",
"timestep",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L78-L102 | [
"def",
"center_of_mass",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"diff",
"=",
"time",
"-",
"self",
".",
"start_time",
"valid",
"=",
"np",
".",
"flatnonzero",
"(",
"self",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.trajectory | Calculates the center of mass for each time step and outputs an array
Returns: | hagelslag/processing/STObject.py | def trajectory(self):
"""
Calculates the center of mass for each time step and outputs an array
Returns:
"""
traj = np.zeros((2, self.times.size))
for t, time in enumerate(self.times):
traj[:, t] = self.center_of_mass(time)
return traj | def trajectory(self):
"""
Calculates the center of mass for each time step and outputs an array
Returns:
"""
traj = np.zeros((2, self.times.size))
for t, time in enumerate(self.times):
traj[:, t] = self.center_of_mass(time)
return traj | [
"Calculates",
"the",
"center",
"of",
"mass",
"for",
"each",
"time",
"step",
"and",
"outputs",
"an",
"array"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L143-L153 | [
"def",
"trajectory",
"(",
"self",
")",
":",
"traj",
"=",
"np",
".",
"zeros",
"(",
"(",
"2",
",",
"self",
".",
"times",
".",
"size",
")",
")",
"for",
"t",
",",
"time",
"in",
"enumerate",
"(",
"self",
".",
"times",
")",
":",
"traj",
"[",
":",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.get_corner | Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner index. | hagelslag/processing/STObject.py | def get_corner(self, time):
"""
Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner inde... | def get_corner(self, time):
"""
Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner inde... | [
"Gets",
"the",
"corner",
"array",
"indices",
"of",
"the",
"STObject",
"at",
"a",
"given",
"time",
"that",
"corresponds",
"to",
"the",
"upper",
"left",
"corner",
"of",
"the",
"bounding",
"box",
"for",
"the",
"STObject",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L155-L170 | [
"def",
"get_corner",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"diff",
"=",
"time",
"-",
"self",
".",
"start_time",
"return",
"self",
".",
"i",
"[",
"diff",
"]",
"[",
"0",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.size | Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels | hagelslag/processing/STObject.py | def size(self, time):
"""
Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels
"""
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_ti... | def size(self, time):
"""
Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels
"""
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_ti... | [
"Gets",
"the",
"size",
"of",
"the",
"object",
"at",
"a",
"given",
"time",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L172-L185 | [
"def",
"size",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"return",
"self",
".",
"masks",
"[",
"time",
"-",
"self",
".",
"start_time",
"]",
".",
"sum",
"(",
")",
"else",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.max_size | Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels | hagelslag/processing/STObject.py | def max_size(self):
"""
Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels
"""
sizes = np.array([m.sum() for m in self.masks])
return sizes.max() | def max_size(self):
"""
Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels
"""
sizes = np.array([m.sum() for m in self.masks])
return sizes.max() | [
"Gets",
"the",
"largest",
"size",
"of",
"the",
"object",
"over",
"all",
"timesteps",
".",
"Returns",
":",
"Maximum",
"size",
"of",
"the",
"object",
"in",
"pixels"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L187-L195 | [
"def",
"max_size",
"(",
"self",
")",
":",
"sizes",
"=",
"np",
".",
"array",
"(",
"[",
"m",
".",
"sum",
"(",
")",
"for",
"m",
"in",
"self",
".",
"masks",
"]",
")",
"return",
"sizes",
".",
"max",
"(",
")"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.max_intensity | Calculate the maximum intensity found at a timestep. | hagelslag/processing/STObject.py | def max_intensity(self, time):
"""
Calculate the maximum intensity found at a timestep.
"""
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() | def max_intensity(self, time):
"""
Calculate the maximum intensity found at a timestep.
"""
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() | [
"Calculate",
"the",
"maximum",
"intensity",
"found",
"at",
"a",
"timestep",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L197-L203 | [
"def",
"max_intensity",
"(",
"self",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"return",
"self",
".",
"timesteps",
"[",
"ti",
"]",
".",
"max",
"(",
")"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.extend | Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time. | hagelslag/processing/STObject.py | def extend(self, step):
"""
Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time.
"""
self.timesteps.extend(step.timesteps)
self.masks.extend(step.masks)
self.x.extend(step.... | def extend(self, step):
"""
Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time.
"""
self.timesteps.extend(step.timesteps)
self.masks.extend(step.masks)
self.x.extend(step.... | [
"Adds",
"the",
"data",
"from",
"another",
"STObject",
"to",
"this",
"object",
".",
"Args",
":",
"step",
":",
"another",
"STObject",
"being",
"added",
"after",
"the",
"current",
"one",
"in",
"time",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L205-L224 | [
"def",
"extend",
"(",
"self",
",",
"step",
")",
":",
"self",
".",
"timesteps",
".",
"extend",
"(",
"step",
".",
"timesteps",
")",
"self",
".",
"masks",
".",
"extend",
"(",
"step",
".",
"masks",
")",
"self",
".",
"x",
".",
"extend",
"(",
"step",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.boundary_polygon | Get coordinates of object boundary in counter-clockwise order | hagelslag/processing/STObject.py | def boundary_polygon(self, time):
"""
Get coordinates of object boundary in counter-clockwise order
"""
ti = np.where(time == self.times)[0][0]
com_x, com_y = self.center_of_mass(time)
# If at least one point along perimeter of the mask rectangle is unmasked, find_boundar... | def boundary_polygon(self, time):
"""
Get coordinates of object boundary in counter-clockwise order
"""
ti = np.where(time == self.times)[0][0]
com_x, com_y = self.center_of_mass(time)
# If at least one point along perimeter of the mask rectangle is unmasked, find_boundar... | [
"Get",
"coordinates",
"of",
"object",
"boundary",
"in",
"counter",
"-",
"clockwise",
"order"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L226-L247 | [
"def",
"boundary_polygon",
"(",
"self",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"com_x",
",",
"com_y",
"=",
"self",
".",
"center_of_mass",
"(",
"time",
")",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.estimate_motion | Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correlation.
max_u: Maximum x-component of motion. Used to limit search area.... | hagelslag/processing/STObject.py | def estimate_motion(self, time, intensity_grid, max_u, max_v):
"""
Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correl... | def estimate_motion(self, time, intensity_grid, max_u, max_v):
"""
Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correl... | [
"Estimate",
"the",
"motion",
"of",
"the",
"object",
"with",
"cross",
"-",
"correlation",
"on",
"the",
"intensity",
"values",
"from",
"the",
"previous",
"time",
"step",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L249-L293 | [
"def",
"estimate_motion",
"(",
"self",
",",
"time",
",",
"intensity_grid",
",",
"max_u",
",",
"max_v",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"mask_vals",
"=",
"np",
".... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.count_overlap | Counts the number of points that overlap between this STObject and another STObject. Used for tracking. | hagelslag/processing/STObject.py | def count_overlap(self, time, other_object, other_time):
"""
Counts the number of points that overlap between this STObject and another STObject. Used for tracking.
"""
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other... | def count_overlap(self, time, other_object, other_time):
"""
Counts the number of points that overlap between this STObject and another STObject. Used for tracking.
"""
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other... | [
"Counts",
"the",
"number",
"of",
"points",
"that",
"overlap",
"between",
"this",
"STObject",
"and",
"another",
"STObject",
".",
"Used",
"for",
"tracking",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L295-L310 | [
"def",
"count_overlap",
"(",
"self",
",",
"time",
",",
"other_object",
",",
"other_time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"(",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.extract_attribute_grid | Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from the time before instead of the same time as the object | hagelslag/processing/STObject.py | def extract_attribute_grid(self, model_grid, potential=False, future=False):
"""
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from ... | def extract_attribute_grid(self, model_grid, potential=False, future=False):
"""
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from ... | [
"Extracts",
"the",
"data",
"from",
"a",
"ModelOutput",
"or",
"ModelGrid",
"object",
"within",
"the",
"bounding",
"box",
"region",
"of",
"the",
"STObject",
".",
"Args",
":",
"model_grid",
":",
"A",
"ModelGrid",
"or",
"ModelOutput",
"Object",
"potential",
":",
... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L312-L333 | [
"def",
"extract_attribute_grid",
"(",
"self",
",",
"model_grid",
",",
"potential",
"=",
"False",
",",
"future",
"=",
"False",
")",
":",
"if",
"potential",
":",
"var_name",
"=",
"model_grid",
".",
"variable",
"+",
"\"-potential\"",
"timesteps",
"=",
"np",
"."... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.extract_attribute_array | Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array | hagelslag/processing/STObject.py | def extract_attribute_array(self, data_array, var_name):
"""
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array
"""
if var_name not in self.attributes.keys():
self.attribut... | def extract_attribute_array(self, data_array, var_name):
"""
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array
"""
if var_name not in self.attributes.keys():
self.attribut... | [
"Extracts",
"data",
"from",
"a",
"2D",
"array",
"that",
"has",
"the",
"same",
"dimensions",
"as",
"the",
"grid",
"used",
"to",
"identify",
"the",
"object",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L335-L346 | [
"def",
"extract_attribute_array",
"(",
"self",
",",
"data_array",
",",
"var_name",
")",
":",
"if",
"var_name",
"not",
"in",
"self",
".",
"attributes",
".",
"keys",
"(",
")",
":",
"self",
".",
"attributes",
"[",
"var_name",
"]",
"=",
"[",
"]",
"for",
"t... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.extract_tendency_grid | Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object. | hagelslag/processing/STObject.py | def extract_tendency_grid(self, model_grid):
"""
Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object.
"""
var_name = model_grid.variable + "-tendency"
self.attributes[var_name] = []
timesteps = np.arange(self.st... | def extract_tendency_grid(self, model_grid):
"""
Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object.
"""
var_name = model_grid.variable + "-tendency"
self.attributes[var_name] = []
timesteps = np.arange(self.st... | [
"Extracts",
"the",
"difference",
"in",
"model",
"outputs"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L349-L364 | [
"def",
"extract_tendency_grid",
"(",
"self",
",",
"model_grid",
")",
":",
"var_name",
"=",
"model_grid",
".",
"variable",
"+",
"\"-tendency\"",
"self",
".",
"attributes",
"[",
"var_name",
"]",
"=",
"[",
"]",
"timesteps",
"=",
"np",
".",
"arange",
"(",
"sel... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.calc_attribute_statistics | Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid. | hagelslag/processing/STObject.py | def calc_attribute_statistics(self, statistic_name):
"""
Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid.
... | def calc_attribute_statistics(self, statistic_name):
"""
Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid.
... | [
"Calculates",
"summary",
"statistics",
"over",
"the",
"domains",
"of",
"each",
"attribute",
".",
"Args",
":",
"statistic_name",
"(",
"string",
")",
":",
"numpy",
"statistic",
"such",
"as",
"mean",
"std",
"max",
"min"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L366-L383 | [
"def",
"calc_attribute_statistics",
"(",
"self",
",",
"statistic_name",
")",
":",
"stats",
"=",
"{",
"}",
"for",
"var",
",",
"grids",
"in",
"self",
".",
"attributes",
".",
"items",
"(",
")",
":",
"if",
"len",
"(",
"grids",
")",
">",
"1",
":",
"stats"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.calc_attribute_statistic | Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attribute: Attribute extracted from model grid
statistic: Name of statistic ... | hagelslag/processing/STObject.py | def calc_attribute_statistic(self, attribute, statistic, time):
"""
Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attr... | def calc_attribute_statistic(self, attribute, statistic, time):
"""
Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attr... | [
"Calculate",
"statistics",
"based",
"on",
"the",
"values",
"of",
"an",
"attribute",
".",
"The",
"following",
"statistics",
"are",
"supported",
":",
"mean",
"max",
"min",
"std",
"ptp",
"(",
"range",
")",
"median",
"skew",
"(",
"mean",
"-",
"median",
")",
... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L385-L419 | [
"def",
"calc_attribute_statistic",
"(",
"self",
",",
"attribute",
",",
"statistic",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.calc_timestep_statistic | Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic | hagelslag/processing/STObject.py | def calc_timestep_statistic(self, statistic, time):
"""
Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic
"""
... | def calc_timestep_statistic(self, statistic, time):
"""
Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic
"""
... | [
"Calculate",
"statistics",
"from",
"the",
"primary",
"attribute",
"of",
"the",
"StObject",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L421-L450 | [
"def",
"calc_timestep_statistic",
"(",
"self",
",",
"statistic",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"(",
"self",
".",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.calc_shape_statistics | Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics | hagelslag/processing/STObject.py | def calc_shape_statistics(self, stat_names):
"""
Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics
... | def calc_shape_statistics(self, stat_names):
"""
Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics
... | [
"Calculate",
"shape",
"statistics",
"using",
"regionprops",
"applied",
"to",
"the",
"object",
"mask",
".",
"Args",
":",
"stat_names",
":",
"List",
"of",
"statistics",
"to",
"be",
"extracted",
"from",
"those",
"calculated",
"by",
"regionprops",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L452-L470 | [
"def",
"calc_shape_statistics",
"(",
"self",
",",
"stat_names",
")",
":",
"stats",
"=",
"{",
"}",
"try",
":",
"all_props",
"=",
"[",
"regionprops",
"(",
"m",
")",
"for",
"m",
"in",
"self",
".",
"masks",
"]",
"except",
"TypeError",
":",
"print",
"(",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.calc_shape_step | Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics | hagelslag/processing/STObject.py | def calc_shape_step(self, stat_names, time):
"""
Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics
"""
... | def calc_shape_step(self, stat_names, time):
"""
Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics
"""
... | [
"Calculate",
"shape",
"statistics",
"for",
"a",
"single",
"time",
"step"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L472-L498 | [
"def",
"calc_shape_step",
"(",
"self",
",",
"stat_names",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"props",
"=",
"regionprops",
"(",
"self",
".",
"masks",
"[... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | STObject.to_geojson | Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata describing the object to be included in the top-level properties. | hagelslag/processing/STObject.py | def to_geojson(self, filename, proj, metadata=None):
"""
Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata de... | def to_geojson(self, filename, proj, metadata=None):
"""
Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata de... | [
"Output",
"the",
"data",
"in",
"the",
"STObject",
"to",
"a",
"geoJSON",
"file",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L500-L538 | [
"def",
"to_geojson",
"(",
"self",
",",
"filename",
",",
"proj",
",",
"metadata",
"=",
"None",
")",
":",
"if",
"metadata",
"is",
"None",
":",
"metadata",
"=",
"{",
"}",
"json_obj",
"=",
"{",
"\"type\"",
":",
"\"FeatureCollection\"",
",",
"\"features\"",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | MemoryStorageSystem.rewrite_properties | Set the properties and write to disk. | nion/swift/model/MemoryStorageSystem.py | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__library_storage_lock:
self.__library_storage = properties
self.__write_properties(None) | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__library_storage_lock:
self.__library_storage = properties
self.__write_properties(None) | [
"Set",
"the",
"properties",
"and",
"write",
"to",
"disk",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/MemoryStorageSystem.py#L113-L117 | [
"def",
"rewrite_properties",
"(",
"self",
",",
"properties",
")",
":",
"with",
"self",
".",
"__library_storage_lock",
":",
"self",
".",
"__library_storage",
"=",
"properties",
"self",
".",
"__write_properties",
"(",
"None",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | BasePopulation.model | Returns the model of node v | EvoDAG/population.py | def model(self, v=None):
"Returns the model of node v"
if v is None:
v = self.estopping
hist = self.hist
trace = self.trace(v)
ins = None
if self._base._probability_calibration is not None:
node = hist[-1]
node.normalize()
X... | def model(self, v=None):
"Returns the model of node v"
if v is None:
v = self.estopping
hist = self.hist
trace = self.trace(v)
ins = None
if self._base._probability_calibration is not None:
node = hist[-1]
node.normalize()
X... | [
"Returns",
"the",
"model",
"of",
"node",
"v"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L252-L274 | [
"def",
"model",
"(",
"self",
",",
"v",
"=",
"None",
")",
":",
"if",
"v",
"is",
"None",
":",
"v",
"=",
"self",
".",
"estopping",
"hist",
"=",
"self",
".",
"hist",
"trace",
"=",
"self",
".",
"trace",
"(",
"v",
")",
"ins",
"=",
"None",
"if",
"se... | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | BasePopulation.trace | Restore the position in the history of individual v's nodes | EvoDAG/population.py | def trace(self, n):
"Restore the position in the history of individual v's nodes"
trace_map = {}
self._trace(n, trace_map)
s = list(trace_map.keys())
s.sort()
return s | def trace(self, n):
"Restore the position in the history of individual v's nodes"
trace_map = {}
self._trace(n, trace_map)
s = list(trace_map.keys())
s.sort()
return s | [
"Restore",
"the",
"position",
"in",
"the",
"history",
"of",
"individual",
"v",
"s",
"nodes"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L276-L282 | [
"def",
"trace",
"(",
"self",
",",
"n",
")",
":",
"trace_map",
"=",
"{",
"}",
"self",
".",
"_trace",
"(",
"n",
",",
"trace_map",
")",
"s",
"=",
"list",
"(",
"trace_map",
".",
"keys",
"(",
")",
")",
"s",
".",
"sort",
"(",
")",
"return",
"s"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | BasePopulation.tournament | Tournament selection and when negative is True it performs negative
tournament selection | EvoDAG/population.py | def tournament(self, negative=False):
"""Tournament selection and when negative is True it performs negative
tournament selection"""
if self.generation <= self._random_generations and not negative:
return self.random_selection()
if not self._negative_selection and negative:
... | def tournament(self, negative=False):
"""Tournament selection and when negative is True it performs negative
tournament selection"""
if self.generation <= self._random_generations and not negative:
return self.random_selection()
if not self._negative_selection and negative:
... | [
"Tournament",
"selection",
"and",
"when",
"negative",
"is",
"True",
"it",
"performs",
"negative",
"tournament",
"selection"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L319-L333 | [
"def",
"tournament",
"(",
"self",
",",
"negative",
"=",
"False",
")",
":",
"if",
"self",
".",
"generation",
"<=",
"self",
".",
"_random_generations",
"and",
"not",
"negative",
":",
"return",
"self",
".",
"random_selection",
"(",
")",
"if",
"not",
"self",
... | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | BasePopulation.create_population | Create the initial population | EvoDAG/population.py | def create_population(self):
"Create the initial population"
base = self._base
if base._share_inputs:
used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
used_inputs_naive = used_inputs_var
if base._pr_variable == 0:
used_inputs_var = Select... | def create_population(self):
"Create the initial population"
base = self._base
if base._share_inputs:
used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
used_inputs_naive = used_inputs_var
if base._pr_variable == 0:
used_inputs_var = Select... | [
"Create",
"the",
"initial",
"population"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L345-L390 | [
"def",
"create_population",
"(",
"self",
")",
":",
"base",
"=",
"self",
".",
"_base",
"if",
"base",
".",
"_share_inputs",
":",
"used_inputs_var",
"=",
"SelectNumbers",
"(",
"[",
"x",
"for",
"x",
"in",
"range",
"(",
"base",
".",
"nvar",
")",
"]",
")",
... | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | BasePopulation.add | Add an individual to the population | EvoDAG/population.py | def add(self, v):
"Add an individual to the population"
self.population.append(v)
self._current_popsize += 1
v.position = len(self._hist)
self._hist.append(v)
self.bsf = v
self.estopping = v
self._density += self.get_density(v) | def add(self, v):
"Add an individual to the population"
self.population.append(v)
self._current_popsize += 1
v.position = len(self._hist)
self._hist.append(v)
self.bsf = v
self.estopping = v
self._density += self.get_density(v) | [
"Add",
"an",
"individual",
"to",
"the",
"population"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L392-L400 | [
"def",
"add",
"(",
"self",
",",
"v",
")",
":",
"self",
".",
"population",
".",
"append",
"(",
"v",
")",
"self",
".",
"_current_popsize",
"+=",
"1",
"v",
".",
"position",
"=",
"len",
"(",
"self",
".",
"_hist",
")",
"self",
".",
"_hist",
".",
"appe... | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | BasePopulation.replace | Replace an individual selected by negative tournament selection with
individual v | EvoDAG/population.py | def replace(self, v):
"""Replace an individual selected by negative tournament selection with
individual v"""
if self.popsize < self._popsize:
return self.add(v)
k = self.tournament(negative=True)
self.clean(self.population[k])
self.population[k] = v
v... | def replace(self, v):
"""Replace an individual selected by negative tournament selection with
individual v"""
if self.popsize < self._popsize:
return self.add(v)
k = self.tournament(negative=True)
self.clean(self.population[k])
self.population[k] = v
v... | [
"Replace",
"an",
"individual",
"selected",
"by",
"negative",
"tournament",
"selection",
"with",
"individual",
"v"
] | mgraffg/EvoDAG | python | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L402-L419 | [
"def",
"replace",
"(",
"self",
",",
"v",
")",
":",
"if",
"self",
".",
"popsize",
"<",
"self",
".",
"_popsize",
":",
"return",
"self",
".",
"add",
"(",
"v",
")",
"k",
"=",
"self",
".",
"tournament",
"(",
"negative",
"=",
"True",
")",
"self",
".",
... | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 |
train | make_directory_if_needed | Make the directory path, if needed. | nion/swift/model/HDF5Handler.py | def make_directory_if_needed(directory_path):
"""
Make the directory path, if needed.
"""
if os.path.exists(directory_path):
if not os.path.isdir(directory_path):
raise OSError("Path is not a directory:", directory_path)
else:
os.makedirs(directory_path) | def make_directory_if_needed(directory_path):
"""
Make the directory path, if needed.
"""
if os.path.exists(directory_path):
if not os.path.isdir(directory_path):
raise OSError("Path is not a directory:", directory_path)
else:
os.makedirs(directory_path) | [
"Make",
"the",
"directory",
"path",
"if",
"needed",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HDF5Handler.py#L18-L26 | [
"def",
"make_directory_if_needed",
"(",
"directory_path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"directory_path",
")",
":",
"raise",
"OSError",
"(",
"\"Path is ... | d43693eaf057b8683b9638e575000f055fede452 |
train | hatchery | Main entry point for the hatchery program | hatchery/main.py | def hatchery():
""" Main entry point for the hatchery program """
args = docopt.docopt(__doc__)
task_list = args['<task>']
if not task_list or 'help' in task_list or args['--help']:
print(__doc__.format(version=_version.__version__, config_files=config.CONFIG_LOCATIONS))
return 0
l... | def hatchery():
""" Main entry point for the hatchery program """
args = docopt.docopt(__doc__)
task_list = args['<task>']
if not task_list or 'help' in task_list or args['--help']:
print(__doc__.format(version=_version.__version__, config_files=config.CONFIG_LOCATIONS))
return 0
l... | [
"Main",
"entry",
"point",
"for",
"the",
"hatchery",
"program"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/main.py#L379-L430 | [
"def",
"hatchery",
"(",
")",
":",
"args",
"=",
"docopt",
".",
"docopt",
"(",
"__doc__",
")",
"task_list",
"=",
"args",
"[",
"'<task>'",
"]",
"if",
"not",
"task_list",
"or",
"'help'",
"in",
"task_list",
"or",
"args",
"[",
"'--help'",
"]",
":",
"print",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | call | Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notreal'])
>>> result.exitval
1 | hatchery/executor.py | def call(cmd_args, suppress_output=False):
""" Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notr... | def call(cmd_args, suppress_output=False):
""" Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notr... | [
"Call",
"an",
"arbitary",
"command",
"and",
"return",
"the",
"exit",
"value",
"stdout",
"and",
"stderr",
"as",
"a",
"tuple"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/executor.py#L66-L85 | [
"def",
"call",
"(",
"cmd_args",
",",
"suppress_output",
"=",
"False",
")",
":",
"if",
"not",
"funcy",
".",
"is_list",
"(",
"cmd_args",
")",
"and",
"not",
"funcy",
".",
"is_tuple",
"(",
"cmd_args",
")",
":",
"cmd_args",
"=",
"shlex",
".",
"split",
"(",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | setup | Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1 | hatchery/executor.py | def setup(cmd_args, suppress_output=False):
""" Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1
"""
if not funcy.is_list(cmd_args) and not funcy.is_tuple(cmd_args):... | def setup(cmd_args, suppress_output=False):
""" Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1
"""
if not funcy.is_list(cmd_args) and not funcy.is_tuple(cmd_args):... | [
"Call",
"a",
"setup",
".",
"py",
"command",
"or",
"list",
"of",
"commands"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/executor.py#L88-L101 | [
"def",
"setup",
"(",
"cmd_args",
",",
"suppress_output",
"=",
"False",
")",
":",
"if",
"not",
"funcy",
".",
"is_list",
"(",
"cmd_args",
")",
"and",
"not",
"funcy",
".",
"is_tuple",
"(",
"cmd_args",
")",
":",
"cmd_args",
"=",
"shlex",
".",
"split",
"(",... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | MRMSGrid.load_data | Loads data files and stores the output in the data attribute. | hagelslag/data/MRMSGrid.py | def load_data(self):
"""
Loads data files and stores the output in the data attribute.
"""
data = []
valid_dates = []
mrms_files = np.array(sorted(os.listdir(self.path + self.variable + "/")))
mrms_file_dates = np.array([m_file.split("_")[-2].split("-")[0]
... | def load_data(self):
"""
Loads data files and stores the output in the data attribute.
"""
data = []
valid_dates = []
mrms_files = np.array(sorted(os.listdir(self.path + self.variable + "/")))
mrms_file_dates = np.array([m_file.split("_")[-2].split("-")[0]
... | [
"Loads",
"data",
"files",
"and",
"stores",
"the",
"output",
"in",
"the",
"data",
"attribute",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/MRMSGrid.py#L44-L82 | [
"def",
"load_data",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"valid_dates",
"=",
"[",
"]",
"mrms_files",
"=",
"np",
".",
"array",
"(",
"sorted",
"(",
"os",
".",
"listdir",
"(",
"self",
".",
"path",
"+",
"self",
".",
"variable",
"+",
"\"/\"",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | rescale_data | Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
data_max: maximum value of input data for scaling purposes
out_min: minim... | hagelslag/processing/EnhancedWatershedSegmenter.py | def rescale_data(data, data_min, data_max, out_min=0.0, out_max=100.0):
"""
Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
... | def rescale_data(data, data_min, data_max, out_min=0.0, out_max=100.0):
"""
Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
... | [
"Rescale",
"your",
"input",
"data",
"so",
"that",
"is",
"ranges",
"over",
"integer",
"values",
"which",
"will",
"perform",
"better",
"in",
"the",
"watershed",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L297-L311 | [
"def",
"rescale_data",
"(",
"data",
",",
"data_min",
",",
"data_max",
",",
"out_min",
"=",
"0.0",
",",
"out_max",
"=",
"100.0",
")",
":",
"return",
"(",
"out_max",
"-",
"out_min",
")",
"/",
"(",
"data_max",
"-",
"data_min",
")",
"*",
"(",
"data",
"-"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | EnhancedWatershed.label | Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels | hagelslag/processing/EnhancedWatershedSegmenter.py | def label(self, input_grid):
"""
Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels
"""
marked = self.find_local_maxima(input_grid)
marked = np.wher... | def label(self, input_grid):
"""
Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels
"""
marked = self.find_local_maxima(input_grid)
marked = np.wher... | [
"Labels",
"input",
"grid",
"using",
"enhanced",
"watershed",
"algorithm",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L42-L57 | [
"def",
"label",
"(",
"self",
",",
"input_grid",
")",
":",
"marked",
"=",
"self",
".",
"find_local_maxima",
"(",
"input_grid",
")",
"marked",
"=",
"np",
".",
"where",
"(",
"marked",
">=",
"0",
",",
"1",
",",
"0",
")",
"# splabel returns two things in a tupl... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | EnhancedWatershed.find_local_maxima | Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects. | hagelslag/processing/EnhancedWatershedSegmenter.py | def find_local_maxima(self, input_grid):
"""
Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects.
"""
pixels, q_data = self.quantize(input_g... | def find_local_maxima(self, input_grid):
"""
Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects.
"""
pixels, q_data = self.quantize(input_g... | [
"Finds",
"the",
"local",
"maxima",
"in",
"the",
"inputGrid",
"and",
"perform",
"region",
"growing",
"to",
"identify",
"objects",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L81-L166 | [
"def",
"find_local_maxima",
"(",
"self",
",",
"input_grid",
")",
":",
"pixels",
",",
"q_data",
"=",
"self",
".",
"quantize",
"(",
"input_grid",
")",
"centers",
"=",
"OrderedDict",
"(",
")",
"for",
"p",
"in",
"pixels",
".",
"keys",
"(",
")",
":",
"cente... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | EnhancedWatershed.set_maximum | Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordinates of the center pixel of the region being grown
bin_lower: Intensity leve... | hagelslag/processing/EnhancedWatershedSegmenter.py | def set_maximum(self, q_data, marked, center, bin_lower, foothills):
"""
Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordi... | def set_maximum(self, q_data, marked, center, bin_lower, foothills):
"""
Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordi... | [
"Grow",
"a",
"region",
"at",
"a",
"certain",
"bin",
"level",
"and",
"check",
"if",
"the",
"region",
"has",
"reached",
"the",
"maximum",
"size",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L168-L221 | [
"def",
"set_maximum",
"(",
"self",
",",
"q_data",
",",
"marked",
",",
"center",
",",
"bin_lower",
",",
"foothills",
")",
":",
"as_bin",
"=",
"[",
"]",
"# pixels to be included in peak",
"as_glob",
"=",
"[",
"]",
"# pixels to be globbed up as part of foothills",
"m... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | EnhancedWatershed.remove_foothills | Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered foothills.
Args:
q_data: Quantized data
marked: Marked
bin_... | hagelslag/processing/EnhancedWatershedSegmenter.py | def remove_foothills(self, q_data, marked, bin_num, bin_lower, centers, foothills):
"""
Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered ... | def remove_foothills(self, q_data, marked, bin_num, bin_lower, centers, foothills):
"""
Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered ... | [
"Mark",
"points",
"determined",
"to",
"be",
"foothills",
"as",
"globbed",
"so",
"that",
"they",
"are",
"not",
"included",
"in",
"future",
"searches",
".",
"Also",
"searches",
"neighboring",
"points",
"to",
"foothill",
"points",
"to",
"determine",
"if",
"they",... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L223-L255 | [
"def",
"remove_foothills",
"(",
"self",
",",
"q_data",
",",
"marked",
",",
"bin_num",
",",
"bin_lower",
",",
"centers",
",",
"foothills",
")",
":",
"hills",
"=",
"[",
"]",
"for",
"foot",
"in",
"foothills",
":",
"center",
"=",
"foot",
"[",
"0",
"]",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | EnhancedWatershed.quantize | Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data | hagelslag/processing/EnhancedWatershedSegmenter.py | def quantize(self, input_grid):
"""
Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data
"""
pixels = {}
... | def quantize(self, input_grid):
"""
Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data
"""
pixels = {}
... | [
"Quantize",
"a",
"grid",
"into",
"discrete",
"steps",
"based",
"on",
"input",
"parameters",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L270-L290 | [
"def",
"quantize",
"(",
"self",
",",
"input_grid",
")",
":",
"pixels",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"max_bin",
"+",
"1",
")",
":",
"pixels",
"[",
"i",
"]",
"=",
"[",
"]",
"data",
"=",
"(",
"np",
".",
"array",
"(... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | Mygist.listall | will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName | simplegist/mygist.py | def listall(self):
'''
will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName
'''
file_name = []
r = requests.get(
'%s/users/%s/gists' % (BASE_URL, self.user),
... | def listall(self):
'''
will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName
'''
file_name = []
r = requests.get(
'%s/users/%s/gists' % (BASE_URL, self.user),
... | [
"will",
"display",
"all",
"the",
"filenames",
".",
"Result",
"can",
"be",
"stored",
"in",
"an",
"array",
"for",
"easy",
"fetching",
"of",
"gistNames",
"for",
"future",
"purposes",
".",
"eg",
".",
"a",
"=",
"Gist",
"()",
".",
"mygists",
"()",
".",
"list... | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L13-L34 | [
"def",
"listall",
"(",
"self",
")",
":",
"file_name",
"=",
"[",
"]",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/users/%s/gists'",
"%",
"(",
"BASE_URL",
",",
"self",
".",
"user",
")",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"r... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Mygist.content | Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname | simplegist/mygist.py | def content(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname
'''
self.gist_name = ''
if 'name' in args:
self.gist_name = arg... | def content(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname
'''
self.gist_name = ''
if 'name' in args:
self.gist_name = arg... | [
"Doesn",
"t",
"require",
"manual",
"fetching",
"of",
"gistID",
"of",
"a",
"gist",
"passing",
"gistName",
"will",
"return",
"the",
"content",
"of",
"gist",
".",
"In",
"case",
"names",
"are",
"ambigious",
"provide",
"GistID",
"or",
"it",
"will",
"return",
"t... | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L78-L109 | [
"def",
"content",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"self",
".",
"gist_name",
"=",
"''",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Mygist.edit | Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist | simplegist/mygist.py | def edit(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist
'''
self.gist_name = ''
if 'description' in args:
self.description = args['description']
else:
self.description = ''
if 'name' in args and 'id' in args:
self.gist_name = ... | def edit(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist
'''
self.gist_name = ''
if 'description' in args:
self.description = args['description']
else:
self.description = ''
if 'name' in args and 'id' in args:
self.gist_name = ... | [
"Doesn",
"t",
"require",
"manual",
"fetching",
"of",
"gistID",
"of",
"a",
"gist",
"passing",
"gistName",
"will",
"return",
"edit",
"the",
"gist"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L132-L195 | [
"def",
"edit",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"self",
".",
"gist_name",
"=",
"''",
"if",
"'description'",
"in",
"args",
":",
"self",
".",
"description",
"=",
"args",
"[",
"'description'",
"]",
"else",
":",
"self",
".",
"description",
"... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Mygist.delete | Delete a gist by gistname/gistID | simplegist/mygist.py | def delete(self, **args):
'''
Delete a gist by gistname/gistID
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Provide GistName to delete')
url = 'gists'
if self.gist_id:
... | def delete(self, **args):
'''
Delete a gist by gistname/gistID
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Provide GistName to delete')
url = 'gists'
if self.gist_id:
... | [
"Delete",
"a",
"gist",
"by",
"gistname",
"/",
"gistID"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L198-L223 | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Mygist.starred | List the authenticated user's starred gists | simplegist/mygist.py | def starred(self, **args):
'''
List the authenticated user's starred gists
'''
ids =[]
r = requests.get(
'%s/gists/starred'%BASE_URL,
headers=self.gist.header
)
if 'limit' in args:
limit = args['limit']
else:
limit = len(r.json())
if (r.status_code == 200):
for g in range(0,limit ):
... | def starred(self, **args):
'''
List the authenticated user's starred gists
'''
ids =[]
r = requests.get(
'%s/gists/starred'%BASE_URL,
headers=self.gist.header
)
if 'limit' in args:
limit = args['limit']
else:
limit = len(r.json())
if (r.status_code == 200):
for g in range(0,limit ):
... | [
"List",
"the",
"authenticated",
"user",
"s",
"starred",
"gists"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L226-L246 | [
"def",
"starred",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"ids",
"=",
"[",
"]",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/gists/starred'",
"%",
"BASE_URL",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"if",
"'limit'",
"in",... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Mygist.links | Return Gist URL-Link, Clone-Link and Script-Link to embed | simplegist/mygist.py | def links(self,**args):
'''
Return Gist URL-Link, Clone-Link and Script-Link to embed
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Gist Name/ID must be provided')
if self.gis... | def links(self,**args):
'''
Return Gist URL-Link, Clone-Link and Script-Link to embed
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Gist Name/ID must be provided')
if self.gis... | [
"Return",
"Gist",
"URL",
"-",
"Link",
"Clone",
"-",
"Link",
"and",
"Script",
"-",
"Link",
"to",
"embed"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L248-L275 | [
"def",
"links",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
"... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | NeighborEvaluator.load_forecasts | Load neighborhood probability forecasts. | hagelslag/evaluation/NeighborEvaluator.py | def load_forecasts(self):
"""
Load neighborhood probability forecasts.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
forecast_file = self.forecast_path + "{0}/{1}_{2}_{3}_consensus_{0}.nc".format(run_date_str,
... | def load_forecasts(self):
"""
Load neighborhood probability forecasts.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
forecast_file = self.forecast_path + "{0}/{1}_{2}_{3}_consensus_{0}.nc".format(run_date_str,
... | [
"Load",
"neighborhood",
"probability",
"forecasts",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L62-L93 | [
"def",
"load_forecasts",
"(",
"self",
")",
":",
"run_date_str",
"=",
"self",
".",
"run_date",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")",
"forecast_file",
"=",
"self",
".",
"forecast_path",
"+",
"\"{0}/{1}_{2}_{3}_consensus_{0}.nc\"",
".",
"format",
"(",
"run_date_st... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | NeighborEvaluator.load_obs | Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked. | hagelslag/evaluation/NeighborEvaluator.py | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked.
"""
print("Loading obs ", self.run_date, self.model_name, self.forecast_variable)
... | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked.
"""
print("Loading obs ", self.run_date, self.model_name, self.forecast_variable)
... | [
"Loads",
"observations",
"and",
"masking",
"grid",
"(",
"if",
"needed",
")",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L95-L114 | [
"def",
"load_obs",
"(",
"self",
",",
"mask_threshold",
"=",
"0.5",
")",
":",
"print",
"(",
"\"Loading obs \"",
",",
"self",
".",
"run_date",
",",
"self",
".",
"model_name",
",",
"self",
".",
"forecast_variable",
")",
"start_date",
"=",
"self",
".",
"run_da... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | NeighborEvaluator.load_coordinates | Loads lat-lon coordinates from a netCDF file. | hagelslag/evaluation/NeighborEvaluator.py | def load_coordinates(self):
"""
Loads lat-lon coordinates from a netCDF file.
"""
coord_file = Dataset(self.coordinate_file)
if "lon" in coord_file.variables.keys():
self.coordinates["lon"] = coord_file.variables["lon"][:]
self.coordinates["lat"] = coord_f... | def load_coordinates(self):
"""
Loads lat-lon coordinates from a netCDF file.
"""
coord_file = Dataset(self.coordinate_file)
if "lon" in coord_file.variables.keys():
self.coordinates["lon"] = coord_file.variables["lon"][:]
self.coordinates["lat"] = coord_f... | [
"Loads",
"lat",
"-",
"lon",
"coordinates",
"from",
"a",
"netCDF",
"file",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L116-L127 | [
"def",
"load_coordinates",
"(",
"self",
")",
":",
"coord_file",
"=",
"Dataset",
"(",
"self",
".",
"coordinate_file",
")",
"if",
"\"lon\"",
"in",
"coord_file",
".",
"variables",
".",
"keys",
"(",
")",
":",
"self",
".",
"coordinates",
"[",
"\"lon\"",
"]",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | NeighborEvaluator.evaluate_hourly_forecasts | Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects. | hagelslag/evaluation/NeighborEvaluator.py | def evaluate_hourly_forecasts(self):
"""
Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects.
"""
score_columns = ["Run_Date", "Forecast_Hour",... | def evaluate_hourly_forecasts(self):
"""
Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects.
"""
score_columns = ["Run_Date", "Forecast_Hour",... | [
"Calculates",
"ROC",
"curves",
"and",
"Reliability",
"scores",
"for",
"each",
"forecast",
"hour",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L129-L170 | [
"def",
"evaluate_hourly_forecasts",
"(",
"self",
")",
":",
"score_columns",
"=",
"[",
"\"Run_Date\"",
",",
"\"Forecast_Hour\"",
",",
"\"Ensemble Name\"",
",",
"\"Model_Name\"",
",",
"\"Forecast_Variable\"",
",",
"\"Neighbor_Radius\"",
",",
"\"Smoothing_Radius\"",
",",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | NeighborEvaluator.evaluate_period_forecasts | Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics | hagelslag/evaluation/NeighborEvaluator.py | def evaluate_period_forecasts(self):
"""
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics
"""
score_columns = ["Run_Date", "Ensemble N... | def evaluate_period_forecasts(self):
"""
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics
"""
score_columns = ["Run_Date", "Ensemble N... | [
"Evaluates",
"ROC",
"and",
"Reliability",
"scores",
"for",
"forecasts",
"over",
"the",
"full",
"period",
"from",
"start",
"hour",
"to",
"end",
"hour"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L172-L227 | [
"def",
"evaluate_period_forecasts",
"(",
"self",
")",
":",
"score_columns",
"=",
"[",
"\"Run_Date\"",
",",
"\"Ensemble Name\"",
",",
"\"Model_Name\"",
",",
"\"Forecast_Variable\"",
",",
"\"Neighbor_Radius\"",
",",
"\"Smoothing_Radius\"",
",",
"\"Size_Threshold\"",
",",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | bootstrap_main | Main function explicitly called from the C++ code.
Return the main application object. | nion/swift/command.py | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | [
"Main",
"function",
"explicitly",
"called",
"from",
"the",
"C",
"++",
"code",
".",
"Return",
"the",
"main",
"application",
"object",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/command.py#L49-L60 | [
"def",
"bootstrap_main",
"(",
"args",
")",
":",
"version_info",
"=",
"sys",
".",
"version_info",
"if",
"version_info",
".",
"major",
"!=",
"3",
"or",
"version_info",
".",
"minor",
"<",
"6",
":",
"return",
"None",
",",
"\"python36\"",
"main_fn",
"=",
"load_... | d43693eaf057b8683b9638e575000f055fede452 |
train | _migrate_library | Migrate library to latest version. | nion/swift/model/Profile.py | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | [
"Migrate",
"library",
"to",
"latest",
"version",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Profile.py#L99-L117 | [
"def",
"_migrate_library",
"(",
"workspace_dir",
":",
"pathlib",
".",
"Path",
",",
"do_logging",
":",
"bool",
"=",
"True",
")",
"->",
"pathlib",
".",
"Path",
":",
"library_path_11",
"=",
"workspace_dir",
"/",
"\"Nion Swift Workspace.nslib\"",
"library_path_12",
"=... | d43693eaf057b8683b9638e575000f055fede452 |
train | RespostaConsultarStatusOperacional.status | Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT". | satcfe/resposta/consultarstatusoperacional.py | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | [
"Nome",
"amigável",
"do",
"campo",
"ESTADO_OPERACAO",
"conforme",
"a",
"Tabela",
"de",
"Informações",
"do",
"Status",
"do",
"SAT",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L123-L130 | [
"def",
"status",
"(",
"self",
")",
":",
"for",
"valor",
",",
"rotulo",
"in",
"ESTADOS_OPERACAO",
":",
"if",
"self",
".",
"ESTADO_OPERACAO",
"==",
"valor",
":",
"return",
"rotulo",
"return",
"u'(desconhecido: {})'",
".",
"format",
"(",
"self",
".",
"ESTADO_OP... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaConsultarStatusOperacional.analisar | Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``. | satcfe/resposta/consultarstatusoperacional.py | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaConsultarStatusOperacional",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L134-L175 | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConsultarStatusOperacional'",
",",
"classe_resposta",
"=",
"RespostaConsultarStatusOperacional",
",",
"campos",
"=",
"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | merge_input_csv_forecast_json | Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Path to the forecast json files toplevel directory
condition_models: List of models used to forecast hail or... | hagelslag/util/merge_forecast_data.py | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | [
"Reads",
"forecasts",
"from",
"json",
"files",
"and",
"merges",
"them",
"with",
"the",
"input",
"data",
"from",
"the",
"step",
"csv",
"files",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/merge_forecast_data.py#L53-L107 | [
"def",
"merge_input_csv_forecast_json",
"(",
"input_csv_file",
",",
"forecast_json_path",
",",
"condition_models",
",",
"dist_models",
")",
":",
"try",
":",
"run_date",
"=",
"input_csv_file",
"[",
":",
"-",
"4",
"]",
".",
"split",
"(",
"\"_\"",
")",
"[",
"-",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ThumbnailProcessor.mark_data_dirty | Called from item to indicate its data or metadata has changed. | nion/swift/Thumbnails.py | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | [
"Called",
"from",
"item",
"to",
"indicate",
"its",
"data",
"or",
"metadata",
"has",
"changed",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L56-L60 | [
"def",
"mark_data_dirty",
"(",
"self",
")",
":",
"self",
".",
"__cache",
".",
"set_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
".",
"__cache_property_name",
")",
"self",
".",
"__initialize_cache",
"(",
")",
"self",
".",
"__cached_value_... | d43693eaf057b8683b9638e575000f055fede452 |
train | ThumbnailProcessor.__initialize_cache | Initialize the cache values (cache values are used for optimization). | nion/swift/Thumbnails.py | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | [
"Initialize",
"the",
"cache",
"values",
"(",
"cache",
"values",
"are",
"used",
"for",
"optimization",
")",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L62-L66 | [
"def",
"__initialize_cache",
"(",
"self",
")",
":",
"if",
"self",
".",
"__cached_value_dirty",
"is",
"None",
":",
"self",
".",
"__cached_value_dirty",
"=",
"self",
".",
"__cache",
".",
"is_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
"... | d43693eaf057b8683b9638e575000f055fede452 |
train | ThumbnailProcessor.recompute_if_necessary | Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing. | nion/swift/Thumbnails.py | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | [
"Recompute",
"the",
"data",
"on",
"a",
"thread",
"if",
"necessary",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L68-L100 | [
"def",
"recompute_if_necessary",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"if",
"self",
".",
"__cached_value_dirty",
":",
"with",
"self",
".",
"__is_recomputing_lock",
":",
"is_recomputing",
"=",
"self",
".",
"__is_recomputi... | d43693eaf057b8683b9638e575000f055fede452 |
train | ThumbnailProcessor.recompute_data | Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will not be marked dirty. | nion/swift/Thumbnails.py | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | [
"Compute",
"the",
"data",
"associated",
"with",
"this",
"processor",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L102-L142 | [
"def",
"recompute_data",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"with",
"self",
".",
"__recompute_lock",
":",
"if",
"self",
".",
"__cached_value_dirty",
":",
"try",
":",
"calculated_data",
"=",
"self",
".",
"get_calcul... | d43693eaf057b8683b9638e575000f055fede452 |
train | ThumbnailManager.thumbnail_source_for_display_item | Returned ThumbnailSource must be closed. | nion/swift/Thumbnails.py | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | [
"Returned",
"ThumbnailSource",
"must",
"be",
"closed",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L242-L256 | [
"def",
"thumbnail_source_for_display_item",
"(",
"self",
",",
"ui",
",",
"display_item",
":",
"DisplayItem",
".",
"DisplayItem",
")",
"->",
"ThumbnailSource",
":",
"with",
"self",
".",
"__lock",
":",
"thumbnail_source",
"=",
"self",
".",
"__thumbnail_sources",
"."... | d43693eaf057b8683b9638e575000f055fede452 |
train | load_plug_ins | Load plug-ins. | nion/swift/model/PlugInManager.py | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | [
"Load",
"plug",
"-",
"ins",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/PlugInManager.py#L140-L283 | [
"def",
"load_plug_ins",
"(",
"app",
",",
"root_dir",
")",
":",
"global",
"extensions",
"ui",
"=",
"app",
".",
"ui",
"# a list of directories in which sub-directories PlugIns will be searched.",
"subdirectories",
"=",
"[",
"]",
"# the default location is where the directory ma... | d43693eaf057b8683b9638e575000f055fede452 |
train | Comments.getMyID | Getting gistID of a gist in order to make the workflow
easy and uninterrupted. | simplegist/comments.py | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | [
"Getting",
"gistID",
"of",
"a",
"gist",
"in",
"order",
"to",
"make",
"the",
"workflow",
"easy",
"and",
"uninterrupted",
"."
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/comments.py#L10-L29 | [
"def",
"getMyID",
"(",
"self",
",",
"gist_name",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s'",
"%",
"BASE_URL",
"+",
"'/users/%s/gists'",
"%",
"self",
".",
"user",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"if",
"(",
... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | DocumentController.close | Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close each
document con... | nion/swift/DocumentController.py | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | [
"Close",
"the",
"document",
"controller",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L130-L194 | [
"def",
"close",
"(",
"self",
")",
":",
"assert",
"self",
".",
"__closed",
"==",
"False",
"self",
".",
"__closed",
"=",
"True",
"self",
".",
"finish_periodic",
"(",
")",
"# required to finish periodic operations during tests",
"# dialogs",
"for",
"weak_dialog",
"in... | d43693eaf057b8683b9638e575000f055fede452 |
train | DocumentController.add_periodic | Add a listener function and return listener token. Token can be closed or deleted to unlisten. | nion/swift/DocumentController.py | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | [
"Add",
"a",
"listener",
"function",
"and",
"return",
"listener",
"token",
".",
"Token",
"can",
"be",
"closed",
"or",
"deleted",
"to",
"unlisten",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L562-L589 | [
"def",
"add_periodic",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"class",
"PeriodicListener",
":",
"def",
"__init__",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"self",
".",
"interval",
"=",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DocumentController.__update_display_items_model | Update the data item model with a new container, filter, and sorting.
This is called when the data item model is created or when the user changes
the data group or sorting settings. | nion/swift/DocumentController.py | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | [
"Update",
"the",
"data",
"item",
"model",
"with",
"a",
"new",
"container",
"filter",
"and",
"sorting",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L658-L694 | [
"def",
"__update_display_items_model",
"(",
"self",
",",
"display_items_model",
":",
"ListModel",
".",
"FilteredListModel",
",",
"data_group",
":",
"typing",
".",
"Optional",
"[",
"DataGroup",
".",
"DataGroup",
"]",
",",
"filter_id",
":",
"typing",
".",
"Optional"... | d43693eaf057b8683b9638e575000f055fede452 |
train | DocumentController.focused_data_item | Return the data item with keyboard focus. | nion/swift/DocumentController.py | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | [
"Return",
"the",
"data",
"item",
"with",
"keyboard",
"focus",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L772-L774 | [
"def",
"focused_data_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DataItem",
".",
"DataItem",
"]",
":",
"return",
"self",
".",
"__focused_display_item",
".",
"data_item",
"if",
"self",
".",
"__focused_display_item",
"else",
"None"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DocumentController.selected_display_item | Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel. | nion/swift/DocumentController.py | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | [
"Return",
"the",
"selected",
"display",
"item",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L795-L805 | [
"def",
"selected_display_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DisplayItem",
".",
"DisplayItem",
"]",
":",
"# first check for the [focused] data browser",
"display_item",
"=",
"self",
".",
"focused_display_item",
"if",
"not",
"display_item",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DocumentController._get_two_data_sources | Get two sensible data sources, which may be the same. | nion/swift/DocumentController.py | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | [
"Get",
"two",
"sensible",
"data",
"sources",
"which",
"may",
"be",
"the",
"same",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L2053-L2092 | [
"def",
"_get_two_data_sources",
"(",
"self",
")",
":",
"selected_display_items",
"=",
"self",
".",
"selected_display_items",
"if",
"len",
"(",
"selected_display_items",
")",
"<",
"2",
":",
"selected_display_items",
"=",
"list",
"(",
")",
"display_item",
"=",
"self... | d43693eaf057b8683b9638e575000f055fede452 |
train | calculate_origin_and_size | Calculate origin and size for canvas size, data shape, and image display parameters. | nion/swift/ImageCanvasItem.py | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | [
"Calculate",
"origin",
"and",
"size",
"for",
"canvas",
"size",
"data",
"shape",
"and",
"image",
"display",
"parameters",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/ImageCanvasItem.py#L332-L360 | [
"def",
"calculate_origin_and_size",
"(",
"canvas_size",
",",
"data_shape",
",",
"image_canvas_mode",
",",
"image_zoom",
",",
"image_position",
")",
"->",
"typing",
".",
"Tuple",
"[",
"typing",
".",
"Any",
",",
"typing",
".",
"Any",
"]",
":",
"if",
"data_shape"... | d43693eaf057b8683b9638e575000f055fede452 |
train | read_library | Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items. | nion/swift/model/FileStorageSystem.py | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | [
"Read",
"data",
"items",
"from",
"the",
"data",
"reference",
"handler",
"and",
"return",
"as",
"a",
"list",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L419-L567 | [
"def",
"read_library",
"(",
"persistent_storage_system",
",",
"ignore_older_files",
")",
"->",
"typing",
".",
"Dict",
":",
"data_item_uuids",
"=",
"set",
"(",
")",
"utilized_deletions",
"=",
"set",
"(",
")",
"# the uuid's skipped due to being deleted",
"deletions",
"=... | d43693eaf057b8683b9638e575000f055fede452 |
train | auto_migrate_storage_system | Migrate items from the storage system to the object context.
Files in data_item_uuids have already been loaded and are ignored (not migrated).
Files in deletes have been deleted in object context and are ignored (not migrated) and then added
to the utilized deletions list.
Data items will have persis... | nion/swift/model/FileStorageSystem.py | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | [
"Migrate",
"items",
"from",
"the",
"storage",
"system",
"to",
"the",
"object",
"context",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L601-L658 | [
"def",
"auto_migrate_storage_system",
"(",
"*",
",",
"persistent_storage_system",
"=",
"None",
",",
"new_persistent_storage_system",
"=",
"None",
",",
"data_item_uuids",
"=",
"None",
",",
"deletions",
":",
"typing",
".",
"List",
"[",
"uuid",
".",
"UUID",
"]",
"=... | d43693eaf057b8683b9638e575000f055fede452 |
train | FileStorageSystem.rewrite_properties | Set the properties and write to disk. | nion/swift/model/FileStorageSystem.py | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | [
"Set",
"the",
"properties",
"and",
"write",
"to",
"disk",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L137-L141 | [
"def",
"rewrite_properties",
"(",
"self",
",",
"properties",
")",
":",
"with",
"self",
".",
"__properties_lock",
":",
"self",
".",
"__properties",
"=",
"properties",
"self",
".",
"__write_properties",
"(",
"None",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | RespostaAtivarSAT.analisar | Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``. | satcfe/resposta/ativarsat.py | def analisar(retorno):
"""Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtivarSAT',
classe_resposta=... | def analisar(retorno):
"""Constrói uma :class:`RespostaAtivarSAT` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``AtivarSAT``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtivarSAT',
classe_resposta=... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaAtivarSAT",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/ativarsat.py#L57-L84 | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AtivarSAT'",
",",
"classe_resposta",
"=",
"RespostaAtivarSAT",
",",
"campos",
"=",
"(",
"(",
"'numeroSessao'",
"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | HardwareSource.create_view_task | Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the view. Pass None for defaults.... | nion/typeshed/HardwareSource_1_0.py | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | [
"Create",
"a",
"view",
"task",
"for",
"this",
"hardware",
"source",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/typeshed/HardwareSource_1_0.py#L135-L153 | [
"def",
"create_view_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"buffer_size",
":",
"int",
"=",
"1",
")",
"->",
"ViewTask",
":",
"..."
] | d43693eaf057b8683b9638e575000f055fede452 |
train | from_yaml | Load configuration from yaml source(s), cached to only run once | hatchery/config.py | def from_yaml():
""" Load configuration from yaml source(s), cached to only run once """
default_yaml_str = snippets.get_snippet_content('hatchery.yml')
ret = yaml.load(default_yaml_str, Loader=yaml.RoundTripLoader)
for config_path in CONFIG_LOCATIONS:
config_path = os.path.expanduser(config_pat... | def from_yaml():
""" Load configuration from yaml source(s), cached to only run once """
default_yaml_str = snippets.get_snippet_content('hatchery.yml')
ret = yaml.load(default_yaml_str, Loader=yaml.RoundTripLoader)
for config_path in CONFIG_LOCATIONS:
config_path = os.path.expanduser(config_pat... | [
"Load",
"configuration",
"from",
"yaml",
"source",
"(",
"s",
")",
"cached",
"to",
"only",
"run",
"once"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L23-L40 | [
"def",
"from_yaml",
"(",
")",
":",
"default_yaml_str",
"=",
"snippets",
".",
"get_snippet_content",
"(",
"'hatchery.yml'",
")",
"ret",
"=",
"yaml",
".",
"load",
"(",
"default_yaml_str",
",",
"Loader",
"=",
"yaml",
".",
"RoundTripLoader",
")",
"for",
"config_pa... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | from_pypirc | Load configuration from .pypirc file, cached to only run once | hatchery/config.py | def from_pypirc(pypi_repository):
""" Load configuration from .pypirc file, cached to only run once """
ret = {}
pypirc_locations = PYPIRC_LOCATIONS
for pypirc_path in pypirc_locations:
pypirc_path = os.path.expanduser(pypirc_path)
if os.path.isfile(pypirc_path):
parser = con... | def from_pypirc(pypi_repository):
""" Load configuration from .pypirc file, cached to only run once """
ret = {}
pypirc_locations = PYPIRC_LOCATIONS
for pypirc_path in pypirc_locations:
pypirc_path = os.path.expanduser(pypirc_path)
if os.path.isfile(pypirc_path):
parser = con... | [
"Load",
"configuration",
"from",
".",
"pypirc",
"file",
"cached",
"to",
"only",
"run",
"once"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L47-L70 | [
"def",
"from_pypirc",
"(",
"pypi_repository",
")",
":",
"ret",
"=",
"{",
"}",
"pypirc_locations",
"=",
"PYPIRC_LOCATIONS",
"for",
"pypirc_path",
"in",
"pypirc_locations",
":",
"pypirc_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"pypirc_path",
")",
"... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | pypirc_temp | Create a temporary pypirc file for interaction with twine | hatchery/config.py | def pypirc_temp(index_url):
""" Create a temporary pypirc file for interaction with twine """
pypirc_file = tempfile.NamedTemporaryFile(suffix='.pypirc', delete=False)
print(pypirc_file.name)
with open(pypirc_file.name, 'w') as fh:
fh.write(PYPIRC_TEMPLATE.format(index_name=PYPIRC_TEMP_INDEX_NAM... | def pypirc_temp(index_url):
""" Create a temporary pypirc file for interaction with twine """
pypirc_file = tempfile.NamedTemporaryFile(suffix='.pypirc', delete=False)
print(pypirc_file.name)
with open(pypirc_file.name, 'w') as fh:
fh.write(PYPIRC_TEMPLATE.format(index_name=PYPIRC_TEMP_INDEX_NAM... | [
"Create",
"a",
"temporary",
"pypirc",
"file",
"for",
"interaction",
"with",
"twine"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/config.py#L87-L93 | [
"def",
"pypirc_temp",
"(",
"index_url",
")",
":",
"pypirc_file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"suffix",
"=",
"'.pypirc'",
",",
"delete",
"=",
"False",
")",
"print",
"(",
"pypirc_file",
".",
"name",
")",
"with",
"open",
"(",
"pypirc_file",... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | get_api | Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2". | nion/swift/Facade.py | def get_api(version: str, ui_version: str=None) -> API_1:
"""Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2".
"""
ui_version = ui_version if ui_version else "~1.0"
return _get_api_with_app(version, ui_version, ApplicationModule.app) | def get_api(version: str, ui_version: str=None) -> API_1:
"""Get a versioned interface matching the given version and ui_version.
version is a string in the form "1.0.2".
"""
ui_version = ui_version if ui_version else "~1.0"
return _get_api_with_app(version, ui_version, ApplicationModule.app) | [
"Get",
"a",
"versioned",
"interface",
"matching",
"the",
"given",
"version",
"and",
"ui_version",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L3315-L3321 | [
"def",
"get_api",
"(",
"version",
":",
"str",
",",
"ui_version",
":",
"str",
"=",
"None",
")",
"->",
"API_1",
":",
"ui_version",
"=",
"ui_version",
"if",
"ui_version",
"else",
"\"~1.0\"",
"return",
"_get_api_with_app",
"(",
"version",
",",
"ui_version",
",",... | d43693eaf057b8683b9638e575000f055fede452 |
train | Graphic.mask_xdata_with_shape | Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def mask_xdata_with_shape(self, shape: DataAndMetadata.ShapeType) -> DataAndMetadata.DataAndMetadata:
"""Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
mask = self._graphic.get_mask(shape)
return DataAndMetadata.DataA... | def mask_xdata_with_shape(self, shape: DataAndMetadata.ShapeType) -> DataAndMetadata.DataAndMetadata:
"""Return the mask created by this graphic as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
mask = self._graphic.get_mask(shape)
return DataAndMetadata.DataA... | [
"Return",
"the",
"mask",
"created",
"by",
"this",
"graphic",
"as",
"extended",
"data",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L760-L768 | [
"def",
"mask_xdata_with_shape",
"(",
"self",
",",
"shape",
":",
"DataAndMetadata",
".",
"ShapeType",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"mask",
"=",
"self",
".",
"_graphic",
".",
"get_mask",
"(",
"shape",
")",
"return",
"DataAndMetadata",... | d43693eaf057b8683b9638e575000f055fede452 |
train | Graphic.end | Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line. | nion/swift/Facade.py | def end(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("end", value) | def end(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("end", value) | [
"Set",
"the",
"end",
"property",
"in",
"relative",
"coordinates",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L818-L822 | [
"def",
"end",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Union",
"[",
"float",
",",
"NormPointType",
"]",
")",
"->",
"None",
":",
"self",
".",
"set_property",
"(",
"\"end\"",
",",
"value",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | Graphic.start | Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line. | nion/swift/Facade.py | def start(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("start", value) | def start(self, value: typing.Union[float, NormPointType]) -> None:
"""Set the end property in relative coordinates.
End may be a float when graphic is an Interval or a tuple (y, x) when graphic is a Line."""
self.set_property("start", value) | [
"Set",
"the",
"end",
"property",
"in",
"relative",
"coordinates",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L874-L878 | [
"def",
"start",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Union",
"[",
"float",
",",
"NormPointType",
"]",
")",
"->",
"None",
":",
"self",
".",
"set_property",
"(",
"\"start\"",
",",
"value",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.data | Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def data(self, data: numpy.ndarray) -> None:
"""Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes
"""
self.__data_item.set_data(numpy.copy(data)) | def data(self, data: numpy.ndarray) -> None:
"""Set the data.
:param data: A numpy ndarray.
.. versionadded:: 1.0
Scriptable: Yes
"""
self.__data_item.set_data(numpy.copy(data)) | [
"Set",
"the",
"data",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L994-L1003 | [
"def",
"data",
"(",
"self",
",",
"data",
":",
"numpy",
".",
"ndarray",
")",
"->",
"None",
":",
"self",
".",
"__data_item",
".",
"set_data",
"(",
"numpy",
".",
"copy",
"(",
"data",
")",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.display_xdata | Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def display_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__disp... | def display_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the extended data of this data item display.
Display data will always be 1d or 2d and either int, float, or RGB data type.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__disp... | [
"Return",
"the",
"extended",
"data",
"of",
"this",
"data",
"item",
"display",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1037-L1047 | [
"def",
"display_xdata",
"(",
"self",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"display_data_channel",
"=",
"self",
".",
"__display_item",
".",
"display_data_channel",
"return",
"display_data_channel",
".",
"get_calculated_display_values",
"(",
"True",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.set_dimensional_calibrations | Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def set_dimensional_calibrations(self, dimensional_calibrations: typing.List[CalibrationModule.Calibration]) -> None:
"""Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: ... | def set_dimensional_calibrations(self, dimensional_calibrations: typing.List[CalibrationModule.Calibration]) -> None:
"""Set the dimensional calibrations.
:param dimensional_calibrations: A list of calibrations, must match the dimensions of the data.
.. versionadded:: 1.0
Scriptable: ... | [
"Set",
"the",
"dimensional",
"calibrations",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1080-L1089 | [
"def",
"set_dimensional_calibrations",
"(",
"self",
",",
"dimensional_calibrations",
":",
"typing",
".",
"List",
"[",
"CalibrationModule",
".",
"Calibration",
"]",
")",
"->",
"None",
":",
"self",
".",
"__data_item",
".",
"set_dimensional_calibrations",
"(",
"dimensi... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.get_metadata_value | Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the '<group>.<att... | nion/swift/Facade.py | def get_metadata_value(self, key: str) -> typing.Any:
"""Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a cu... | def get_metadata_value(self, key: str) -> typing.Any:
"""Get the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a cu... | [
"Get",
"the",
"metadata",
"value",
"for",
"the",
"given",
"key",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1138-L1154 | [
"def",
"get_metadata_value",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"typing",
".",
"Any",
":",
"return",
"self",
".",
"_data_item",
".",
"get_metadata_value",
"(",
"key",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.set_metadata_value | Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
If using a custom key, we recommend structuring your keys in the '<group>.<att... | nion/swift/Facade.py | def set_metadata_value(self, key: str, value: typing.Any) -> None:
"""Set the metadata value for the given key.
There are a set of predefined keys that, when used, will be type checked and be interoperable with other
applications. Please consult reference documentation for valid keys.
... | def set_metadata_value(self, key: str, value: typing.Any) -> None:
"""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.
... | [
"Set",
"the",
"metadata",
"value",
"for",
"the",
"given",
"key",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1156-L1172 | [
"def",
"set_metadata_value",
"(",
"self",
",",
"key",
":",
"str",
",",
"value",
":",
"typing",
".",
"Any",
")",
"->",
"None",
":",
"self",
".",
"_data_item",
".",
"set_metadata_value",
"(",
"key",
",",
"value",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.graphics | Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def graphics(self) -> typing.List[Graphic]:
"""Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes
"""
return [Graphic(graphic) for graphic in self.__display_item.graphics] | def graphics(self) -> typing.List[Graphic]:
"""Return the graphics attached to this data item.
.. versionadded:: 1.0
Scriptable: Yes
"""
return [Graphic(graphic) for graphic in self.__display_item.graphics] | [
"Return",
"the",
"graphics",
"attached",
"to",
"this",
"data",
"item",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1228-L1235 | [
"def",
"graphics",
"(",
"self",
")",
"->",
"typing",
".",
"List",
"[",
"Graphic",
"]",
":",
"return",
"[",
"Graphic",
"(",
"graphic",
")",
"for",
"graphic",
"in",
"self",
".",
"__display_item",
".",
"graphics",
"]"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.add_point_region | Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def add_point_region(self, y: float, x: float) -> Graphic:
"""Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.... | def add_point_region(self, y: float, x: float) -> Graphic:
"""Add a point graphic to the data item.
:param x: The x coordinate, in relative units [0.0, 1.0]
:param y: The y coordinate, in relative units [0.0, 1.0]
:return: The :py:class:`nion.swift.Facade.Graphic` object that was added.... | [
"Add",
"a",
"point",
"graphic",
"to",
"the",
"data",
"item",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1241-L1255 | [
"def",
"add_point_region",
"(",
"self",
",",
"y",
":",
"float",
",",
"x",
":",
"float",
")",
"->",
"Graphic",
":",
"graphic",
"=",
"Graphics",
".",
"PointGraphic",
"(",
")",
"graphic",
".",
"position",
"=",
"Geometry",
".",
"FloatPoint",
"(",
"y",
",",... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataItem.mask_xdata | Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__display_item.display_data_channel
shape = display_data_... | def mask_xdata(self) -> DataAndMetadata.DataAndMetadata:
"""Return the mask by combining any mask graphics on this data item as extended data.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_data_channel = self.__display_item.display_data_channel
shape = display_data_... | [
"Return",
"the",
"mask",
"by",
"combining",
"any",
"mask",
"graphics",
"on",
"this",
"data",
"item",
"as",
"extended",
"data",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1294-L1307 | [
"def",
"mask_xdata",
"(",
"self",
")",
"->",
"DataAndMetadata",
".",
"DataAndMetadata",
":",
"display_data_channel",
"=",
"self",
".",
"__display_item",
".",
"display_data_channel",
"shape",
"=",
"display_data_channel",
".",
"display_data_shape",
"mask",
"=",
"numpy",... | d43693eaf057b8683b9638e575000f055fede452 |
train | DisplayPanel.data_item | Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def data_item(self) -> DataItem:
"""Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_panel = self.__display_panel
if not display_panel:
return None
data_item = display_panel.data_item
... | def data_item(self) -> DataItem:
"""Return the data item associated with this display panel.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_panel = self.__display_panel
if not display_panel:
return None
data_item = display_panel.data_item
... | [
"Return",
"the",
"data",
"item",
"associated",
"with",
"this",
"display",
"panel",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1384-L1395 | [
"def",
"data_item",
"(",
"self",
")",
"->",
"DataItem",
":",
"display_panel",
"=",
"self",
".",
"__display_panel",
"if",
"not",
"display_panel",
":",
"return",
"None",
"data_item",
"=",
"display_panel",
".",
"data_item",
"return",
"DataItem",
"(",
"data_item",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DisplayPanel.set_data_item | Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the single
data item.
.. versionadded:: 1.0
Sc... | nion/swift/Facade.py | def set_data_item(self, data_item: DataItem) -> None:
"""Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the sin... | def set_data_item(self, data_item: DataItem) -> None:
"""Set the data item associated with this display panel.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
This will replace whatever data item, browser, or controller is currently in the display panel with the sin... | [
"Set",
"the",
"data",
"item",
"associated",
"with",
"this",
"display",
"panel",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1397-L1412 | [
"def",
"set_data_item",
"(",
"self",
",",
"data_item",
":",
"DataItem",
")",
"->",
"None",
":",
"display_panel",
"=",
"self",
".",
"__display_panel",
"if",
"display_panel",
":",
"display_item",
"=",
"data_item",
".",
"_data_item",
".",
"container",
".",
"get_d... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataGroup.add_data_item | Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes | nion/swift/Facade.py | def add_data_item(self, data_item: DataItem) -> None:
"""Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_item = data_item._data_item.container.get_display_item_f... | def add_data_item(self, data_item: DataItem) -> None:
"""Add a data item to the group.
:param data_item: The :py:class:`nion.swift.Facade.DataItem` object to add.
.. versionadded:: 1.0
Scriptable: Yes
"""
display_item = data_item._data_item.container.get_display_item_f... | [
"Add",
"a",
"data",
"item",
"to",
"the",
"group",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1503-L1514 | [
"def",
"add_data_item",
"(",
"self",
",",
"data_item",
":",
"DataItem",
")",
"->",
"None",
":",
"display_item",
"=",
"data_item",
".",
"_data_item",
".",
"container",
".",
"get_display_item_for_data_item",
"(",
"data_item",
".",
"_data_item",
")",
"if",
"data_it... | d43693eaf057b8683b9638e575000f055fede452 |
train | ViewTask.close | Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed. | nion/swift/Facade.py | def close(self) -> None:
"""Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed.
"""
self.__data_channel_buffer.stop()
self.__data_channel_buffer.close()
self.__data_channel_buffer = None
if not self.__was_p... | def close(self) -> None:
"""Close the task.
.. versionadded:: 1.0
This method must be called when the task is no longer needed.
"""
self.__data_channel_buffer.stop()
self.__data_channel_buffer.close()
self.__data_channel_buffer = None
if not self.__was_p... | [
"Close",
"the",
"task",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1613-L1624 | [
"def",
"close",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"__data_channel_buffer",
".",
"stop",
"(",
")",
"self",
".",
"__data_channel_buffer",
".",
"close",
"(",
")",
"self",
".",
"__data_channel_buffer",
"=",
"None",
"if",
"not",
"self",
".",
"... | d43693eaf057b8683b9638e575000f055fede452 |
train | HardwareSource.record | Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the record. Pass... | nion/swift/Facade.py | def record(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for t... | def record(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Record data and return a list of data_and_metadata objects.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for t... | [
"Record",
"data",
"and",
"return",
"a",
"list",
"of",
"data_and_metadata",
"objects",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1764-L1783 | [
"def",
"record",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"timeout",
":",
"float",
"=",
"None",
")",
"->",
"typing",
".",
"List",
"[",
"Da... | d43693eaf057b8683b9638e575000f055fede452 |
train | HardwareSource.create_record_task | Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the record. Pass None for def... | nion/swift/Facade.py | def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask:
"""Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_p... | def create_record_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None) -> RecordTask:
"""Create a record task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the record. Pass None for defaults.
:type frame_p... | [
"Create",
"a",
"record",
"task",
"for",
"this",
"hardware",
"source",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1785-L1801 | [
"def",
"create_record_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
")",
"->",
"RecordTask",
":",
"return",
"RecordTask",
"(",
"self",
".",
"__hard... | d43693eaf057b8683b9638e575000f055fede452 |
train | HardwareSource.create_view_task | Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:type frame_parameters: :py:class:`FrameParameters`
:param channels_enabled: The enabled channels for the view. Pass None for defaults.... | nion/swift/Facade.py | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | def create_view_task(self, frame_parameters: dict=None, channels_enabled: typing.List[bool]=None, buffer_size: int=1) -> ViewTask:
"""Create a view task for this hardware source.
.. versionadded:: 1.0
:param frame_parameters: The frame parameters for the view. Pass None for defaults.
:... | [
"Create",
"a",
"view",
"task",
"for",
"this",
"hardware",
"source",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Facade.py#L1803-L1821 | [
"def",
"create_view_task",
"(",
"self",
",",
"frame_parameters",
":",
"dict",
"=",
"None",
",",
"channels_enabled",
":",
"typing",
".",
"List",
"[",
"bool",
"]",
"=",
"None",
",",
"buffer_size",
":",
"int",
"=",
"1",
")",
"->",
"ViewTask",
":",
"return",... | d43693eaf057b8683b9638e575000f055fede452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.