hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
0ba6adbbd9c2328315c029f643a0f2eed7bcaa2f
kapoorlab/arboretum
arboretum/layers/tracks/_track_utils.py
[ "MIT" ]
Python
vertex_properties
np.ndarray
def vertex_properties(self, color_by: str) -> np.ndarray: """ return the properties of tracks by vertex """ # if we change the coloring, rebuild the vertex colors array vertex_properties = [] for idx, track_property in enumerate(self.properties): property = track_property[co...
return the properties of tracks by vertex
return the properties of tracks by vertex
[ "return", "the", "properties", "of", "tracks", "by", "vertex" ]
def vertex_properties(self, color_by: str) -> np.ndarray: vertex_properties = [] for idx, track_property in enumerate(self.properties): property = track_property[color_by] if isinstance(property, (list, np.ndarray)): p = property elif isinstance(proper...
[ "def", "vertex_properties", "(", "self", ",", "color_by", ":", "str", ")", "->", "np", ".", "ndarray", ":", "vertex_properties", "=", "[", "]", "for", "idx", ",", "track_property", "in", "enumerate", "(", "self", ".", "properties", ")", ":", "property", ...
return the properties of tracks by vertex
[ "return", "the", "properties", "of", "tracks", "by", "vertex" ]
[ "\"\"\" return the properties of tracks by vertex \"\"\"", "# if we change the coloring, rebuild the vertex colors array", "# length of the track", "# concatenate them, and use a colormap to color them" ]
[ { "param": "self", "type": null }, { "param": "color_by", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color_by", "type": "str", "docstring": null, "docstring_token...
0ba6adbbd9c2328315c029f643a0f2eed7bcaa2f
kapoorlab/arboretum
arboretum/layers/tracks/_track_utils.py
[ "MIT" ]
Python
graph_times
np.ndarray
def graph_times(self) -> np.ndarray: """ time points assocaite with each graph vertex """ if self._graph: return self._graph_vertices[:, 0] return None
time points assocaite with each graph vertex
time points assocaite with each graph vertex
[ "time", "points", "assocaite", "with", "each", "graph", "vertex" ]
def graph_times(self) -> np.ndarray: if self._graph: return self._graph_vertices[:, 0] return None
[ "def", "graph_times", "(", "self", ")", "->", "np", ".", "ndarray", ":", "if", "self", ".", "_graph", ":", "return", "self", ".", "_graph_vertices", "[", ":", ",", "0", "]", "return", "None" ]
time points assocaite with each graph vertex
[ "time", "points", "assocaite", "with", "each", "graph", "vertex" ]
[ "\"\"\" time points assocaite with each graph vertex \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0ba6adbbd9c2328315c029f643a0f2eed7bcaa2f
kapoorlab/arboretum
arboretum/layers/tracks/_track_utils.py
[ "MIT" ]
Python
track_labels
tuple
def track_labels(self, current_time: int) -> tuple: """ return track labels at the current time """ # this is the slice into the time ordered points array lookup = self._points_lookup[current_time] pos = self._points[lookup, ...] lbl = [f'ID:{i}' for i in self._points_id[lookup]]...
return track labels at the current time
return track labels at the current time
[ "return", "track", "labels", "at", "the", "current", "time" ]
def track_labels(self, current_time: int) -> tuple: lookup = self._points_lookup[current_time] pos = self._points[lookup, ...] lbl = [f'ID:{i}' for i in self._points_id[lookup]] return lbl, pos
[ "def", "track_labels", "(", "self", ",", "current_time", ":", "int", ")", "->", "tuple", ":", "lookup", "=", "self", ".", "_points_lookup", "[", "current_time", "]", "pos", "=", "self", ".", "_points", "[", "lookup", ",", "...", "]", "lbl", "=", "[", ...
return track labels at the current time
[ "return", "track", "labels", "at", "the", "current", "time" ]
[ "\"\"\" return track labels at the current time \"\"\"", "# this is the slice into the time ordered points array" ]
[ { "param": "self", "type": null }, { "param": "current_time", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "current_time", "type": "int", "docstring": null, "docstring_t...
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
_set_view_slice
<not_specific>
def _set_view_slice(self): """Sets the view given the indices to slice with.""" if not ALLOW_ND_SLICING: return indices = self._slice_indices # if none of the dims need slicing, return since this function gets # called every time a slider changes if all([isinstance(idx...
Sets the view given the indices to slice with.
Sets the view given the indices to slice with.
[ "Sets", "the", "view", "given", "the", "indices", "to", "slice", "with", "." ]
def _set_view_slice(self): if not ALLOW_ND_SLICING: return indices = self._slice_indices if all([isinstance(idx, slice) for idx in indices[1:]]): return n_track_vertices = self._manager.track_vertices.shape[0] n_graph_vertices = self._manager.graph_vertices.shape[0] ...
[ "def", "_set_view_slice", "(", "self", ")", ":", "if", "not", "ALLOW_ND_SLICING", ":", "return", "indices", "=", "self", ".", "_slice_indices", "if", "all", "(", "[", "isinstance", "(", "idx", ",", "slice", ")", "for", "idx", "in", "indices", "[", "1", ...
Sets the view given the indices to slice with.
[ "Sets", "the", "view", "given", "the", "indices", "to", "slice", "with", "." ]
[ "\"\"\"Sets the view given the indices to slice with.\"\"\"", "# if none of the dims need slicing, return since this function gets", "# called every time a slider changes", "# NOTE(arl): to whoever is reading this. The implementation is a bit", "# clunky here - no real need to iterate over the dims, but it ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
_view_graph
<not_specific>
def _view_graph(self): """ return a view of the graph """ if not self._manager.graph: return None return self._pad_display_data(self._manager.graph_vertices)
return a view of the graph
return a view of the graph
[ "return", "a", "view", "of", "the", "graph" ]
def _view_graph(self): if not self._manager.graph: return None return self._pad_display_data(self._manager.graph_vertices)
[ "def", "_view_graph", "(", "self", ")", ":", "if", "not", "self", ".", "_manager", ".", "graph", ":", "return", "None", "return", "self", ".", "_pad_display_data", "(", "self", ".", "_manager", ".", "graph_vertices", ")" ]
return a view of the graph
[ "return", "a", "view", "of", "the", "graph" ]
[ "\"\"\" return a view of the graph \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
_pad_display_data
<not_specific>
def _pad_display_data(self, vertices): """ pad display data when moving between 2d and 3d NOTES: 2d data is transposed yx 3d data is zyxt """ data = vertices[:, self.dims.displayed] # if we're only displaying two dimensions, then pad the display dim ...
pad display data when moving between 2d and 3d NOTES: 2d data is transposed yx 3d data is zyxt
pad display data when moving between 2d and 3d NOTES: 2d data is transposed yx 3d data is zyxt
[ "pad", "display", "data", "when", "moving", "between", "2d", "and", "3d", "NOTES", ":", "2d", "data", "is", "transposed", "yx", "3d", "data", "is", "zyxt" ]
def _pad_display_data(self, vertices): data = vertices[:, self.dims.displayed] if self.dims.ndisplay == 2: data = np.pad(data, ((0, 0), (0, 1)), 'constant') data = data[:, (1, 0, 2)] else: data = data[:, (2, 1, 0)] return data
[ "def", "_pad_display_data", "(", "self", ",", "vertices", ")", ":", "data", "=", "vertices", "[", ":", ",", "self", ".", "dims", ".", "displayed", "]", "if", "self", ".", "dims", ".", "ndisplay", "==", "2", ":", "data", "=", "np", ".", "pad", "(", ...
pad display data when moving between 2d and 3d NOTES: 2d data is transposed yx 3d data is zyxt
[ "pad", "display", "data", "when", "moving", "between", "2d", "and", "3d", "NOTES", ":", "2d", "data", "is", "transposed", "yx", "3d", "data", "is", "zyxt" ]
[ "\"\"\" pad display data when moving between 2d and 3d\n\n NOTES:\n 2d data is transposed yx\n 3d data is zyxt\n\n \"\"\"", "# if we're only displaying two dimensions, then pad the display dim", "# with zeros", "# y, x, z", "# z, y, x" ]
[ { "param": "self", "type": null }, { "param": "vertices", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vertices", "type": null, "docstring": null, "docstring_tokens...
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
data
null
def data(self, data: list): """ set the data and build the vispy arrays for display """ self._manager.data = data self._update_dims() self.events.data()
set the data and build the vispy arrays for display
set the data and build the vispy arrays for display
[ "set", "the", "data", "and", "build", "the", "vispy", "arrays", "for", "display" ]
def data(self, data: list): self._manager.data = data self._update_dims() self.events.data()
[ "def", "data", "(", "self", ",", "data", ":", "list", ")", ":", "self", ".", "_manager", ".", "data", "=", "data", "self", ".", "_update_dims", "(", ")", "self", ".", "events", ".", "data", "(", ")" ]
set the data and build the vispy arrays for display
[ "set", "the", "data", "and", "build", "the", "vispy", "arrays", "for", "display" ]
[ "\"\"\" set the data and build the vispy arrays for display \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": "list" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "list", "docstring": null, "docstring_tokens":...
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
color_by
<not_specific>
def color_by(self, color_by: str): """ set the property to color vertices by """ if color_by not in self._property_keys: return self._color_by = color_by self._recolor_tracks() self.events.color_by() self.refresh()
set the property to color vertices by
set the property to color vertices by
[ "set", "the", "property", "to", "color", "vertices", "by" ]
def color_by(self, color_by: str): if color_by not in self._property_keys: return self._color_by = color_by self._recolor_tracks() self.events.color_by() self.refresh()
[ "def", "color_by", "(", "self", ",", "color_by", ":", "str", ")", ":", "if", "color_by", "not", "in", "self", ".", "_property_keys", ":", "return", "self", ".", "_color_by", "=", "color_by", "self", ".", "_recolor_tracks", "(", ")", "self", ".", "events"...
set the property to color vertices by
[ "set", "the", "property", "to", "color", "vertices", "by" ]
[ "\"\"\" set the property to color vertices by \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "color_by", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "color_by", "type": "str", "docstring": null, "docstring_token...
c729f8b5de9bffaa4f71bc3743844e9fe69b1d42
kapoorlab/arboretum
arboretum/layers/tracks/tracks.py
[ "MIT" ]
Python
track_labels
zip
def track_labels(self) -> zip: """ return track labels at the current time """ labels, positions = self._manager.track_labels(self.current_time) padded_positions = self._pad_display_data(positions) return labels, padded_positions
return track labels at the current time
return track labels at the current time
[ "return", "track", "labels", "at", "the", "current", "time" ]
def track_labels(self) -> zip: labels, positions = self._manager.track_labels(self.current_time) padded_positions = self._pad_display_data(positions) return labels, padded_positions
[ "def", "track_labels", "(", "self", ")", "->", "zip", ":", "labels", ",", "positions", "=", "self", ".", "_manager", ".", "track_labels", "(", "self", ".", "current_time", ")", "padded_positions", "=", "self", ".", "_pad_display_data", "(", "positions", ")",...
return track labels at the current time
[ "return", "track", "labels", "at", "the", "current", "time" ]
[ "\"\"\" return track labels at the current time \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
45ae3f368a856fe00afe426ca7f9a557e6adfbe0
kapoorlab/arboretum
arboretum/io.py
[ "MIT" ]
Python
write_segmentation
null
def write_segmentation(self, segmentation: np.ndarray, obj_type='obj_type_1'): """ write out the segmentation to an HDF file """ # write the segmentation out grp = self._hdf.create_group('segmentation') grp.create_dataset(f'images',...
write out the segmentation to an HDF file
write out the segmentation to an HDF file
[ "write", "out", "the", "segmentation", "to", "an", "HDF", "file" ]
def write_segmentation(self, segmentation: np.ndarray, obj_type='obj_type_1'): grp = self._hdf.create_group('segmentation') grp.create_dataset(f'images', data=segmentation, dtype='uint16', ...
[ "def", "write_segmentation", "(", "self", ",", "segmentation", ":", "np", ".", "ndarray", ",", "obj_type", "=", "'obj_type_1'", ")", ":", "grp", "=", "self", ".", "_hdf", ".", "create_group", "(", "'segmentation'", ")", "grp", ".", "create_dataset", "(", "...
write out the segmentation to an HDF file
[ "write", "out", "the", "segmentation", "to", "an", "HDF", "file" ]
[ "\"\"\" write out the segmentation to an HDF file \"\"\"", "# write the segmentation out" ]
[ { "param": "self", "type": null }, { "param": "segmentation", "type": "np.ndarray" }, { "param": "obj_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "segmentation", "type": "np.ndarray", "docstring": null, "docs...
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
process_worker
<not_specific>
def process_worker(fn): """ Decorator to run function as a process TODO(arl): would be good to have option for QThread signals """ @wraps(fn) def _process(*args, **kwargs): def _worker(*args, **kwargs): q = args[0] r = fn(*args[1:], **kwargs) q.put(r) ...
Decorator to run function as a process TODO(arl): would be good to have option for QThread signals
Decorator to run function as a process TODO(arl): would be good to have option for QThread signals
[ "Decorator", "to", "run", "function", "as", "a", "process", "TODO", "(", "arl", ")", ":", "would", "be", "good", "to", "have", "option", "for", "QThread", "signals" ]
def process_worker(fn): @wraps(fn) def _process(*args, **kwargs): def _worker(*args, **kwargs): q = args[0] r = fn(*args[1:], **kwargs) q.put(r) queue = SimpleQueue() process = Process(target=_worker, args=(queue, *args), kwargs=kwargs) process...
[ "def", "process_worker", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "_process", "(", "*", "args", ",", "**", "kwargs", ")", ":", "def", "_worker", "(", "*", "args", ",", "**", "kwargs", ")", ":", "q", "=", "args", "[", "0", "]", ...
Decorator to run function as a process TODO(arl): would be good to have option for QThread signals
[ "Decorator", "to", "run", "function", "as", "a", "process", "TODO", "(", "arl", ")", ":", "would", "be", "good", "to", "have", "option", "for", "QThread", "signals" ]
[ "\"\"\" Decorator to run function as a process\n\n TODO(arl): would be good to have option for QThread signals\n \"\"\"" ]
[ { "param": "fn", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fn", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
_localize_process
np.ndarray
def _localize_process(data: tuple, is_binary: bool = True, use_labels: bool = False) -> np.ndarray: # image: np.ndarray, frame: int) -> np.ndarray: """ worker process for localizing and labelling objects volumetric data is usually of the format: t, z, x, y ...
worker process for localizing and labelling objects volumetric data is usually of the format: t, z, x, y Returns: combined data in form of nx5 array (t, x, y, z, label) adding a z-dimension of uniform zero, if one doesn't exist.
worker process for localizing and labelling objects volumetric data is usually of the format: t, z, x, y
[ "worker", "process", "for", "localizing", "and", "labelling", "objects", "volumetric", "data", "is", "usually", "of", "the", "format", ":", "t", "z", "x", "y" ]
def _localize_process(data: tuple, is_binary: bool = True, use_labels: bool = False) -> np.ndarray: if use_labels: assert is_binary image, frame = data assert image.dtype in (np.uint8, np.uint16) if is_binary: labeled, n = measurements.label(image.asty...
[ "def", "_localize_process", "(", "data", ":", "tuple", ",", "is_binary", ":", "bool", "=", "True", ",", "use_labels", ":", "bool", "=", "False", ")", "->", "np", ".", "ndarray", ":", "if", "use_labels", ":", "assert", "is_binary", "image", ",", "frame", ...
worker process for localizing and labelling objects volumetric data is usually of the format: t, z, x, y
[ "worker", "process", "for", "localizing", "and", "labelling", "objects", "volumetric", "data", "is", "usually", "of", "the", "format", ":", "t", "z", "x", "y" ]
[ "# image: np.ndarray, frame: int) -> np.ndarray:", "\"\"\" worker process for localizing and labelling objects\n\n volumetric data is usually of the format: t, z, x, y\n\n Returns:\n combined data in form of nx5 array (t, x, y, z, label) adding a\n z-dimension of uniform zero, if one doesn't e...
[ { "param": "data", "type": "tuple" }, { "param": "is_binary", "type": "bool" }, { "param": "use_labels", "type": "bool" } ]
{ "returns": [ { "docstring": "combined data in form of nx5 array (t, x, y, z, label) adding a\nz-dimension of uniform zero, if one doesn't exist.", "docstring_tokens": [ "combined", "data", "in", "form", "of", "nx5", "array", "(", ...
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
_is_binary_segmentation
<not_specific>
def _is_binary_segmentation(image): """ guess whether this is a binary or unique/integer segmentation based on the data in the image. """ objects = measurements.find_objects(image) labeled, n = measurements.label(image.astype(np.bool)) return n > len(objects)
guess whether this is a binary or unique/integer segmentation based on the data in the image.
guess whether this is a binary or unique/integer segmentation based on the data in the image.
[ "guess", "whether", "this", "is", "a", "binary", "or", "unique", "/", "integer", "segmentation", "based", "on", "the", "data", "in", "the", "image", "." ]
def _is_binary_segmentation(image): objects = measurements.find_objects(image) labeled, n = measurements.label(image.astype(np.bool)) return n > len(objects)
[ "def", "_is_binary_segmentation", "(", "image", ")", ":", "objects", "=", "measurements", ".", "find_objects", "(", "image", ")", "labeled", ",", "n", "=", "measurements", ".", "label", "(", "image", ".", "astype", "(", "np", ".", "bool", ")", ")", "retu...
guess whether this is a binary or unique/integer segmentation based on the data in the image.
[ "guess", "whether", "this", "is", "a", "binary", "or", "unique", "/", "integer", "segmentation", "based", "on", "the", "data", "in", "the", "image", "." ]
[ "\"\"\" guess whether this is a binary or unique/integer segmentation based on\n the data in the image. \"\"\"" ]
[ { "param": "image", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "image", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
localize
<not_specific>
def localize(stack_as_array: np.ndarray, **kwargs): """ localize get the centroids of all objects given a segmentaion mask from Napari. Should work with volumetric data, and infers the object class label from the segmentation label. Parameters: stack_as_array: a numpy array o...
localize get the centroids of all objects given a segmentaion mask from Napari. Should work with volumetric data, and infers the object class label from the segmentation label. Parameters: stack_as_array: a numpy array of the stack, typically the data from a napari 'labels' layer...
localize get the centroids of all objects given a segmentaion mask from Napari. Should work with volumetric data, and infers the object class label from the segmentation label.
[ "localize", "get", "the", "centroids", "of", "all", "objects", "given", "a", "segmentaion", "mask", "from", "Napari", ".", "Should", "work", "with", "volumetric", "data", "and", "infers", "the", "object", "class", "label", "from", "the", "segmentation", "label...
def localize(stack_as_array: np.ndarray, **kwargs): if 'binary_segmentation' not in kwargs: is_binary = _is_binary_segmentation(stack_as_array[0,...]) print(f'guessing is_binary: {is_binary}') else: is_binary = kwargs['binary_segmentation'] assert type(is_binary) == ...
[ "def", "localize", "(", "stack_as_array", ":", "np", ".", "ndarray", ",", "**", "kwargs", ")", ":", "if", "'binary_segmentation'", "not", "in", "kwargs", ":", "is_binary", "=", "_is_binary_segmentation", "(", "stack_as_array", "[", "0", ",", "...", "]", ")",...
localize get the centroids of all objects given a segmentaion mask from Napari.
[ "localize", "get", "the", "centroids", "of", "all", "objects", "given", "a", "segmentaion", "mask", "from", "Napari", "." ]
[ "\"\"\" localize\n\n get the centroids of all objects given a segmentaion mask from Napari.\n\n Should work with volumetric data, and infers the object class label from\n the segmentation label.\n\n Parameters:\n stack_as_array: a numpy array of the stack, typically the data from\n a n...
[ { "param": "stack_as_array", "type": "np.ndarray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stack_as_array", "type": "np.ndarray", "docstring": "a numpy array of the stack, typically the data from\na napari 'labels' layer", "docstring_tokens": [ "a", "numpy", "array", "of", "th...
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
_get_btrack_cfg
<not_specific>
def _get_btrack_cfg(filename=None): """ get a config from a local file or request one over the web NOTES: - appends the filename of the config for display in the gui. not used per se by the tracker. """ if filename is not None: config = btrack.utils.load_config(filename) ...
get a config from a local file or request one over the web NOTES: - appends the filename of the config for display in the gui. not used per se by the tracker.
get a config from a local file or request one over the web NOTES: appends the filename of the config for display in the gui. not used per se by the tracker.
[ "get", "a", "config", "from", "a", "local", "file", "or", "request", "one", "over", "the", "web", "NOTES", ":", "appends", "the", "filename", "of", "the", "config", "for", "display", "in", "the", "gui", ".", "not", "used", "per", "se", "by", "the", "...
def _get_btrack_cfg(filename=None): if filename is not None: config = btrack.utils.load_config(filename) config['Filename'] = filename return config raise IOError
[ "def", "_get_btrack_cfg", "(", "filename", "=", "None", ")", ":", "if", "filename", "is", "not", "None", ":", "config", "=", "btrack", ".", "utils", ".", "load_config", "(", "filename", ")", "config", "[", "'Filename'", "]", "=", "filename", "return", "c...
get a config from a local file or request one over the web NOTES: appends the filename of the config for display in the gui.
[ "get", "a", "config", "from", "a", "local", "file", "or", "request", "one", "over", "the", "web", "NOTES", ":", "appends", "the", "filename", "of", "the", "config", "for", "display", "in", "the", "gui", "." ]
[ "\"\"\" get a config from a local file or request one over the web\n\n NOTES:\n - appends the filename of the config for display in the gui. not used\n per se by the tracker.\n\n \"\"\"" ]
[ { "param": "filename", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
track
<not_specific>
def track(localizations: np.ndarray, config: dict, volume: tuple = ((0,1200),(0,1600),(-1e5,1e5)), optimize: bool = True, method: BayesianUpdates = BayesianUpdates.EXACT, search_radius: int = None, min_track_len: int = 2): """ track Run BayesianTrack...
track Run BayesianTracker with the localizations from the localize function
track Run BayesianTracker with the localizations from the localize function
[ "track", "Run", "BayesianTracker", "with", "the", "localizations", "from", "the", "localize", "function" ]
def track(localizations: np.ndarray, config: dict, volume: tuple = ((0,1200),(0,1600),(-1e5,1e5)), optimize: bool = True, method: BayesianUpdates = BayesianUpdates.EXACT, search_radius: int = None, min_track_len: int = 2): n_localizations = localizations.s...
[ "def", "track", "(", "localizations", ":", "np", ".", "ndarray", ",", "config", ":", "dict", ",", "volume", ":", "tuple", "=", "(", "(", "0", ",", "1200", ")", ",", "(", "0", ",", "1600", ")", ",", "(", "-", "1e5", ",", "1e5", ")", ")", ",", ...
track Run BayesianTracker with the localizations from the localize function
[ "track", "Run", "BayesianTracker", "with", "the", "localizations", "from", "the", "localize", "function" ]
[ "\"\"\" track\n\n Run BayesianTracker with the localizations from the localize function\n\n \"\"\"", "# convert the localizations into btrack objects", "# for obj in objects:", "# obj.z = obj.z * 10.", "# initialise a tracker session using a context manager", "# configure the tracker using a con...
[ { "param": "localizations", "type": "np.ndarray" }, { "param": "config", "type": "dict" }, { "param": "volume", "type": "tuple" }, { "param": "optimize", "type": "bool" }, { "param": "method", "type": "BayesianUpdates" }, { "param": "search_radius", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "localizations", "type": "np.ndarray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "dict", "docstring": null, ...
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
load_hdf
<not_specific>
def load_hdf(filename: str, filter_by: str = 'area>=100', load_segmentation: bool = True, load_objects: bool = True, color_segmentation: bool = True): """ load data from an HDF file """ with ArboretumHDFHandler(filename) as h: h._f_expr = filter_by ...
load data from an HDF file
load data from an HDF file
[ "load", "data", "from", "an", "HDF", "file" ]
def load_hdf(filename: str, filter_by: str = 'area>=100', load_segmentation: bool = True, load_objects: bool = True, color_segmentation: bool = True): with ArboretumHDFHandler(filename) as h: h._f_expr = filter_by if 'segmentation' in h._hdf and lo...
[ "def", "load_hdf", "(", "filename", ":", "str", ",", "filter_by", ":", "str", "=", "'area>=100'", ",", "load_segmentation", ":", "bool", "=", "True", ",", "load_objects", ":", "bool", "=", "True", ",", "color_segmentation", ":", "bool", "=", "True", ")", ...
load data from an HDF file
[ "load", "data", "from", "an", "HDF", "file" ]
[ "\"\"\" load data from an HDF file \"\"\"", "# get the objects and strip out the data", "# get the tracks", "# correct files originating from earlier versions of the tracker" ]
[ { "param": "filename", "type": "str" }, { "param": "filter_by", "type": "str" }, { "param": "load_segmentation", "type": "bool" }, { "param": "load_objects", "type": "bool" }, { "param": "color_segmentation", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filter_by", "type": "str", "docstring": null, "docstring...
469f5ff75581281f0ea3aa8913db9b970531edc9
kapoorlab/arboretum
arboretum/utils.py
[ "MIT" ]
Python
export_hdf
null
def export_hdf(filename: str, segmentation: np.ndarray = None, tracker_state: TrackerFrozenState = None): """ export the tracking data to an hdf file """ if os.path.exists(filename): raise IOError(f'{filename} already exists!') with ArboretumHDFHandler(filename, 'w') ...
export the tracking data to an hdf file
export the tracking data to an hdf file
[ "export", "the", "tracking", "data", "to", "an", "hdf", "file" ]
def export_hdf(filename: str, segmentation: np.ndarray = None, tracker_state: TrackerFrozenState = None): if os.path.exists(filename): raise IOError(f'{filename} already exists!') with ArboretumHDFHandler(filename, 'w') as h: h.write_segmentation(segmentation) ...
[ "def", "export_hdf", "(", "filename", ":", "str", ",", "segmentation", ":", "np", ".", "ndarray", "=", "None", ",", "tracker_state", ":", "TrackerFrozenState", "=", "None", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "r...
export the tracking data to an hdf file
[ "export", "the", "tracking", "data", "to", "an", "hdf", "file" ]
[ "\"\"\" export the tracking data to an hdf file \"\"\"" ]
[ { "param": "filename", "type": "str" }, { "param": "segmentation", "type": "np.ndarray" }, { "param": "tracker_state", "type": "TrackerFrozenState" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "segmentation", "type": "np.ndarray", "docstring": null, ...
6a49af96f626407403991f659c2d9987d37cd9f3
urkonn/django-herokuapp
herokuapp/management/commands/base.py
[ "BSD-3-Clause" ]
Python
call_command
null
def call_command(self, *args, **kwargs): """ Calls the given management command, but only if it's not a dry run. If it's a dry run, then a notice about the command will be printed. """ if self.dry_run: self.stdout.write(format_command("python manage.py", args, kwargs...
Calls the given management command, but only if it's not a dry run. If it's a dry run, then a notice about the command will be printed.
Calls the given management command, but only if it's not a dry run. If it's a dry run, then a notice about the command will be printed.
[ "Calls", "the", "given", "management", "command", "but", "only", "if", "it", "'", "s", "not", "a", "dry", "run", ".", "If", "it", "'", "s", "a", "dry", "run", "then", "a", "notice", "about", "the", "command", "will", "be", "printed", "." ]
def call_command(self, *args, **kwargs): if self.dry_run: self.stdout.write(format_command("python manage.py", args, kwargs)) else: call_command(*args, **kwargs)
[ "def", "call_command", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "dry_run", ":", "self", ".", "stdout", ".", "write", "(", "format_command", "(", "\"python manage.py\"", ",", "args", ",", "kwargs", ")", ")", "else...
Calls the given management command, but only if it's not a dry run.
[ "Calls", "the", "given", "management", "command", "but", "only", "if", "it", "'", "s", "not", "a", "dry", "run", "." ]
[ "\"\"\"\n Calls the given management command, but only if it's not a dry run.\n\n If it's a dry run, then a notice about the command will be printed.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0cdea42cd0aad2bb70f66870e6991b4824f755d0
urkonn/django-herokuapp
herokuapp/middleware.py
[ "BSD-3-Clause" ]
Python
process_request
<not_specific>
def process_request(self, request): """If the request domain is not the canonical domain, redirect.""" hostname = request.get_host().split(":", 1)[0] # Don't perform redirection for testing or local development. if hostname in ("testserver", "localhost", "127.0.0.1"): return ...
If the request domain is not the canonical domain, redirect.
If the request domain is not the canonical domain, redirect.
[ "If", "the", "request", "domain", "is", "not", "the", "canonical", "domain", "redirect", "." ]
def process_request(self, request): hostname = request.get_host().split(":", 1)[0] if hostname in ("testserver", "localhost", "127.0.0.1"): return canonical_hostname = SITE_DOMAIN.split(":", 1)[0] if hostname != canonical_hostname: if request.is_secure(): ...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "hostname", "=", "request", ".", "get_host", "(", ")", ".", "split", "(", "\":\"", ",", "1", ")", "[", "0", "]", "if", "hostname", "in", "(", "\"testserver\"", ",", "\"localhost\"", ",", ...
If the request domain is not the canonical domain, redirect.
[ "If", "the", "request", "domain", "is", "not", "the", "canonical", "domain", "redirect", "." ]
[ "\"\"\"If the request domain is not the canonical domain, redirect.\"\"\"", "# Don't perform redirection for testing or local development.", "# Check against the site domain." ]
[ { "param": "self", "type": null }, { "param": "request", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": null, "docstring": null, "docstring_tokens"...
71c8139a5fded030480b566e435500728d5b590e
urkonn/django-herokuapp
herokuapp/commands.py
[ "BSD-3-Clause" ]
Python
parse_shell
<not_specific>
def parse_shell(lines): """ Parse config variables from the lines """ # If there are no config variables, return an empty dict if not RE_PARSE_SHELL.search(str(lines)): return dict() return dict( line.strip().split("=", 1) for line in lines )
Parse config variables from the lines
Parse config variables from the lines
[ "Parse", "config", "variables", "from", "the", "lines" ]
def parse_shell(lines): if not RE_PARSE_SHELL.search(str(lines)): return dict() return dict( line.strip().split("=", 1) for line in lines )
[ "def", "parse_shell", "(", "lines", ")", ":", "if", "not", "RE_PARSE_SHELL", ".", "search", "(", "str", "(", "lines", ")", ")", ":", "return", "dict", "(", ")", "return", "dict", "(", "line", ".", "strip", "(", ")", ".", "split", "(", "\"=\"", ",",...
Parse config variables from the lines
[ "Parse", "config", "variables", "from", "the", "lines" ]
[ "\"\"\" Parse config variables from the lines \"\"\"", "# If there are no config variables, return an empty dict" ]
[ { "param": "lines", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lines", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
feb6d69a4085539d0cdcd74cda8acb5d2a6abd0f
elezar/dcos-commons
frameworks/cassandra/tests/test_tls.py
[ "Apache-2.0" ]
Python
dcos_ca_bundle
<not_specific>
def dcos_ca_bundle(): """ Retrieve DC/OS CA bundle and returns the content. """ return transport_encryption.fetch_dcos_ca_bundle_contents().decode("ascii")
Retrieve DC/OS CA bundle and returns the content.
Retrieve DC/OS CA bundle and returns the content.
[ "Retrieve", "DC", "/", "OS", "CA", "bundle", "and", "returns", "the", "content", "." ]
def dcos_ca_bundle(): return transport_encryption.fetch_dcos_ca_bundle_contents().decode("ascii")
[ "def", "dcos_ca_bundle", "(", ")", ":", "return", "transport_encryption", ".", "fetch_dcos_ca_bundle_contents", "(", ")", ".", "decode", "(", "\"ascii\"", ")" ]
Retrieve DC/OS CA bundle and returns the content.
[ "Retrieve", "DC", "/", "OS", "CA", "bundle", "and", "returns", "the", "content", "." ]
[ "\"\"\"\n Retrieve DC/OS CA bundle and returns the content.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
afa23dad155169cb82cf84ea06915450c825d952
elezar/dcos-commons
testing/sdk_recovery.py
[ "Apache-2.0" ]
Python
check_permanent_recovery
null
def check_permanent_recovery( package_name: str, service_name: str, pod_name: str, recovery_timeout_s: int, ): """ Perform a replace operation on a specified pod and check that it is replaced All other pods are checked to see if they remain consistent. """ LOG.info("Testing pod repl...
Perform a replace operation on a specified pod and check that it is replaced All other pods are checked to see if they remain consistent.
Perform a replace operation on a specified pod and check that it is replaced All other pods are checked to see if they remain consistent.
[ "Perform", "a", "replace", "operation", "on", "a", "specified", "pod", "and", "check", "that", "it", "is", "replaced", "All", "other", "pods", "are", "checked", "to", "see", "if", "they", "remain", "consistent", "." ]
def check_permanent_recovery( package_name: str, service_name: str, pod_name: str, recovery_timeout_s: int, ): LOG.info("Testing pod replace operation for %s:%s", service_name, pod_name) sdk_plan.wait_for_completed_deployment(service_name) sdk_plan.wait_for_completed_recovery(service_name) ...
[ "def", "check_permanent_recovery", "(", "package_name", ":", "str", ",", "service_name", ":", "str", ",", "pod_name", ":", "str", ",", "recovery_timeout_s", ":", "int", ",", ")", ":", "LOG", ".", "info", "(", "\"Testing pod replace operation for %s:%s\"", ",", "...
Perform a replace operation on a specified pod and check that it is replaced All other pods are checked to see if they remain consistent.
[ "Perform", "a", "replace", "operation", "on", "a", "specified", "pod", "and", "check", "that", "it", "is", "replaced", "All", "other", "pods", "are", "checked", "to", "see", "if", "they", "remain", "consistent", "." ]
[ "\"\"\"\n Perform a replace operation on a specified pod and check that it is replaced\n\n All other pods are checked to see if they remain consistent.\n \"\"\"" ]
[ { "param": "package_name", "type": "str" }, { "param": "service_name", "type": "str" }, { "param": "pod_name", "type": "str" }, { "param": "recovery_timeout_s", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "package_name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "service_name", "type": "str", "docstring": null, "do...
8d45f17b2fb16bae1e2d0c8eb5267feeb609dae0
larsmans/scipy
scipy/signal/tests/test_peak_finding.py
[ "BSD-3-Clause" ]
Python
_gen_ridge_line
<not_specific>
def _gen_ridge_line(start_locs, max_locs, length, distances, gaps): """ Generate coordinates for a ridge line. Will be a series of coordinates, starting a start_loc (length 2). The maximum distance between any adjacent columns will be `max_distance`, the max distance between adjacent rows will ...
Generate coordinates for a ridge line. Will be a series of coordinates, starting a start_loc (length 2). The maximum distance between any adjacent columns will be `max_distance`, the max distance between adjacent rows will be `map_gap'. `max_locs` should be the size of the intended matrix. Th...
Generate coordinates for a ridge line. Will be a series of coordinates, starting a start_loc (length 2). The maximum distance between any adjacent columns will be `max_distance`, the max distance between adjacent rows will be `map_gap'. `max_locs` should be the size of the intended matrix. The ending coordinates are g...
[ "Generate", "coordinates", "for", "a", "ridge", "line", ".", "Will", "be", "a", "series", "of", "coordinates", "starting", "a", "start_loc", "(", "length", "2", ")", ".", "The", "maximum", "distance", "between", "any", "adjacent", "columns", "will", "be", ...
def _gen_ridge_line(start_locs, max_locs, length, distances, gaps): def keep_bounds(num, max_val): out = max(num, 0) out = min(out, max_val) return out gaps = copy.deepcopy(gaps) distances = copy.deepcopy(distances) locs = np.zeros([length, 2], dtype=int) locs[0, :] = start_l...
[ "def", "_gen_ridge_line", "(", "start_locs", ",", "max_locs", ",", "length", ",", "distances", ",", "gaps", ")", ":", "def", "keep_bounds", "(", "num", ",", "max_val", ")", ":", "out", "=", "max", "(", "num", ",", "0", ")", "out", "=", "min", "(", ...
Generate coordinates for a ridge line.
[ "Generate", "coordinates", "for", "a", "ridge", "line", "." ]
[ "\"\"\"\n Generate coordinates for a ridge line.\n\n Will be a series of coordinates, starting a start_loc (length 2).\n The maximum distance between any adjacent columns will be\n `max_distance`, the max distance between adjacent rows\n will be `map_gap'.\n\n `max_locs` should be the size of the ...
[ { "param": "start_locs", "type": null }, { "param": "max_locs", "type": null }, { "param": "length", "type": null }, { "param": "distances", "type": null }, { "param": "gaps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "start_locs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "max_locs", "type": null, "docstring": null, "docstring_...
317fe4ffa39e4e932762a832a82085ecced5c3fa
larsmans/scipy
scipy/weave/swig2_spec.py
[ "BSD-3-Clause" ]
Python
_get_swig_runtime_version
<not_specific>
def _get_swig_runtime_version(self): """This method tries to deduce the SWIG runtime version. If the SWIG runtime layout changes, the `SWIG_TypeQuery` function will not work properly. """ versions = [] for key in sys.modules: idx = key.find('swig_runtime_data...
This method tries to deduce the SWIG runtime version. If the SWIG runtime layout changes, the `SWIG_TypeQuery` function will not work properly.
This method tries to deduce the SWIG runtime version. If the SWIG runtime layout changes, the `SWIG_TypeQuery` function will not work properly.
[ "This", "method", "tries", "to", "deduce", "the", "SWIG", "runtime", "version", ".", "If", "the", "SWIG", "runtime", "layout", "changes", "the", "`", "SWIG_TypeQuery", "`", "function", "will", "not", "work", "properly", "." ]
def _get_swig_runtime_version(self): versions = [] for key in sys.modules: idx = key.find('swig_runtime_data') if idx > -1: ver = int(key[idx+17:]) if ver not in versions: versions.append(ver) nver = len(versions) ...
[ "def", "_get_swig_runtime_version", "(", "self", ")", ":", "versions", "=", "[", "]", "for", "key", "in", "sys", ".", "modules", ":", "idx", "=", "key", ".", "find", "(", "'swig_runtime_data'", ")", "if", "idx", ">", "-", "1", ":", "ver", "=", "int",...
This method tries to deduce the SWIG runtime version.
[ "This", "method", "tries", "to", "deduce", "the", "SWIG", "runtime", "version", "." ]
[ "\"\"\"This method tries to deduce the SWIG runtime version. If\n the SWIG runtime layout changes, the `SWIG_TypeQuery` function\n will not work properly.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
317fe4ffa39e4e932762a832a82085ecced5c3fa
larsmans/scipy
scipy/weave/swig2_spec.py
[ "BSD-3-Clause" ]
Python
init_info
null
def init_info(self, runtime=0): """Keyword arguments: runtime -- If false (default), the user does not need to link to the swig runtime (libswipy). Newer versions of SWIG (>=1.3.23) do not need to build a SWIG runtime library at all. In these versions of SWIG the swig_...
Keyword arguments: runtime -- If false (default), the user does not need to link to the swig runtime (libswipy). Newer versions of SWIG (>=1.3.23) do not need to build a SWIG runtime library at all. In these versions of SWIG the swig_type_info is stored in a common m...
Keyword arguments: runtime -- If false (default), the user does not need to link to the swig runtime (libswipy). Newer versions of SWIG (>=1.3.23) do not need to build a SWIG runtime library at all. In these versions of SWIG the swig_type_info is stored in a common module. swig_type_info stores the type information ...
[ "Keyword", "arguments", ":", "runtime", "--", "If", "false", "(", "default", ")", "the", "user", "does", "not", "need", "to", "link", "to", "the", "swig", "runtime", "(", "libswipy", ")", ".", "Newer", "versions", "of", "SWIG", "(", ">", "=", "1", "....
def init_info(self, runtime=0): common_base_converter.init_info(self) self.type_name = self.class_name self.c_type = self.class_name + "*" self.return_type = self.class_name + "*" self.to_c_return = None self.check_func = None if self.pycobj == 1: ...
[ "def", "init_info", "(", "self", ",", "runtime", "=", "0", ")", ":", "common_base_converter", ".", "init_info", "(", "self", ")", "self", ".", "type_name", "=", "self", ".", "class_name", "self", ".", "c_type", "=", "self", ".", "class_name", "+", "\"*\"...
Keyword arguments: runtime -- If false (default), the user does not need to link to the swig runtime (libswipy).
[ "Keyword", "arguments", ":", "runtime", "--", "If", "false", "(", "default", ")", "the", "user", "does", "not", "need", "to", "link", "to", "the", "swig", "runtime", "(", "libswipy", ")", "." ]
[ "\"\"\"Keyword arguments:\n\n runtime -- If false (default), the user does not need to\n link to the swig runtime (libswipy). Newer versions of SWIG\n (>=1.3.23) do not need to build a SWIG runtime library at\n all. In these versions of SWIG the swig_type_info is stored\n ...
[ { "param": "self", "type": null }, { "param": "runtime", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "runtime", "type": null, "docstring": null, "docstring_tokens"...
317fe4ffa39e4e932762a832a82085ecced5c3fa
larsmans/scipy
scipy/weave/swig2_spec.py
[ "BSD-3-Clause" ]
Python
_get_swig_type
<not_specific>
def _get_swig_type(self, value): """Given the object in the form of `value`, this method returns information on the SWIG internal object repesentation type. Different versions of SWIG use different object representations. This method provides information on the type of internal...
Given the object in the form of `value`, this method returns information on the SWIG internal object repesentation type. Different versions of SWIG use different object representations. This method provides information on the type of internal representation. Currently returns ...
Given the object in the form of `value`, this method returns information on the SWIG internal object repesentation type. Different versions of SWIG use different object representations. This method provides information on the type of internal representation.
[ "Given", "the", "object", "in", "the", "form", "of", "`", "value", "`", "this", "method", "returns", "information", "on", "the", "SWIG", "internal", "object", "repesentation", "type", ".", "Different", "versions", "of", "SWIG", "use", "different", "object", ...
def _get_swig_type(self, value): swig_typ = '' if hasattr(value, 'this'): type_this = type(value.this) type_str = str(type_this) if isinstance(type_this, str): try: data = value.this.split('_') if data[2] == 'p':...
[ "def", "_get_swig_type", "(", "self", ",", "value", ")", ":", "swig_typ", "=", "''", "if", "hasattr", "(", "value", ",", "'this'", ")", ":", "type_this", "=", "type", "(", "value", ".", "this", ")", "type_str", "=", "str", "(", "type_this", ")", "if"...
Given the object in the form of `value`, this method returns information on the SWIG internal object repesentation type.
[ "Given", "the", "object", "in", "the", "form", "of", "`", "value", "`", "this", "method", "returns", "information", "on", "the", "SWIG", "internal", "object", "repesentation", "type", "." ]
[ "\"\"\"Given the object in the form of `value`, this method\n returns information on the SWIG internal object repesentation\n type. Different versions of SWIG use different object\n representations. This method provides information on the type\n of internal representation.\n\n C...
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
317fe4ffa39e4e932762a832a82085ecced5c3fa
larsmans/scipy
scipy/weave/swig2_spec.py
[ "BSD-3-Clause" ]
Python
type_match
<not_specific>
def type_match(self,value): """ This is a generic type matcher for SWIG-1.3 objects. For specific instances, override this method. The method also handles cases where SWIG uses a PyCObject for the `this` attribute and not a string. """ if self._get_swig_type(value): ...
This is a generic type matcher for SWIG-1.3 objects. For specific instances, override this method. The method also handles cases where SWIG uses a PyCObject for the `this` attribute and not a string.
This is a generic type matcher for SWIG-1.3 objects. For specific instances, override this method. The method also handles cases where SWIG uses a PyCObject for the `this` attribute and not a string.
[ "This", "is", "a", "generic", "type", "matcher", "for", "SWIG", "-", "1", ".", "3", "objects", ".", "For", "specific", "instances", "override", "this", "method", ".", "The", "method", "also", "handles", "cases", "where", "SWIG", "uses", "a", "PyCObject", ...
def type_match(self,value): if self._get_swig_type(value): return 1 else: return 0
[ "def", "type_match", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_get_swig_type", "(", "value", ")", ":", "return", "1", "else", ":", "return", "0" ]
This is a generic type matcher for SWIG-1.3 objects.
[ "This", "is", "a", "generic", "type", "matcher", "for", "SWIG", "-", "1", ".", "3", "objects", "." ]
[ "\"\"\" This is a generic type matcher for SWIG-1.3 objects. For\n specific instances, override this method. The method also\n handles cases where SWIG uses a PyCObject for the `this`\n attribute and not a string.\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": null, "docstring": null, "docstring_tokens": ...
317fe4ffa39e4e932762a832a82085ecced5c3fa
larsmans/scipy
scipy/weave/swig2_spec.py
[ "BSD-3-Clause" ]
Python
type_spec
<not_specific>
def type_spec(self,name,value): """ This returns a generic type converter for SWIG-1.3 objects. For specific instances, override this function if necessary.""" # factory swig_ob_type = self._get_swig_type(value) pycobj = 0 if swig_ob_type == 'str': cl...
This returns a generic type converter for SWIG-1.3 objects. For specific instances, override this function if necessary.
This returns a generic type converter for SWIG-1.3 objects. For specific instances, override this function if necessary.
[ "This", "returns", "a", "generic", "type", "converter", "for", "SWIG", "-", "1", ".", "3", "objects", ".", "For", "specific", "instances", "override", "this", "function", "if", "necessary", "." ]
def type_spec(self,name,value): swig_ob_type = self._get_swig_type(value) pycobj = 0 if swig_ob_type == 'str': class_name = value.this.split('_')[-1] elif swig_ob_type == 'pycobj': pycobj = 1 elif swig_ob_type == 'pyswig': pycobj = 2 el...
[ "def", "type_spec", "(", "self", ",", "name", ",", "value", ")", ":", "swig_ob_type", "=", "self", ".", "_get_swig_type", "(", "value", ")", "pycobj", "=", "0", "if", "swig_ob_type", "==", "'str'", ":", "class_name", "=", "value", ".", "this", ".", "sp...
This returns a generic type converter for SWIG-1.3 objects.
[ "This", "returns", "a", "generic", "type", "converter", "for", "SWIG", "-", "1", ".", "3", "objects", "." ]
[ "\"\"\" This returns a generic type converter for SWIG-1.3\n objects. For specific instances, override this function if\n necessary.\"\"\"", "# factory" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "value", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
_bspline_piecefunctions
<not_specific>
def _bspline_piecefunctions(order): """Returns the function defined over the left-side pieces for a bspline of a given order. The 0th piece is the first one less than 0. The last piece is a function identical to 0 (returned as the constant 0). (There are order//2 + 2 total pieces). Also retu...
Returns the function defined over the left-side pieces for a bspline of a given order. The 0th piece is the first one less than 0. The last piece is a function identical to 0 (returned as the constant 0). (There are order//2 + 2 total pieces). Also returns the condition functions that when evalu...
Returns the function defined over the left-side pieces for a bspline of a given order. The 0th piece is the first one less than 0. The last piece is a function identical to 0 (returned as the constant 0). (There are order//2 + 2 total pieces). Also returns the condition functions that when evaluated return boolean ...
[ "Returns", "the", "function", "defined", "over", "the", "left", "-", "side", "pieces", "for", "a", "bspline", "of", "a", "given", "order", ".", "The", "0th", "piece", "is", "the", "first", "one", "less", "than", "0", ".", "The", "last", "piece", "is", ...
def _bspline_piecefunctions(order): try: return _splinefunc_cache[order] except KeyError: pass def condfuncgen(num, val1, val2): if num == 0: return lambda x: logical_and(less_equal(x, val1), greater_equal(x, val2)) elif nu...
[ "def", "_bspline_piecefunctions", "(", "order", ")", ":", "try", ":", "return", "_splinefunc_cache", "[", "order", "]", "except", "KeyError", ":", "pass", "def", "condfuncgen", "(", "num", ",", "val1", ",", "val2", ")", ":", "if", "num", "==", "0", ":", ...
Returns the function defined over the left-side pieces for a bspline of a given order.
[ "Returns", "the", "function", "defined", "over", "the", "left", "-", "side", "pieces", "for", "a", "bspline", "of", "a", "given", "order", "." ]
[ "\"\"\"Returns the function defined over the left-side pieces for a bspline of\n a given order.\n\n The 0th piece is the first one less than 0. The last piece is a function\n identical to 0 (returned as the constant 0). (There are order//2 + 2 total\n pieces).\n\n Also returns the condition functio...
[ { "param": "order", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "order", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
bspline
<not_specific>
def bspline(x, n): """B-spline basis function of order n. Notes ----- Uses numpy.piecewise and automatic function-generator. """ ax = -abs(asarray(x)) # number of pieces on the left-side is (n+1)/2 funclist, condfuncs = _bspline_piecefunctions(n) condlist = [func(ax) for func in co...
B-spline basis function of order n. Notes ----- Uses numpy.piecewise and automatic function-generator.
B-spline basis function of order n. Notes Uses numpy.piecewise and automatic function-generator.
[ "B", "-", "spline", "basis", "function", "of", "order", "n", ".", "Notes", "Uses", "numpy", ".", "piecewise", "and", "automatic", "function", "-", "generator", "." ]
def bspline(x, n): ax = -abs(asarray(x)) funclist, condfuncs = _bspline_piecefunctions(n) condlist = [func(ax) for func in condfuncs] return piecewise(ax, condlist, funclist)
[ "def", "bspline", "(", "x", ",", "n", ")", ":", "ax", "=", "-", "abs", "(", "asarray", "(", "x", ")", ")", "funclist", ",", "condfuncs", "=", "_bspline_piecefunctions", "(", "n", ")", "condlist", "=", "[", "func", "(", "ax", ")", "for", "func", "...
B-spline basis function of order n. Notes
[ "B", "-", "spline", "basis", "function", "of", "order", "n", ".", "Notes" ]
[ "\"\"\"B-spline basis function of order n.\n\n Notes\n -----\n Uses numpy.piecewise and automatic function-generator.\n\n \"\"\"", "# number of pieces on the left-side is (n+1)/2" ]
[ { "param": "x", "type": null }, { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], ...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
gauss_spline
<not_specific>
def gauss_spline(x, n): """Gaussian approximation to B-spline basis function of order n. """ signsq = (n + 1) / 12.0 return 1 / sqrt(2 * pi * signsq) * exp(-x ** 2 / 2 / signsq)
Gaussian approximation to B-spline basis function of order n.
Gaussian approximation to B-spline basis function of order n.
[ "Gaussian", "approximation", "to", "B", "-", "spline", "basis", "function", "of", "order", "n", "." ]
def gauss_spline(x, n): signsq = (n + 1) / 12.0 return 1 / sqrt(2 * pi * signsq) * exp(-x ** 2 / 2 / signsq)
[ "def", "gauss_spline", "(", "x", ",", "n", ")", ":", "signsq", "=", "(", "n", "+", "1", ")", "/", "12.0", "return", "1", "/", "sqrt", "(", "2", "*", "pi", "*", "signsq", ")", "*", "exp", "(", "-", "x", "**", "2", "/", "2", "/", "signsq", ...
Gaussian approximation to B-spline basis function of order n.
[ "Gaussian", "approximation", "to", "B", "-", "spline", "basis", "function", "of", "order", "n", "." ]
[ "\"\"\"Gaussian approximation to B-spline basis function of order n.\n \"\"\"" ]
[ { "param": "x", "type": null }, { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], ...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
cspline1d
<not_specific>
def cspline1d(signal, lamb=0.0): """ Compute cubic spline coefficients for rank-1 array. Find the cubic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with a ...
Compute cubic spline coefficients for rank-1 array. Find the cubic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with a length 3 FIR window [1.0, 4.0, 1.0]/...
Compute cubic spline coefficients for rank-1 array. Find the cubic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with a length 3 FIR window [1.0, 4.0, 1.0]/ 6.0 . Parameters si...
[ "Compute", "cubic", "spline", "coefficients", "for", "rank", "-", "1", "array", ".", "Find", "the", "cubic", "spline", "coefficients", "for", "a", "1", "-", "D", "signal", "assuming", "mirror", "-", "symmetric", "boundary", "conditions", ".", "To", "obtain",...
def cspline1d(signal, lamb=0.0): if lamb != 0.0: return _cubic_smooth_coeff(signal, lamb) else: return _cubic_coeff(signal)
[ "def", "cspline1d", "(", "signal", ",", "lamb", "=", "0.0", ")", ":", "if", "lamb", "!=", "0.0", ":", "return", "_cubic_smooth_coeff", "(", "signal", ",", "lamb", ")", "else", ":", "return", "_cubic_coeff", "(", "signal", ")" ]
Compute cubic spline coefficients for rank-1 array.
[ "Compute", "cubic", "spline", "coefficients", "for", "rank", "-", "1", "array", "." ]
[ "\"\"\"\n Compute cubic spline coefficients for rank-1 array.\n\n Find the cubic spline coefficients for a 1-D signal assuming\n mirror-symmetric boundary conditions. To obtain the signal back from the\n spline representation mirror-symmetric-convolve these coefficients with a\n length 3 FIR window...
[ { "param": "signal", "type": null }, { "param": "lamb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "signal", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lamb", "type": null, "docstring": null, "docstring_tokens":...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
qspline1d
<not_specific>
def qspline1d(signal, lamb=0.0): """Compute quadratic spline coefficients for rank-1 array. Find the quadratic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with...
Compute quadratic spline coefficients for rank-1 array. Find the quadratic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with a length 3 FIR window [1.0, 6.0, 1....
Compute quadratic spline coefficients for rank-1 array. Find the quadratic spline coefficients for a 1-D signal assuming mirror-symmetric boundary conditions. To obtain the signal back from the spline representation mirror-symmetric-convolve these coefficients with a length 3 FIR window [1.0, 6.0, 1.0]/ 8.0 . Parame...
[ "Compute", "quadratic", "spline", "coefficients", "for", "rank", "-", "1", "array", ".", "Find", "the", "quadratic", "spline", "coefficients", "for", "a", "1", "-", "D", "signal", "assuming", "mirror", "-", "symmetric", "boundary", "conditions", ".", "To", "...
def qspline1d(signal, lamb=0.0): if lamb != 0.0: raise ValueError("Smoothing quadratic splines not supported yet.") else: return _quadratic_coeff(signal)
[ "def", "qspline1d", "(", "signal", ",", "lamb", "=", "0.0", ")", ":", "if", "lamb", "!=", "0.0", ":", "raise", "ValueError", "(", "\"Smoothing quadratic splines not supported yet.\"", ")", "else", ":", "return", "_quadratic_coeff", "(", "signal", ")" ]
Compute quadratic spline coefficients for rank-1 array.
[ "Compute", "quadratic", "spline", "coefficients", "for", "rank", "-", "1", "array", "." ]
[ "\"\"\"Compute quadratic spline coefficients for rank-1 array.\n\n Find the quadratic spline coefficients for a 1-D signal assuming\n mirror-symmetric boundary conditions. To obtain the signal back from the\n spline representation mirror-symmetric-convolve these coefficients with a\n length 3 FIR wind...
[ { "param": "signal", "type": null }, { "param": "lamb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "signal", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lamb", "type": null, "docstring": null, "docstring_tokens":...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
cspline1d_eval
<not_specific>
def cspline1d_eval(cj, newx, dx=1.0, x0=0): """Evaluate a spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of: oldx = x...
Evaluate a spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of: oldx = x0 + j*dx j=0...N-1, with N=len(cj) Edges are ...
Evaluate a spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of. Edges are handled using mirror-symmetric boundary conditions.
[ "Evaluate", "a", "spline", "at", "the", "new", "set", "of", "points", ".", "`", "dx", "`", "is", "the", "old", "sample", "-", "spacing", "while", "`", "x0", "`", "was", "the", "old", "origin", ".", "In", "other", "-", "words", "the", "old", "-", ...
def cspline1d_eval(cj, newx, dx=1.0, x0=0): newx = (asarray(newx) - x0) / float(dx) res = zeros_like(newx) if res.size == 0: return res N = len(cj) cond1 = newx < 0 cond2 = newx > (N - 1) cond3 = ~(cond1 | cond2) res[cond1] = cspline1d_eval(cj, -newx[cond1]) res[cond2] = cspl...
[ "def", "cspline1d_eval", "(", "cj", ",", "newx", ",", "dx", "=", "1.0", ",", "x0", "=", "0", ")", ":", "newx", "=", "(", "asarray", "(", "newx", ")", "-", "x0", ")", "/", "float", "(", "dx", ")", "res", "=", "zeros_like", "(", "newx", ")", "i...
Evaluate a spline at the new set of points.
[ "Evaluate", "a", "spline", "at", "the", "new", "set", "of", "points", "." ]
[ "\"\"\"Evaluate a spline at the new set of points.\n\n `dx` is the old sample-spacing while `x0` was the old origin. In\n other-words the old-sample points (knot-points) for which the `cj`\n represent spline coefficients were at equally-spaced points of:\n\n oldx = x0 + j*dx j=0...N-1, with N=len(cj...
[ { "param": "cj", "type": null }, { "param": "newx", "type": null }, { "param": "dx", "type": null }, { "param": "x0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newx", "type": null, "docstring": null, "docstring_tokens": [],...
01ffe43505cd76ff949eed2c11d4d9108da89f0c
larsmans/scipy
scipy/signal/bsplines.py
[ "BSD-3-Clause" ]
Python
qspline1d_eval
<not_specific>
def qspline1d_eval(cj, newx, dx=1.0, x0=0): """Evaluate a quadratic spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of:: ...
Evaluate a quadratic spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of:: oldx = x0 + j*dx j=0...N-1, with N=len(cj) ...
Evaluate a quadratic spline at the new set of points. `dx` is the old sample-spacing while `x0` was the old origin. In other-words the old-sample points (knot-points) for which the `cj` represent spline coefficients were at equally-spaced points of:. Edges are handled using mirror-symmetric boundary conditions.
[ "Evaluate", "a", "quadratic", "spline", "at", "the", "new", "set", "of", "points", ".", "`", "dx", "`", "is", "the", "old", "sample", "-", "spacing", "while", "`", "x0", "`", "was", "the", "old", "origin", ".", "In", "other", "-", "words", "the", "...
def qspline1d_eval(cj, newx, dx=1.0, x0=0): newx = (asarray(newx) - x0) / dx res = zeros_like(newx) if res.size == 0: return res N = len(cj) cond1 = newx < 0 cond2 = newx > (N - 1) cond3 = ~(cond1 | cond2) res[cond1] = qspline1d_eval(cj, -newx[cond1]) res[cond2] = qspline1d_e...
[ "def", "qspline1d_eval", "(", "cj", ",", "newx", ",", "dx", "=", "1.0", ",", "x0", "=", "0", ")", ":", "newx", "=", "(", "asarray", "(", "newx", ")", "-", "x0", ")", "/", "dx", "res", "=", "zeros_like", "(", "newx", ")", "if", "res", ".", "si...
Evaluate a quadratic spline at the new set of points.
[ "Evaluate", "a", "quadratic", "spline", "at", "the", "new", "set", "of", "points", "." ]
[ "\"\"\"Evaluate a quadratic spline at the new set of points.\n\n `dx` is the old sample-spacing while `x0` was the old origin. In\n other-words the old-sample points (knot-points) for which the `cj`\n represent spline coefficients were at equally-spaced points of::\n\n oldx = x0 + j*dx j=0...N-1, wi...
[ { "param": "cj", "type": null }, { "param": "newx", "type": null }, { "param": "dx", "type": null }, { "param": "x0", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "newx", "type": null, "docstring": null, "docstring_tokens": [],...
79358d04bf05d6cef3c6dd13018c2da1bb63564c
larsmans/scipy
scipy/sparse/linalg/isolve/lgmres.py
[ "BSD-3-Clause" ]
Python
lgmres
<not_specific>
def lgmres(A, b, x0=None, tol=1e-5, maxiter=1000, M=None, callback=None, inner_m=30, outer_k=3, outer_v=None, store_outer_Av=True): """ Solve a matrix equation using the LGMRES algorithm. The LGMRES algorithm [1]_ [2]_ is designed to avoid some problems in the convergence in restarted GMRES,...
Solve a matrix equation using the LGMRES algorithm. The LGMRES algorithm [1]_ [2]_ is designed to avoid some problems in the convergence in restarted GMRES, and often converges in fewer iterations. Parameters ---------- A : {sparse matrix, dense matrix, LinearOperator} The real or...
Solve a matrix equation using the LGMRES algorithm. The LGMRES algorithm [1]_ [2]_ is designed to avoid some problems in the convergence in restarted GMRES, and often converges in fewer iterations. Parameters A : {sparse matrix, dense matrix, LinearOperator} The real or complex N-by-N matrix of the linear system. b :...
[ "Solve", "a", "matrix", "equation", "using", "the", "LGMRES", "algorithm", ".", "The", "LGMRES", "algorithm", "[", "1", "]", "_", "[", "2", "]", "_", "is", "designed", "to", "avoid", "some", "problems", "in", "the", "convergence", "in", "restarted", "GMR...
def lgmres(A, b, x0=None, tol=1e-5, maxiter=1000, M=None, callback=None, inner_m=30, outer_k=3, outer_v=None, store_outer_Av=True): from scipy.linalg.basic import lstsq A,M,x,b,postprocess = make_system(A,M,x0,b) if not np.isfinite(b).all(): raise ValueError("RHS must contain only finite ...
[ "def", "lgmres", "(", "A", ",", "b", ",", "x0", "=", "None", ",", "tol", "=", "1e-5", ",", "maxiter", "=", "1000", ",", "M", "=", "None", ",", "callback", "=", "None", ",", "inner_m", "=", "30", ",", "outer_k", "=", "3", ",", "outer_v", "=", ...
Solve a matrix equation using the LGMRES algorithm.
[ "Solve", "a", "matrix", "equation", "using", "the", "LGMRES", "algorithm", "." ]
[ "\"\"\"\n Solve a matrix equation using the LGMRES algorithm.\n\n The LGMRES algorithm [1]_ [2]_ is designed to avoid some problems\n in the convergence in restarted GMRES, and often converges in fewer\n iterations.\n\n Parameters\n ----------\n A : {sparse matrix, dense matrix, LinearOperator}...
[ { "param": "A", "type": null }, { "param": "b", "type": null }, { "param": "x0", "type": null }, { "param": "tol", "type": null }, { "param": "maxiter", "type": null }, { "param": "M", "type": null }, { "param": "callback", "type": null...
{ "returns": [], "raises": [], "params": [ { "identifier": "A", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "b", "type": null, "docstring": null, "docstring_tokens": [], ...
03a7fe0e5eef7804769ff16f60a7e8871a277b01
larsmans/scipy
scipy/weave/ext_tools.py
[ "BSD-3-Clause" ]
Python
parse_tuple_code
<not_specific>
def parse_tuple_code(self): """ Create code block for PyArg_ParseTuple. Variable declarations for all PyObjects are done also. This code got a lot uglier when I added local_dict... """ declare_return = 'py::object return_val;\n' \ 'int exceptio...
Create code block for PyArg_ParseTuple. Variable declarations for all PyObjects are done also. This code got a lot uglier when I added local_dict...
Create code block for PyArg_ParseTuple. Variable declarations for all PyObjects are done also. This code got a lot uglier when I added local_dict
[ "Create", "code", "block", "for", "PyArg_ParseTuple", ".", "Variable", "declarations", "for", "all", "PyObjects", "are", "done", "also", ".", "This", "code", "got", "a", "lot", "uglier", "when", "I", "added", "local_dict" ]
def parse_tuple_code(self): declare_return = 'py::object return_val;\n' \ 'int exception_occurred = 0;\n' \ 'PyObject *py_local_dict = NULL;\n' arg_string_list = self.arg_specs.variable_as_strings() + ['"local_dict"'] arg_strings = ','.join(arg_s...
[ "def", "parse_tuple_code", "(", "self", ")", ":", "declare_return", "=", "'py::object return_val;\\n'", "'int exception_occurred = 0;\\n'", "'PyObject *py_local_dict = NULL;\\n'", "arg_string_list", "=", "self", ".", "arg_specs", ".", "variable_as_strings", "(", ")", "+", "...
Create code block for PyArg_ParseTuple.
[ "Create", "code", "block", "for", "PyArg_ParseTuple", "." ]
[ "\"\"\" Create code block for PyArg_ParseTuple. Variable declarations\n for all PyObjects are done also.\n\n This code got a lot uglier when I added local_dict...\n \"\"\"", "#Each variable is in charge of its own cleanup now.", "#cnt = len(arg_list)", "#declare_cleanup = \"blitz...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
03a7fe0e5eef7804769ff16f60a7e8871a277b01
larsmans/scipy
scipy/weave/ext_tools.py
[ "BSD-3-Clause" ]
Python
generate_module
<not_specific>
def generate_module(module_string, module_file): """ generate the source code file. Only overwrite the existing file if the actual source has changed. """ file_changed = 1 if os.path.exists(module_file): f = open(module_file,'r') old_string = f.read() f.close() i...
generate the source code file. Only overwrite the existing file if the actual source has changed.
generate the source code file. Only overwrite the existing file if the actual source has changed.
[ "generate", "the", "source", "code", "file", ".", "Only", "overwrite", "the", "existing", "file", "if", "the", "actual", "source", "has", "changed", "." ]
def generate_module(module_string, module_file): file_changed = 1 if os.path.exists(module_file): f = open(module_file,'r') old_string = f.read() f.close() if old_string == module_string: file_changed = 0 if file_changed: f = open(module_file,'w') ...
[ "def", "generate_module", "(", "module_string", ",", "module_file", ")", ":", "file_changed", "=", "1", "if", "os", ".", "path", ".", "exists", "(", "module_file", ")", ":", "f", "=", "open", "(", "module_file", ",", "'r'", ")", "old_string", "=", "f", ...
generate the source code file.
[ "generate", "the", "source", "code", "file", "." ]
[ "\"\"\" generate the source code file. Only overwrite\n the existing file if the actual source has changed.\n \"\"\"" ]
[ { "param": "module_string", "type": null }, { "param": "module_file", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "module_string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "module_file", "type": null, "docstring": null, "docs...
03a7fe0e5eef7804769ff16f60a7e8871a277b01
larsmans/scipy
scipy/weave/ext_tools.py
[ "BSD-3-Clause" ]
Python
downcast
<not_specific>
def downcast(var_specs): """ Cast python scalars down to most common type of arrays used. Right now, focus on complex and float types. Ignore int types. Require all arrays to have same type before forcing downcasts. Note: var_specs are currently altered in place (horrors...!) ...
Cast python scalars down to most common type of arrays used. Right now, focus on complex and float types. Ignore int types. Require all arrays to have same type before forcing downcasts. Note: var_specs are currently altered in place (horrors...!)
Cast python scalars down to most common type of arrays used. Right now, focus on complex and float types. Ignore int types. Require all arrays to have same type before forcing downcasts. var_specs are currently altered in place (horrors...!)
[ "Cast", "python", "scalars", "down", "to", "most", "common", "type", "of", "arrays", "used", ".", "Right", "now", "focus", "on", "complex", "and", "float", "types", ".", "Ignore", "int", "types", ".", "Require", "all", "arrays", "to", "have", "same", "ty...
def downcast(var_specs): numeric_types = [] for var in var_specs: if hasattr(var,'numeric_type'): numeric_types.append(var.numeric_type) if (('f' in numeric_types or 'F' in numeric_types) and not ( 'd' in numeric_types or 'D' in numeric_types)): for var in var_specs: ...
[ "def", "downcast", "(", "var_specs", ")", ":", "numeric_types", "=", "[", "]", "for", "var", "in", "var_specs", ":", "if", "hasattr", "(", "var", ",", "'numeric_type'", ")", ":", "numeric_types", ".", "append", "(", "var", ".", "numeric_type", ")", "if",...
Cast python scalars down to most common type of arrays used.
[ "Cast", "python", "scalars", "down", "to", "most", "common", "type", "of", "arrays", "used", "." ]
[ "\"\"\" Cast python scalars down to most common type of\n arrays used.\n\n Right now, focus on complex and float types. Ignore int types.\n Require all arrays to have same type before forcing downcasts.\n\n Note: var_specs are currently altered in place (horrors...!)\n \"\"\"", ...
[ { "param": "var_specs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "var_specs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
37272a2e7c9fb78d7f9140e67b4a7acb5e48dabf
larsmans/scipy
scipy/cluster/doc/ex1.py
[ "BSD-3-Clause" ]
Python
cluster_data
<not_specific>
def cluster_data(data,cluster_cnt,iter=20,thresh=1e-5): """ Group data into a number of common clusters data -- 2D array of data points. Each point is a row in the array. cluster_cnt -- The number of clusters to use iter -- number of iterations to use for kmeans algorithm thresh --...
Group data into a number of common clusters data -- 2D array of data points. Each point is a row in the array. cluster_cnt -- The number of clusters to use iter -- number of iterations to use for kmeans algorithm thresh -- distortion threshold for kmeans algorithm return -- l...
Group data into a number of common clusters data -- 2D array of data points. Each point is a row in the array. - list of 2D arrays. Each array contains the data points that belong to a specific cluster. Uses kmeans algorithm to find the clusters.
[ "Group", "data", "into", "a", "number", "of", "common", "clusters", "data", "--", "2D", "array", "of", "data", "points", ".", "Each", "point", "is", "a", "row", "in", "the", "array", ".", "-", "list", "of", "2D", "arrays", ".", "Each", "array", "cont...
def cluster_data(data,cluster_cnt,iter=20,thresh=1e-5): wh_data = vq.whiten(data) code_book,dist = vq.kmeans(wh_data,cluster_cnt,iter,thresh) code_ids, distortion = vq.vq(wh_data,code_book) clusters = [] for i in range(len(code_book)): cluster = np.compress(code_ids == i,data,0) clus...
[ "def", "cluster_data", "(", "data", ",", "cluster_cnt", ",", "iter", "=", "20", ",", "thresh", "=", "1e-5", ")", ":", "wh_data", "=", "vq", ".", "whiten", "(", "data", ")", "code_book", ",", "dist", "=", "vq", ".", "kmeans", "(", "wh_data", ",", "c...
Group data into a number of common clusters data -- 2D array of data points.
[ "Group", "data", "into", "a", "number", "of", "common", "clusters", "data", "--", "2D", "array", "of", "data", "points", "." ]
[ "\"\"\" Group data into a number of common clusters\n\n data -- 2D array of data points. Each point is a row in the array.\n cluster_cnt -- The number of clusters to use\n iter -- number of iterations to use for kmeans algorithm\n thresh -- distortion threshold for kmeans algorithm\n\n ...
[ { "param": "data", "type": null }, { "param": "cluster_cnt", "type": null }, { "param": "iter", "type": null }, { "param": "thresh", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cluster_cnt", "type": null, "docstring": null, "docstring_tok...
e5e70fc8463bb5da7fce776ac04f3ca54a3b3685
larsmans/scipy
scipy/signal/_upfirdn.py
[ "BSD-3-Clause" ]
Python
apply_filter
<not_specific>
def apply_filter(self, x): """Apply the prepared filter to a 1D signal x""" output_len = _output_len(len(self._h_trans_flip), len(x), self._up, self._down) out = np.zeros(output_len, dtype=self._output_type) _apply(np.asarray(x, self._output_type), self._...
Apply the prepared filter to a 1D signal x
Apply the prepared filter to a 1D signal x
[ "Apply", "the", "prepared", "filter", "to", "a", "1D", "signal", "x" ]
def apply_filter(self, x): output_len = _output_len(len(self._h_trans_flip), len(x), self._up, self._down) out = np.zeros(output_len, dtype=self._output_type) _apply(np.asarray(x, self._output_type), self._h_trans_flip, out, self._up, self._down) ...
[ "def", "apply_filter", "(", "self", ",", "x", ")", ":", "output_len", "=", "_output_len", "(", "len", "(", "self", ".", "_h_trans_flip", ")", ",", "len", "(", "x", ")", ",", "self", ".", "_up", ",", "self", ".", "_down", ")", "out", "=", "np", "....
Apply the prepared filter to a 1D signal x
[ "Apply", "the", "prepared", "filter", "to", "a", "1D", "signal", "x" ]
[ "\"\"\"Apply the prepared filter to a 1D signal x\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], ...
e5ed93ee671366470f53316b508085eaf1078f2a
larsmans/scipy
scipy/weave/examples/increment_example.py
[ "BSD-3-Clause" ]
Python
build_increment_ext
null
def build_increment_ext(): """ Build a simple extension with functions that increment numbers. The extension will be built in the local directory. """ mod = ext_tools.ext_module('increment_ext') # Effectively a type declaration for 'a' in the following functions. a = 1 ext_code = "retu...
Build a simple extension with functions that increment numbers. The extension will be built in the local directory.
Build a simple extension with functions that increment numbers. The extension will be built in the local directory.
[ "Build", "a", "simple", "extension", "with", "functions", "that", "increment", "numbers", ".", "The", "extension", "will", "be", "built", "in", "the", "local", "directory", "." ]
def build_increment_ext(): mod = ext_tools.ext_module('increment_ext') a = 1 ext_code = "return_val = PyInt_FromLong(a+1);" func = ext_tools.ext_function('increment',ext_code,['a']) mod.add_function(func) ext_code = "return_val = PyInt_FromLong(a+2);" func = ext_tools.ext_function('increment...
[ "def", "build_increment_ext", "(", ")", ":", "mod", "=", "ext_tools", ".", "ext_module", "(", "'increment_ext'", ")", "a", "=", "1", "ext_code", "=", "\"return_val = PyInt_FromLong(a+1);\"", "func", "=", "ext_tools", ".", "ext_function", "(", "'increment'", ",", ...
Build a simple extension with functions that increment numbers.
[ "Build", "a", "simple", "extension", "with", "functions", "that", "increment", "numbers", "." ]
[ "\"\"\" Build a simple extension with functions that increment numbers.\n The extension will be built in the local directory.\n \"\"\"", "# Effectively a type declaration for 'a' in the following functions." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9e288fad5cc0da415b47703611fd54a387e7977e
larsmans/scipy
scipy/io/_fortran.py
[ "BSD-3-Clause" ]
Python
read_record
<not_specific>
def read_record(self, dtype=None): """ Reads a record of a given type from the file. Parameters ---------- dtype : dtype, optional Data type specifying the size and endiness of the data. Returns ------- data : ndarray A one-dimens...
Reads a record of a given type from the file. Parameters ---------- dtype : dtype, optional Data type specifying the size and endiness of the data. Returns ------- data : ndarray A one-dimensional array object. Notes ---...
Reads a record of a given type from the file. Parameters dtype : dtype, optional Data type specifying the size and endiness of the data. Returns data : ndarray A one-dimensional array object. Notes If the record contains a multi-dimensional array, calling reshape or resize will restructure the array to the correct...
[ "Reads", "a", "record", "of", "a", "given", "type", "from", "the", "file", ".", "Parameters", "dtype", ":", "dtype", "optional", "Data", "type", "specifying", "the", "size", "and", "endiness", "of", "the", "data", ".", "Returns", "data", ":", "ndarray", ...
def read_record(self, dtype=None): if dtype is None: raise ValueError('Must specify dtype') dtype = np.dtype(dtype) firstSize = self._read_size() if firstSize % dtype.itemsize != 0: raise ValueError('Size obtained ({0}) is not a multiple of the ' ...
[ "def", "read_record", "(", "self", ",", "dtype", "=", "None", ")", ":", "if", "dtype", "is", "None", ":", "raise", "ValueError", "(", "'Must specify dtype'", ")", "dtype", "=", "np", ".", "dtype", "(", "dtype", ")", "firstSize", "=", "self", ".", "_rea...
Reads a record of a given type from the file.
[ "Reads", "a", "record", "of", "a", "given", "type", "from", "the", "file", "." ]
[ "\"\"\"\n Reads a record of a given type from the file.\n\n Parameters\n ----------\n dtype : dtype, optional\n Data type specifying the size and endiness of the data.\n\n Returns\n -------\n data : ndarray\n A one-dimensional array object.\n\n ...
[ { "param": "self", "type": null }, { "param": "dtype", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dtype", "type": null, "docstring": null, "docstring_tokens": ...
9e288fad5cc0da415b47703611fd54a387e7977e
larsmans/scipy
scipy/io/_fortran.py
[ "BSD-3-Clause" ]
Python
close
null
def close(self): """ Closes the file. It is unsupported to call any other methods off this object after closing it. Note that this class supports the 'with' statement in modern versions of Python, to call this automatically """ self._fp.close()
Closes the file. It is unsupported to call any other methods off this object after closing it. Note that this class supports the 'with' statement in modern versions of Python, to call this automatically
Closes the file. It is unsupported to call any other methods off this object after closing it. Note that this class supports the 'with' statement in modern versions of Python, to call this automatically
[ "Closes", "the", "file", ".", "It", "is", "unsupported", "to", "call", "any", "other", "methods", "off", "this", "object", "after", "closing", "it", ".", "Note", "that", "this", "class", "supports", "the", "'", "with", "'", "statement", "in", "modern", "...
def close(self): self._fp.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "_fp", ".", "close", "(", ")" ]
Closes the file.
[ "Closes", "the", "file", "." ]
[ "\"\"\"\n Closes the file. It is unsupported to call any other methods off this\n object after closing it. Note that this class supports the 'with'\n statement in modern versions of Python, to call this automatically\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
int_to_symbol
<not_specific>
def int_to_symbol(i): """ Convert numeric symbol or token to a desriptive name. """ try: return symbol.sym_name[i] except KeyError: return token.tok_name[i]
Convert numeric symbol or token to a desriptive name.
Convert numeric symbol or token to a desriptive name.
[ "Convert", "numeric", "symbol", "or", "token", "to", "a", "desriptive", "name", "." ]
def int_to_symbol(i): try: return symbol.sym_name[i] except KeyError: return token.tok_name[i]
[ "def", "int_to_symbol", "(", "i", ")", ":", "try", ":", "return", "symbol", ".", "sym_name", "[", "i", "]", "except", "KeyError", ":", "return", "token", ".", "tok_name", "[", "i", "]" ]
Convert numeric symbol or token to a desriptive name.
[ "Convert", "numeric", "symbol", "or", "token", "to", "a", "desriptive", "name", "." ]
[ "\"\"\" Convert numeric symbol or token to a desriptive name.\n \"\"\"" ]
[ { "param": "i", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "i", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
translate_symbols
<not_specific>
def translate_symbols(ast_tuple): """ Translate numeric grammar symbols in an ast_tuple descriptive names. This simply traverses the tree converting any integer value to values found in symbol.sym_name or token.tok_name. """ new_list = [] for item in ast_tuple: if isinstance(ite...
Translate numeric grammar symbols in an ast_tuple descriptive names. This simply traverses the tree converting any integer value to values found in symbol.sym_name or token.tok_name.
Translate numeric grammar symbols in an ast_tuple descriptive names. This simply traverses the tree converting any integer value to values found in symbol.sym_name or token.tok_name.
[ "Translate", "numeric", "grammar", "symbols", "in", "an", "ast_tuple", "descriptive", "names", ".", "This", "simply", "traverses", "the", "tree", "converting", "any", "integer", "value", "to", "values", "found", "in", "symbol", ".", "sym_name", "or", "token", ...
def translate_symbols(ast_tuple): new_list = [] for item in ast_tuple: if isinstance(item, int): new_list.append(int_to_symbol(item)) elif issequence(item): new_list.append(translate_symbols(item)) else: new_list.append(item) if isinstance(ast_tupl...
[ "def", "translate_symbols", "(", "ast_tuple", ")", ":", "new_list", "=", "[", "]", "for", "item", "in", "ast_tuple", ":", "if", "isinstance", "(", "item", ",", "int", ")", ":", "new_list", ".", "append", "(", "int_to_symbol", "(", "item", ")", ")", "el...
Translate numeric grammar symbols in an ast_tuple descriptive names.
[ "Translate", "numeric", "grammar", "symbols", "in", "an", "ast_tuple", "descriptive", "names", "." ]
[ "\"\"\" Translate numeric grammar symbols in an ast_tuple descriptive names.\n\n This simply traverses the tree converting any integer value to values\n found in symbol.sym_name or token.tok_name.\n \"\"\"" ]
[ { "param": "ast_tuple", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ast_tuple", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
ast_to_string
<not_specific>
def ast_to_string(ast_seq): """* Traverse an ast tree sequence, printing out all leaf nodes. This effectively rebuilds the expression the tree was built from. I guess its probably missing whitespace. How bout indent stuff and new lines? Haven't checked this since we're curren...
* Traverse an ast tree sequence, printing out all leaf nodes. This effectively rebuilds the expression the tree was built from. I guess its probably missing whitespace. How bout indent stuff and new lines? Haven't checked this since we're currently only dealing with simple expres...
Traverse an ast tree sequence, printing out all leaf nodes. This effectively rebuilds the expression the tree was built from. I guess its probably missing whitespace. How bout indent stuff and new lines. Haven't checked this since we're currently only dealing with simple expressions.
[ "Traverse", "an", "ast", "tree", "sequence", "printing", "out", "all", "leaf", "nodes", ".", "This", "effectively", "rebuilds", "the", "expression", "the", "tree", "was", "built", "from", ".", "I", "guess", "its", "probably", "missing", "whitespace", ".", "H...
def ast_to_string(ast_seq): output = '' for item in ast_seq: if isinstance(item, str): output = output + item elif issequence(item): output = output + ast_to_string(item) return output
[ "def", "ast_to_string", "(", "ast_seq", ")", ":", "output", "=", "''", "for", "item", "in", "ast_seq", ":", "if", "isinstance", "(", "item", ",", "str", ")", ":", "output", "=", "output", "+", "item", "elif", "issequence", "(", "item", ")", ":", "out...
Traverse an ast tree sequence, printing out all leaf nodes.
[ "Traverse", "an", "ast", "tree", "sequence", "printing", "out", "all", "leaf", "nodes", "." ]
[ "\"\"\"* Traverse an ast tree sequence, printing out all leaf nodes.\n\n This effectively rebuilds the expression the tree was built\n from. I guess its probably missing whitespace. How bout\n indent stuff and new lines? Haven't checked this since we're\n currently only dealing wi...
[ { "param": "ast_seq", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ast_seq", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
build_atom
<not_specific>
def build_atom(expr_string): """ Build an ast for an atom from the given expr string. If expr_string is not a string, it is converted to a string before parsing to an ast_tuple. """ # the [1][1] indexing below starts atoms at the third level # deep in the resulting parse tree. parser.e...
Build an ast for an atom from the given expr string. If expr_string is not a string, it is converted to a string before parsing to an ast_tuple.
Build an ast for an atom from the given expr string. If expr_string is not a string, it is converted to a string before parsing to an ast_tuple.
[ "Build", "an", "ast", "for", "an", "atom", "from", "the", "given", "expr", "string", ".", "If", "expr_string", "is", "not", "a", "string", "it", "is", "converted", "to", "a", "string", "before", "parsing", "to", "an", "ast_tuple", "." ]
def build_atom(expr_string): if isinstance(expr_string, str): ast = parser.expr(expr_string).totuple()[1][1] else: ast = parser.expr(repr(expr_string)).totuple()[1][1] return ast
[ "def", "build_atom", "(", "expr_string", ")", ":", "if", "isinstance", "(", "expr_string", ",", "str", ")", ":", "ast", "=", "parser", ".", "expr", "(", "expr_string", ")", ".", "totuple", "(", ")", "[", "1", "]", "[", "1", "]", "else", ":", "ast",...
Build an ast for an atom from the given expr string.
[ "Build", "an", "ast", "for", "an", "atom", "from", "the", "given", "expr", "string", "." ]
[ "\"\"\" Build an ast for an atom from the given expr string.\n\n If expr_string is not a string, it is converted to a string\n before parsing to an ast_tuple.\n \"\"\"", "# the [1][1] indexing below starts atoms at the third level", "# deep in the resulting parse tree. parser.expr will return"...
[ { "param": "expr_string", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "expr_string", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
harvest_variables
<not_specific>
def harvest_variables(ast_list): """ Retrieve all the variables that need to be defined. """ variables = [] if issequence(ast_list): found,data = match(name_pattern,ast_list) if found: variables.append(data['var']) for item in ast_list: if issequence(item)...
Retrieve all the variables that need to be defined.
Retrieve all the variables that need to be defined.
[ "Retrieve", "all", "the", "variables", "that", "need", "to", "be", "defined", "." ]
def harvest_variables(ast_list): variables = [] if issequence(ast_list): found,data = match(name_pattern,ast_list) if found: variables.append(data['var']) for item in ast_list: if issequence(item): variables.extend(harvest_variables(item)) vari...
[ "def", "harvest_variables", "(", "ast_list", ")", ":", "variables", "=", "[", "]", "if", "issequence", "(", "ast_list", ")", ":", "found", ",", "data", "=", "match", "(", "name_pattern", ",", "ast_list", ")", "if", "found", ":", "variables", ".", "append...
Retrieve all the variables that need to be defined.
[ "Retrieve", "all", "the", "variables", "that", "need", "to", "be", "defined", "." ]
[ "\"\"\" Retrieve all the variables that need to be defined.\n \"\"\"" ]
[ { "param": "ast_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ast_list", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
match
<not_specific>
def match(pattern, data, vars=None): """match `data' to `pattern', with variable extraction. pattern Pattern to match against, possibly containing variables. data Data to be checked and against which variables are extracted. vars Dictionary of variables which have already been...
match `data' to `pattern', with variable extraction. pattern Pattern to match against, possibly containing variables. data Data to be checked and against which variables are extracted. vars Dictionary of variables which have already been found. If not provided, an empty d...
match `data' to `pattern', with variable extraction. pattern Pattern to match against, possibly containing variables. data Data to be checked and against which variables are extracted. vars Dictionary of variables which have already been found. If not provided, an empty dictionary is created. The `pattern' value ma...
[ "match", "`", "data", "'", "to", "`", "pattern", "'", "with", "variable", "extraction", ".", "pattern", "Pattern", "to", "match", "against", "possibly", "containing", "variables", ".", "data", "Data", "to", "be", "checked", "and", "against", "which", "variab...
def match(pattern, data, vars=None): if vars is None: vars = {} if isinstance(pattern, list): vars[pattern[0]] = data return 1, vars if not isinstance(pattern, tuple): return (pattern == data), vars if len(data) != len(pattern): return 0, vars for patte...
[ "def", "match", "(", "pattern", ",", "data", ",", "vars", "=", "None", ")", ":", "if", "vars", "is", "None", ":", "vars", "=", "{", "}", "if", "isinstance", "(", "pattern", ",", "list", ")", ":", "vars", "[", "pattern", "[", "0", "]", "]", "=",...
match `data' to `pattern', with variable extraction.
[ "match", "`", "data", "'", "to", "`", "pattern", "'", "with", "variable", "extraction", "." ]
[ "\"\"\"match `data' to `pattern', with variable extraction.\n\n pattern\n Pattern to match against, possibly containing variables.\n\n data\n Data to be checked and against which variables are extracted.\n\n vars\n Dictionary of variables which have already been found. If not\n ...
[ { "param": "pattern", "type": null }, { "param": "data", "type": null }, { "param": "vars", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pattern", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": null, "docstring": null, "docstring_tokens"...
dbce71cd22995c0dbe76ecb3a74474942e51e904
larsmans/scipy
scipy/weave/ast_tools.py
[ "BSD-3-Clause" ]
Python
tuples_to_lists
<not_specific>
def tuples_to_lists(ast_tuple): """ Convert an ast object tree in tuple form to list form. """ if not issequence(ast_tuple): return ast_tuple new_list = [] for item in ast_tuple: new_list.append(tuples_to_lists(item)) return new_list
Convert an ast object tree in tuple form to list form.
Convert an ast object tree in tuple form to list form.
[ "Convert", "an", "ast", "object", "tree", "in", "tuple", "form", "to", "list", "form", "." ]
def tuples_to_lists(ast_tuple): if not issequence(ast_tuple): return ast_tuple new_list = [] for item in ast_tuple: new_list.append(tuples_to_lists(item)) return new_list
[ "def", "tuples_to_lists", "(", "ast_tuple", ")", ":", "if", "not", "issequence", "(", "ast_tuple", ")", ":", "return", "ast_tuple", "new_list", "=", "[", "]", "for", "item", "in", "ast_tuple", ":", "new_list", ".", "append", "(", "tuples_to_lists", "(", "i...
Convert an ast object tree in tuple form to list form.
[ "Convert", "an", "ast", "object", "tree", "in", "tuple", "form", "to", "list", "form", "." ]
[ "\"\"\" Convert an ast object tree in tuple form to list form.\n \"\"\"" ]
[ { "param": "ast_tuple", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ast_tuple", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5217559f50e9f858e138c5a105a6d3e90d73208a
larsmans/scipy
tools/refguide_check.py
[ "BSD-3-Clause" ]
Python
short_path
<not_specific>
def short_path(path, cwd=None): """ Return relative or absolute path name, whichever is shortest. """ if not isinstance(path, str): return path if cwd is None: cwd = os.getcwd() abspath = os.path.abspath(path) relpath = os.path.relpath(path, cwd) if len(abspath) <= len(re...
Return relative or absolute path name, whichever is shortest.
Return relative or absolute path name, whichever is shortest.
[ "Return", "relative", "or", "absolute", "path", "name", "whichever", "is", "shortest", "." ]
def short_path(path, cwd=None): if not isinstance(path, str): return path if cwd is None: cwd = os.getcwd() abspath = os.path.abspath(path) relpath = os.path.relpath(path, cwd) if len(abspath) <= len(relpath): return abspath return relpath
[ "def", "short_path", "(", "path", ",", "cwd", "=", "None", ")", ":", "if", "not", "isinstance", "(", "path", ",", "str", ")", ":", "return", "path", "if", "cwd", "is", "None", ":", "cwd", "=", "os", ".", "getcwd", "(", ")", "abspath", "=", "os", ...
Return relative or absolute path name, whichever is shortest.
[ "Return", "relative", "or", "absolute", "path", "name", "whichever", "is", "shortest", "." ]
[ "\"\"\"\n Return relative or absolute path name, whichever is shortest.\n \"\"\"" ]
[ { "param": "path", "type": null }, { "param": "cwd", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cwd", "type": null, "docstring": null, "docstring_tokens": []...
143936431ab406f6b901963d1b68a8dbfaa91c5f
larsmans/scipy
tools/win32/detect_cpu_extensions_wine.py
[ "BSD-3-Clause" ]
Python
write_summary
null
def write_summary(allcodes): """Write a summary of all found codes to stdout.""" print """\n ---------------------------------------------------------------------------- Checked all binary files for CPU extension codes. Found the following codes:""" for code in allcodes: print code print """ ---...
Write a summary of all found codes to stdout.
Write a summary of all found codes to stdout.
[ "Write", "a", "summary", "of", "all", "found", "codes", "to", "stdout", "." ]
def write_summary(allcodes): print """\n ---------------------------------------------------------------------------- Checked all binary files for CPU extension codes. Found the following codes:""" for code in allcodes: print code print """ -----------------------------------------------------------...
[ "def", "write_summary", "(", "allcodes", ")", ":", "print", "\"\"\"\\n\n----------------------------------------------------------------------------\nChecked all binary files for CPU extension codes. Found the following codes:\"\"\"", "for", "code", "in", "allcodes", ":", "print", "code"...
Write a summary of all found codes to stdout.
[ "Write", "a", "summary", "of", "all", "found", "codes", "to", "stdout", "." ]
[ "\"\"\"Write a summary of all found codes to stdout.\"\"\"" ]
[ { "param": "allcodes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "allcodes", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
32fe9f8c0bebcd638557a82c1b221021da135544
larsmans/scipy
scipy/io/tests/test_netcdf.py
[ "BSD-3-Clause" ]
Python
assert_mask_matches
null
def assert_mask_matches(arr, expected_mask): ''' Asserts that the mask of arr is effectively the same as expected_mask. In contrast to numpy.ma.testutils.assert_mask_equal, this function allows testing the 'mask' of a standard numpy array (the mask in this case is treated as all False). Parame...
Asserts that the mask of arr is effectively the same as expected_mask. In contrast to numpy.ma.testutils.assert_mask_equal, this function allows testing the 'mask' of a standard numpy array (the mask in this case is treated as all False). Parameters ---------- arr: ndarray or MaskedArray ...
Asserts that the mask of arr is effectively the same as expected_mask. In contrast to numpy.ma.testutils.assert_mask_equal, this function allows testing the 'mask' of a standard numpy array (the mask in this case is treated as all False). Parameters ndarray or MaskedArray Array to test. expected_mask: array_like of b...
[ "Asserts", "that", "the", "mask", "of", "arr", "is", "effectively", "the", "same", "as", "expected_mask", ".", "In", "contrast", "to", "numpy", ".", "ma", ".", "testutils", ".", "assert_mask_equal", "this", "function", "allows", "testing", "the", "'", "mask"...
def assert_mask_matches(arr, expected_mask): mask = np.ma.getmaskarray(arr) assert_equal(mask, expected_mask)
[ "def", "assert_mask_matches", "(", "arr", ",", "expected_mask", ")", ":", "mask", "=", "np", ".", "ma", ".", "getmaskarray", "(", "arr", ")", "assert_equal", "(", "mask", ",", "expected_mask", ")" ]
Asserts that the mask of arr is effectively the same as expected_mask.
[ "Asserts", "that", "the", "mask", "of", "arr", "is", "effectively", "the", "same", "as", "expected_mask", "." ]
[ "'''\n Asserts that the mask of arr is effectively the same as expected_mask.\n\n In contrast to numpy.ma.testutils.assert_mask_equal, this function allows\n testing the 'mask' of a standard numpy array (the mask in this case is treated\n as all False).\n\n Parameters\n ----------\n arr: ndarra...
[ { "param": "arr", "type": null }, { "param": "expected_mask", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "arr", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expected_mask", "type": null, "docstring": null, "docstring_to...
7316aec2ec1169df62cd81e0786400c7c233fd90
larsmans/scipy
scipy/io/mmio.py
[ "BSD-3-Clause" ]
Python
_open
<not_specific>
def _open(filespec, mode='rb'): """ Return an open file stream for reading based on source. If source is a file name, open it (after trying to find it with mtx and gzipped mtx extensions). Otherwise, just return source. Parameters ---------- filespec : str or file-like...
Return an open file stream for reading based on source. If source is a file name, open it (after trying to find it with mtx and gzipped mtx extensions). Otherwise, just return source. Parameters ---------- filespec : str or file-like String giving file name or fil...
Return an open file stream for reading based on source. If source is a file name, open it (after trying to find it with mtx and gzipped mtx extensions). Otherwise, just return source. Parameters filespec : str or file-like String giving file name or file-like object mode : str, optional Mode with which to open file,...
[ "Return", "an", "open", "file", "stream", "for", "reading", "based", "on", "source", ".", "If", "source", "is", "a", "file", "name", "open", "it", "(", "after", "trying", "to", "find", "it", "with", "mtx", "and", "gzipped", "mtx", "extensions", ")", "....
def _open(filespec, mode='rb'): close_it = False if isinstance(filespec, string_types): close_it = True if mode[0] == 'r': if not os.path.isfile(filespec): if os.path.isfile(filespec+'.mtx'): filespec = filespec + '.mtx'...
[ "def", "_open", "(", "filespec", ",", "mode", "=", "'rb'", ")", ":", "close_it", "=", "False", "if", "isinstance", "(", "filespec", ",", "string_types", ")", ":", "close_it", "=", "True", "if", "mode", "[", "0", "]", "==", "'r'", ":", "if", "not", ...
Return an open file stream for reading based on source.
[ "Return", "an", "open", "file", "stream", "for", "reading", "based", "on", "source", "." ]
[ "\"\"\" Return an open file stream for reading based on source.\n\n If source is a file name, open it (after trying to find it with mtx and\n gzipped mtx extensions). Otherwise, just return source.\n\n Parameters\n ----------\n filespec : str or file-like\n String givi...
[ { "param": "filespec", "type": null }, { "param": "mode", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filespec", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mode", "type": null, "docstring": null, "docstring_tokens...
17a157c607e1ae2e6cb60b4372470a5148e9d70b
larsmans/scipy
scipy/io/wavfile.py
[ "BSD-3-Clause" ]
Python
read
<not_specific>
def read(filename, mmap=False): """ Return the sample rate (in samples/sec) and data from a WAV file Parameters ---------- filename : string or open file handle Input wav file. mmap : bool, optional Whether to read data as memory mapped. Only to be used on real files (De...
Return the sample rate (in samples/sec) and data from a WAV file Parameters ---------- filename : string or open file handle Input wav file. mmap : bool, optional Whether to read data as memory mapped. Only to be used on real files (Default: False) .. versionadded:...
Return the sample rate (in samples/sec) and data from a WAV file Parameters filename : string or open file handle Input wav file. mmap : bool, optional Whether to read data as memory mapped. Only to be used on real files (Default: False) Returns rate : int Sample rate of wav file data : numpy array Data read from ...
[ "Return", "the", "sample", "rate", "(", "in", "samples", "/", "sec", ")", "and", "data", "from", "a", "WAV", "file", "Parameters", "filename", ":", "string", "or", "open", "file", "handle", "Input", "wav", "file", ".", "mmap", ":", "bool", "optional", ...
def read(filename, mmap=False): if hasattr(filename, 'read'): fid = filename mmap = False else: fid = open(filename, 'rb') try: fsize, is_big_endian = _read_riff_chunk(fid) fmt_chunk_received = False noc = 1 bits = 8 comp = WAVE_FORMAT_PCM ...
[ "def", "read", "(", "filename", ",", "mmap", "=", "False", ")", ":", "if", "hasattr", "(", "filename", ",", "'read'", ")", ":", "fid", "=", "filename", "mmap", "=", "False", "else", ":", "fid", "=", "open", "(", "filename", ",", "'rb'", ")", "try",...
Return the sample rate (in samples/sec) and data from a WAV file Parameters
[ "Return", "the", "sample", "rate", "(", "in", "samples", "/", "sec", ")", "and", "data", "from", "a", "WAV", "file", "Parameters" ]
[ "\"\"\"\n Return the sample rate (in samples/sec) and data from a WAV file\n\n Parameters\n ----------\n filename : string or open file handle\n Input wav file.\n mmap : bool, optional\n Whether to read data as memory mapped.\n Only to be used on real files (Default: False)\n\n ...
[ { "param": "filename", "type": null }, { "param": "mmap", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mmap", "type": null, "docstring": null, "docstring_tokens...
a8b5a05c6a9c6124da33a38151b1d0d5eed989d3
larsmans/scipy
scipy/io/matlab/tests/test_mio5_utils.py
[ "BSD-3-Clause" ]
Python
_make_tag
<not_specific>
def _make_tag(base_dt, val, mdtype, sde=False): ''' Makes a simple matlab tag, full or sde ''' base_dt = np.dtype(base_dt) bo = boc.to_numpy_code(base_dt.byteorder) byte_count = base_dt.itemsize if not sde: udt = bo + 'u4' padding = 8 - (byte_count % 8) all_dt = [('mdtype', u...
Makes a simple matlab tag, full or sde
Makes a simple matlab tag, full or sde
[ "Makes", "a", "simple", "matlab", "tag", "full", "or", "sde" ]
def _make_tag(base_dt, val, mdtype, sde=False): base_dt = np.dtype(base_dt) bo = boc.to_numpy_code(base_dt.byteorder) byte_count = base_dt.itemsize if not sde: udt = bo + 'u4' padding = 8 - (byte_count % 8) all_dt = [('mdtype', udt), ('byte_count', udt), ...
[ "def", "_make_tag", "(", "base_dt", ",", "val", ",", "mdtype", ",", "sde", "=", "False", ")", ":", "base_dt", "=", "np", ".", "dtype", "(", "base_dt", ")", "bo", "=", "boc", ".", "to_numpy_code", "(", "base_dt", ".", "byteorder", ")", "byte_count", "...
Makes a simple matlab tag, full or sde
[ "Makes", "a", "simple", "matlab", "tag", "full", "or", "sde" ]
[ "''' Makes a simple matlab tag, full or sde '''", "# is sde", "# little endian", "# big endian" ]
[ { "param": "base_dt", "type": null }, { "param": "val", "type": null }, { "param": "mdtype", "type": null }, { "param": "sde", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "base_dt", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val", "type": null, "docstring": null, "docstring_tokens":...
a15abfde09706ddbe6830f76a7865ac54c990366
larsmans/scipy
scipy/ndimage/_ni_support.py
[ "BSD-3-Clause" ]
Python
_normalize_sequence
<not_specific>
def _normalize_sequence(input, rank, array_type=None): """If input is a scalar, create a sequence of length equal to the rank by duplicating the input. If input is a sequence, check if its length is equal to the length of array. """ if hasattr(input, '__iter__'): normalized = list(input) ...
If input is a scalar, create a sequence of length equal to the rank by duplicating the input. If input is a sequence, check if its length is equal to the length of array.
If input is a scalar, create a sequence of length equal to the rank by duplicating the input. If input is a sequence, check if its length is equal to the length of array.
[ "If", "input", "is", "a", "scalar", "create", "a", "sequence", "of", "length", "equal", "to", "the", "rank", "by", "duplicating", "the", "input", ".", "If", "input", "is", "a", "sequence", "check", "if", "its", "length", "is", "equal", "to", "the", "le...
def _normalize_sequence(input, rank, array_type=None): if hasattr(input, '__iter__'): normalized = list(input) if len(normalized) != rank: err = "sequence argument must have length equal to input rank" raise RuntimeError(err) else: normalized = [input] * rank ...
[ "def", "_normalize_sequence", "(", "input", ",", "rank", ",", "array_type", "=", "None", ")", ":", "if", "hasattr", "(", "input", ",", "'__iter__'", ")", ":", "normalized", "=", "list", "(", "input", ")", "if", "len", "(", "normalized", ")", "!=", "ran...
If input is a scalar, create a sequence of length equal to the rank by duplicating the input.
[ "If", "input", "is", "a", "scalar", "create", "a", "sequence", "of", "length", "equal", "to", "the", "rank", "by", "duplicating", "the", "input", "." ]
[ "\"\"\"If input is a scalar, create a sequence of length equal to the\n rank by duplicating the input. If input is a sequence,\n check if its length is equal to the length of array.\n \"\"\"" ]
[ { "param": "input", "type": null }, { "param": "rank", "type": null }, { "param": "array_type", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rank", "type": null, "docstring": null, "docstring_tokens": ...
d023a16cdadb203f07636254267f5a4719a1f1a1
larsmans/scipy
scipy/stats/mstats_basic.py
[ "BSD-3-Clause" ]
Python
pearsonr
<not_specific>
def pearsonr(x,y): """ Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson's correlation requires that each dataset be normally distributed...
Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson's correlation requires that each dataset be normally distributed. Like other correlation ...
Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson's correlation requires that each dataset be normally distributed. Like other correlation coefficients, this one...
[ "Calculates", "a", "Pearson", "correlation", "coefficient", "and", "the", "p", "-", "value", "for", "testing", "non", "-", "correlation", ".", "The", "Pearson", "correlation", "coefficient", "measures", "the", "linear", "relationship", "between", "two", "datasets"...
def pearsonr(x,y): (x, y, n) = _chk_size(x, y) (x, y) = (x.ravel(), y.ravel()) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) n -= m.sum() df = n-2 if df < 0: return (masked, masked) (mx, my) = (x.mean(), y.mean()) (xm, ym) = (x-mx, y-my) r_num = ma.add.reduce(xm*ym) r_den ...
[ "def", "pearsonr", "(", "x", ",", "y", ")", ":", "(", "x", ",", "y", ",", "n", ")", "=", "_chk_size", "(", "x", ",", "y", ")", "(", "x", ",", "y", ")", "=", "(", "x", ".", "ravel", "(", ")", ",", "y", ".", "ravel", "(", ")", ")", "m",...
Calculates a Pearson correlation coefficient and the p-value for testing non-correlation.
[ "Calculates", "a", "Pearson", "correlation", "coefficient", "and", "the", "p", "-", "value", "for", "testing", "non", "-", "correlation", "." ]
[ "\"\"\"\n Calculates a Pearson correlation coefficient and the p-value for testing\n non-correlation.\n\n The Pearson correlation coefficient measures the linear relationship\n between two datasets. Strictly speaking, Pearson's correlation requires\n that each dataset be normally distributed. Like ot...
[ { "param": "x", "type": null }, { "param": "y", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": null, "docstring_tokens": [], ...
d023a16cdadb203f07636254267f5a4719a1f1a1
larsmans/scipy
scipy/stats/mstats_basic.py
[ "BSD-3-Clause" ]
Python
spearmanr
<not_specific>
def spearmanr(x, y, use_ties=True): """ Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. The Spearman correlation is a nonparametric measure of the linear relationship between two datasets. Unlike the Pearson correlation, the Spearman correla...
Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. The Spearman correlation is a nonparametric measure of the linear relationship between two datasets. Unlike the Pearson correlation, the Spearman correlation does not assume that both datasets are...
Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. The Spearman correlation is a nonparametric measure of the linear relationship between two datasets. Unlike the Pearson correlation, the Spearman correlation does not assume that both datasets are normally distributed...
[ "Calculates", "a", "Spearman", "rank", "-", "order", "correlation", "coefficient", "and", "the", "p", "-", "value", "to", "test", "for", "non", "-", "correlation", ".", "The", "Spearman", "correlation", "is", "a", "nonparametric", "measure", "of", "the", "li...
def spearmanr(x, y, use_ties=True): (x, y, n) = _chk_size(x, y) (x, y) = (x.ravel(), y.ravel()) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) n -= m.sum() if m is not nomask: x = ma.array(x, mask=m, copy=True) y = ma.array(y, mask=m, copy=True) df = n-2 if df < 0: rais...
[ "def", "spearmanr", "(", "x", ",", "y", ",", "use_ties", "=", "True", ")", ":", "(", "x", ",", "y", ",", "n", ")", "=", "_chk_size", "(", "x", ",", "y", ")", "(", "x", ",", "y", ")", "=", "(", "x", ".", "ravel", "(", ")", ",", "y", ".",...
Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation.
[ "Calculates", "a", "Spearman", "rank", "-", "order", "correlation", "coefficient", "and", "the", "p", "-", "value", "to", "test", "for", "non", "-", "correlation", "." ]
[ "\"\"\"\n Calculates a Spearman rank-order correlation coefficient and the p-value\n to test for non-correlation.\n\n The Spearman correlation is a nonparametric measure of the linear\n relationship between two datasets. Unlike the Pearson correlation, the\n Spearman correlation does not assume that ...
[ { "param": "x", "type": null }, { "param": "y", "type": null }, { "param": "use_ties", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": null, "docstring_tokens": [], ...
d023a16cdadb203f07636254267f5a4719a1f1a1
larsmans/scipy
scipy/stats/mstats_basic.py
[ "BSD-3-Clause" ]
Python
kendalltau_seasonal
<not_specific>
def kendalltau_seasonal(x): """ Computes a multivariate Kendall's rank correlation tau, for seasonal data. Parameters ---------- x : 2-D ndarray Array of seasonal data, with seasons in columns. """ x = ma.array(x, subok=True, copy=False, ndmin=2) (n,m) = x.shape n_p = x.cou...
Computes a multivariate Kendall's rank correlation tau, for seasonal data. Parameters ---------- x : 2-D ndarray Array of seasonal data, with seasons in columns.
Computes a multivariate Kendall's rank correlation tau, for seasonal data. Parameters x : 2-D ndarray Array of seasonal data, with seasons in columns.
[ "Computes", "a", "multivariate", "Kendall", "'", "s", "rank", "correlation", "tau", "for", "seasonal", "data", ".", "Parameters", "x", ":", "2", "-", "D", "ndarray", "Array", "of", "seasonal", "data", "with", "seasons", "in", "columns", "." ]
def kendalltau_seasonal(x): x = ma.array(x, subok=True, copy=False, ndmin=2) (n,m) = x.shape n_p = x.count(0) S_szn = np.sum(msign(x[i:]-x[i]).sum(0) for i in range(n)) S_tot = S_szn.sum() n_tot = x.count() ties = count_tied_groups(x.compressed()) corr_ties = np.sum(v*k*(k-1) for (k,v) i...
[ "def", "kendalltau_seasonal", "(", "x", ")", ":", "x", "=", "ma", ".", "array", "(", "x", ",", "subok", "=", "True", ",", "copy", "=", "False", ",", "ndmin", "=", "2", ")", "(", "n", ",", "m", ")", "=", "x", ".", "shape", "n_p", "=", "x", "...
Computes a multivariate Kendall's rank correlation tau, for seasonal data.
[ "Computes", "a", "multivariate", "Kendall", "'", "s", "rank", "correlation", "tau", "for", "seasonal", "data", "." ]
[ "\"\"\"\n Computes a multivariate Kendall's rank correlation tau, for seasonal data.\n\n Parameters\n ----------\n x : 2-D ndarray\n Array of seasonal data, with seasons in columns.\n\n \"\"\"" ]
[ { "param": "x", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
d023a16cdadb203f07636254267f5a4719a1f1a1
larsmans/scipy
scipy/stats/mstats_basic.py
[ "BSD-3-Clause" ]
Python
friedmanchisquare
<not_specific>
def friedmanchisquare(*args): """Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. Each input is considered a given group. Ideally, the ...
Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. Each input is considered a given group. Ideally, the number of treatments among each g...
Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. Each input is considered a given group. Ideally, the number of treatments among each group should be e...
[ "Friedman", "Chi", "-", "Square", "is", "a", "non", "-", "parametric", "one", "-", "way", "within", "-", "subjects", "ANOVA", ".", "This", "function", "calculates", "the", "Friedman", "Chi", "-", "square", "test", "for", "repeated", "measures", "and", "ret...
def friedmanchisquare(*args): data = argstoarray(*args).astype(float) k = len(data) if k < 3: raise ValueError("Less than 3 groups (%i): " % k + "the Friedman test is NOT appropriate.") ranked = ma.masked_values(rankdata(data, axis=0), 0) if ranked._mask is not nomas...
[ "def", "friedmanchisquare", "(", "*", "args", ")", ":", "data", "=", "argstoarray", "(", "*", "args", ")", ".", "astype", "(", "float", ")", "k", "=", "len", "(", "data", ")", "if", "k", "<", "3", ":", "raise", "ValueError", "(", "\"Less than 3 group...
Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA.
[ "Friedman", "Chi", "-", "Square", "is", "a", "non", "-", "parametric", "one", "-", "way", "within", "-", "subjects", "ANOVA", "." ]
[ "\"\"\"Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA.\n This function calculates the Friedman Chi-square test for repeated measures\n and returns the result, along with the associated probability value.\n\n Each input is considered a given group. Ideally, the number of treatments\n...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
0046cc2f7e1d59ebfeb9441ba2dd7e95c8d81ba7
larsmans/scipy
scipy/io/matlab/mio5.py
[ "BSD-3-Clause" ]
Python
varmats_from_mat
<not_specific>
def varmats_from_mat(file_obj): """ Pull variables out of mat 5 file as a sequence of mat file objects This can be useful with a difficult mat file, containing unreadable variables. This routine pulls the variables out in raw form and puts them, unread, back into a file stream for saving or reading. ...
Pull variables out of mat 5 file as a sequence of mat file objects This can be useful with a difficult mat file, containing unreadable variables. This routine pulls the variables out in raw form and puts them, unread, back into a file stream for saving or reading. Another use is the pathological cas...
Pull variables out of mat 5 file as a sequence of mat file objects This can be useful with a difficult mat file, containing unreadable variables. This routine pulls the variables out in raw form and puts them, unread, back into a file stream for saving or reading. Another use is the pathological case where there is m...
[ "Pull", "variables", "out", "of", "mat", "5", "file", "as", "a", "sequence", "of", "mat", "file", "objects", "This", "can", "be", "useful", "with", "a", "difficult", "mat", "file", "containing", "unreadable", "variables", ".", "This", "routine", "pulls", "...
def varmats_from_mat(file_obj): rdr = MatFile5Reader(file_obj) file_obj.seek(0) hdr_len = MDTYPES[native_code]['dtypes']['file_header'].itemsize raw_hdr = file_obj.read(hdr_len) file_obj.seek(0) rdr.initialize_read() mdict = rdr.read_file_header() next_position = file_obj.tell() name...
[ "def", "varmats_from_mat", "(", "file_obj", ")", ":", "rdr", "=", "MatFile5Reader", "(", "file_obj", ")", "file_obj", ".", "seek", "(", "0", ")", "hdr_len", "=", "MDTYPES", "[", "native_code", "]", "[", "'dtypes'", "]", "[", "'file_header'", "]", ".", "i...
Pull variables out of mat 5 file as a sequence of mat file objects This can be useful with a difficult mat file, containing unreadable variables.
[ "Pull", "variables", "out", "of", "mat", "5", "file", "as", "a", "sequence", "of", "mat", "file", "objects", "This", "can", "be", "useful", "with", "a", "difficult", "mat", "file", "containing", "unreadable", "variables", "." ]
[ "\"\"\" Pull variables out of mat 5 file as a sequence of mat file objects\n\n This can be useful with a difficult mat file, containing unreadable\n variables. This routine pulls the variables out in raw form and puts them,\n unread, back into a file stream for saving or reading. Another use is the\n ...
[ { "param": "file_obj", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0046cc2f7e1d59ebfeb9441ba2dd7e95c8d81ba7
larsmans/scipy
scipy/io/matlab/mio5.py
[ "BSD-3-Clause" ]
Python
to_writeable
<not_specific>
def to_writeable(source): ''' Convert input object ``source`` to something we can write Parameters ---------- source : object Returns ------- arr : None or ndarray or EmptyStructMarker If `source` cannot be converted to something we can write to a matfile, return None. If ...
Convert input object ``source`` to something we can write Parameters ---------- source : object Returns ------- arr : None or ndarray or EmptyStructMarker If `source` cannot be converted to something we can write to a matfile, return None. If `source` is equivalent to an empt...
Convert input object ``source`` to something we can write Parameters source : object Returns arr : None or ndarray or EmptyStructMarker If `source` cannot be converted to something we can write to a matfile, return None.
[ "Convert", "input", "object", "`", "`", "source", "`", "`", "to", "something", "we", "can", "write", "Parameters", "source", ":", "object", "Returns", "arr", ":", "None", "or", "ndarray", "or", "EmptyStructMarker", "If", "`", "source", "`", "cannot", "be",...
def to_writeable(source): if isinstance(source, np.ndarray): return source if source is None: return None is_mapping = (hasattr(source, 'keys') and hasattr(source, 'values') and hasattr(source, 'items')) if not is_mapping and hasattr(source, '__dict__'): source ...
[ "def", "to_writeable", "(", "source", ")", ":", "if", "isinstance", "(", "source", ",", "np", ".", "ndarray", ")", ":", "return", "source", "if", "source", "is", "None", ":", "return", "None", "is_mapping", "=", "(", "hasattr", "(", "source", ",", "'ke...
Convert input object ``source`` to something we can write Parameters
[ "Convert", "input", "object", "`", "`", "source", "`", "`", "to", "something", "we", "can", "write", "Parameters" ]
[ "''' Convert input object ``source`` to something we can write\n\n Parameters\n ----------\n source : object\n\n Returns\n -------\n arr : None or ndarray or EmptyStructMarker\n If `source` cannot be converted to something we can write to a matfile,\n return None. If `source` is equ...
[ { "param": "source", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "source", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ce284fcb2f1e032a25257bafb4c5149d1092718
larsmans/scipy
scipy/ndimage/interpolation.py
[ "BSD-3-Clause" ]
Python
zoom
<not_specific>
def zoom(input, zoom, output=None, order=3, mode='constant', cval=0.0, prefilter=True): """ Zoom an array. The array is zoomed using spline interpolation of the requested order. Parameters ---------- input : ndarray The input array. zoom : float or sequence, optional ...
Zoom an array. The array is zoomed using spline interpolation of the requested order. Parameters ---------- input : ndarray The input array. zoom : float or sequence, optional The zoom factor along the axes. If a float, `zoom` is the same for each axis. If a sequence, ...
Zoom an array. The array is zoomed using spline interpolation of the requested order. Parameters input : ndarray The input array. zoom : float or sequence, optional The zoom factor along the axes. If a float, `zoom` is the same for each axis. If a sequence, `zoom` should contain one value for each axis. output : ndar...
[ "Zoom", "an", "array", ".", "The", "array", "is", "zoomed", "using", "spline", "interpolation", "of", "the", "requested", "order", ".", "Parameters", "input", ":", "ndarray", "The", "input", "array", ".", "zoom", ":", "float", "or", "sequence", "optional", ...
def zoom(input, zoom, output=None, order=3, mode='constant', cval=0.0, prefilter=True): if order < 0 or order > 5: raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): raise TypeError('Complex type not supported') if input.n...
[ "def", "zoom", "(", "input", ",", "zoom", ",", "output", "=", "None", ",", "order", "=", "3", ",", "mode", "=", "'constant'", ",", "cval", "=", "0.0", ",", "prefilter", "=", "True", ")", ":", "if", "order", "<", "0", "or", "order", ">", "5", ":...
Zoom an array.
[ "Zoom", "an", "array", "." ]
[ "\"\"\"\n Zoom an array.\n\n The array is zoomed using spline interpolation of the requested order.\n\n Parameters\n ----------\n input : ndarray\n The input array.\n zoom : float or sequence, optional\n The zoom factor along the axes. If a float, `zoom` is the same for each\n ...
[ { "param": "input", "type": null }, { "param": "zoom", "type": null }, { "param": "output", "type": null }, { "param": "order", "type": null }, { "param": "mode", "type": null }, { "param": "cval", "type": null }, { "param": "prefilter", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "input", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "zoom", "type": null, "docstring": null, "docstring_tokens": ...
05e032ff4cef217c141609f8c5a501f71cf9acfb
isabella232/reddit-slackbot
main.py
[ "MIT" ]
Python
update_slack
null
def update_slack(submissions): """ Updating Slack with new submissions. :param submissions: new submissions """ for submission in submissions: submission_date = time.strftime( '%H:%M %d/%m', time.gmtime(int(submission.created_utc) + TWO_DAYS) ) message = '*<{}|{...
Updating Slack with new submissions. :param submissions: new submissions
Updating Slack with new submissions.
[ "Updating", "Slack", "with", "new", "submissions", "." ]
def update_slack(submissions): for submission in submissions: submission_date = time.strftime( '%H:%M %d/%m', time.gmtime(int(submission.created_utc) + TWO_DAYS) ) message = '*<{}|{}>*\n*Subreddit*: {}\n*Date*: {}\n{}'.format( submission.url, submission.ti...
[ "def", "update_slack", "(", "submissions", ")", ":", "for", "submission", "in", "submissions", ":", "submission_date", "=", "time", ".", "strftime", "(", "'%H:%M %d/%m'", ",", "time", ".", "gmtime", "(", "int", "(", "submission", ".", "created_utc", ")", "+"...
Updating Slack with new submissions.
[ "Updating", "Slack", "with", "new", "submissions", "." ]
[ "\"\"\"\n Updating Slack with new submissions.\n :param submissions: new submissions\n \"\"\"" ]
[ { "param": "submissions", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "submissions", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
74d5c9e16ad4fde24988dd2aa391eba5e95f3d66
jan94/Adafruit_CircuitPython_MPU6050_Calibration
adafruit_mpu6050.py
[ "Unlicense", "MIT-0", "MIT" ]
Python
perform_calibration
Tuple[int, int, int, int, int, int]
def perform_calibration(self, averaging_size: int = 1000, discarding_size: int = 100, accelerometer_tolerance: int = 8, gyroscope_tolerance: int = 1, accelerometer_step: int = 8, ...
This method calculates the sensor offsets for the accelerometer and gyroscope by averaging values while the sensor is NOT in motion and the PCB is placed on a flat surface, facing upwards. (Be aware of the fact, that the calibration offsets are not persistent, they have to be set ma...
This method calculates the sensor offsets for the accelerometer and gyroscope by averaging values while the sensor is NOT in motion and the PCB is placed on a flat surface, facing upwards. (Be aware of the fact, that the calibration offsets are not persistent, they have to be set manually, after each new i2c connection...
[ "This", "method", "calculates", "the", "sensor", "offsets", "for", "the", "accelerometer", "and", "gyroscope", "by", "averaging", "values", "while", "the", "sensor", "is", "NOT", "in", "motion", "and", "the", "PCB", "is", "placed", "on", "a", "flat", "surfac...
def perform_calibration(self, averaging_size: int = 1000, discarding_size: int = 100, accelerometer_tolerance: int = 8, gyroscope_tolerance: int = 1, accelerometer_step: int = 8, ...
[ "def", "perform_calibration", "(", "self", ",", "averaging_size", ":", "int", "=", "1000", ",", "discarding_size", ":", "int", "=", "100", ",", "accelerometer_tolerance", ":", "int", "=", "8", ",", "gyroscope_tolerance", ":", "int", "=", "1", ",", "accelerom...
This method calculates the sensor offsets for the accelerometer and gyroscope by averaging values while the sensor is NOT in motion and the PCB is placed on a flat surface, facing upwards.
[ "This", "method", "calculates", "the", "sensor", "offsets", "for", "the", "accelerometer", "and", "gyroscope", "by", "averaging", "values", "while", "the", "sensor", "is", "NOT", "in", "motion", "and", "the", "PCB", "is", "placed", "on", "a", "flat", "surfac...
[ "\"\"\"\n This method calculates the sensor offsets for the accelerometer and gyroscope by averaging values\n while the sensor is NOT in motion and the PCB is placed on a flat surface, facing upwards.\n (Be aware of the fact, that the calibration offsets are not persistent,\n they ha...
[ { "param": "self", "type": null }, { "param": "averaging_size", "type": "int" }, { "param": "discarding_size", "type": "int" }, { "param": "accelerometer_tolerance", "type": "int" }, { "param": "gyroscope_tolerance", "type": "int" }, { "param": "accele...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "averaging_size", "type": "int", "docstring": "Number of reading sen...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
updateParameters
<not_specific>
def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if parameters[0].value is True: parameters[1].enabled = False mxd = ...
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", ".", "This", "method", "is", "called", "whenever", "a", "parameter", "has", "been", "changed", "." ]
def updateParameters(self, parameters): if parameters[0].value is True: parameters[1].enabled = False mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "")[0] bkmkList = arcpy.mapping.ListBookmarks(mxd, "", df) parameter...
[ "def", "updateParameters", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "0", "]", ".", "value", "is", "True", ":", "parameters", "[", "1", "]", ".", "enabled", "=", "False", "mxd", "=", "arcpy", ".", "mapping", ".", "MapDocument",...
Modify the values and properties of parameters before internal validation is performed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", "." ]
[ "\"\"\"Modify the values and properties of parameters before internal\n validation is performed. This method is called whenever a parameter\n has been changed.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
updateMessages
<not_specific>
def updateMessages(self, parameters): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" if parameters[1].altered: if len(parameters[3].filter.list) == 0: parameters[1].setErrorMessage("T...
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", ".", "This", "method", "is", "called", "after", "internal", "validation", "." ]
def updateMessages(self, parameters): if parameters[1].altered: if len(parameters[3].filter.list) == 0: parameters[1].setErrorMessage("This map document has no bookmarks!") if parameters[0].altered & parameters[0].value is True: if len(parameters[3].filter.list) =...
[ "def", "updateMessages", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "1", "]", ".", "altered", ":", "if", "len", "(", "parameters", "[", "3", "]", ".", "filter", ".", "list", ")", "==", "0", ":", "parameters", "[", "1", "]", ...
Modify the messages created by internal validation for each tool parameter.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", "." ]
[ "\"\"\"Modify the messages created by internal validation for each tool\n parameter. This method is called after internal validation.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
execute
<not_specific>
def execute(self, parameters, messages): """The source code of the tool.""" # get necessary input parameters if parameters[0].value is True: mxdFile = "CURRENT" else: mxdFile = parameters[1].valueAsText outLocation = parameters[2].valueAsText expo...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): if parameters[0].value is True: mxdFile = "CURRENT" else: mxdFile = parameters[1].valueAsText outLocation = parameters[2].valueAsText exportList = parameters[3].valueAsText exportLayout = parameters[4].value ...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "if", "parameters", "[", "0", "]", ".", "value", "is", "True", ":", "mxdFile", "=", "\"CURRENT\"", "else", ":", "mxdFile", "=", "parameters", "[", "1", "]", ".", "valueAsText"...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# get necessary input parameters" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
updateParameters
<not_specific>
def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if parameters[0].altered: mxd = arcpy.mapping.MapDocument(str(parameters[0].valu...
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", ".", "This", "method", "is", "called", "whenever", "a", "parameter", "has", "been", "changed", "." ]
def updateParameters(self, parameters): if parameters[0].altered: mxd = arcpy.mapping.MapDocument(str(parameters[0].value)) totalPages = mxd.dataDrivenPages.pageCount exportList = [] for page in range(1, totalPages + 1): mxd.dataDrivenPages.current...
[ "def", "updateParameters", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "0", "]", ".", "altered", ":", "mxd", "=", "arcpy", ".", "mapping", ".", "MapDocument", "(", "str", "(", "parameters", "[", "0", "]", ".", "value", ")", ")"...
Modify the values and properties of parameters before internal validation is performed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", "." ]
[ "\"\"\"Modify the values and properties of parameters before internal\n validation is performed. This method is called whenever a parameter\n has been changed.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
execute
null
def execute(self, parameters, messages): """The source code of the tool.""" mapFile = parameters[0].valueAsText outDir = parameters[1].valueAsText exportList = parameters[2].valueAsText outFormat = parameters[3].value # open mxd for reading mxd = arcpy.mapping.Map...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): mapFile = parameters[0].valueAsText outDir = parameters[1].valueAsText exportList = parameters[2].valueAsText outFormat = parameters[3].value mxd = arcpy.mapping.MapDocument(mapFile) totalPages = mxd.dataDrivenPages.pageCount ...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "mapFile", "=", "parameters", "[", "0", "]", ".", "valueAsText", "outDir", "=", "parameters", "[", "1", "]", ".", "valueAsText", "exportList", "=", "parameters", "[", "2", "]", ...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# open mxd for reading", "# loop through list of pages" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
fb056efe2fa74b09b60de9a60dc5cec3bc043185
itsalidag/arcgis-python-toolbox
MapExportTools.py
[ "MIT" ]
Python
execute
null
def execute(self, parameters, messages): """The source code of the tool.""" import os source = parameters[0].valueAsText destination = parameters[1].valueAsText outFormat = parameters[2].valueAsText for root, dirs, files, in os.walk(source): for fname in fil...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): import os source = parameters[0].valueAsText destination = parameters[1].valueAsText outFormat = parameters[2].valueAsText for root, dirs, files, in os.walk(source): for fname in files: if fname[-3:] in ["mxd", ...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "import", "os", "source", "=", "parameters", "[", "0", "]", ".", "valueAsText", "destination", "=", "parameters", "[", "1", "]", ".", "valueAsText", "outFormat", "=", "parameters"...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# loop for mxd files", "# make files and export" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
ebe6c0a141ea375fc52dcc41ca732988da5f9208
itsalidag/arcgis-python-toolbox
DataTools.py
[ "MIT" ]
Python
execute
null
def execute(self, parameters, messages): """The source code of the tool.""" source = parameters[0].valueAsText referenceScale = parameters[1].value coordinateSystem = parameters[2].valueAsText import os # make a file gdb in source arcpy.CreateFileGDB_management(so...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): source = parameters[0].valueAsText referenceScale = parameters[1].value coordinateSystem = parameters[2].valueAsText import os arcpy.CreateFileGDB_management(source, "CAD2FGDB.gdb") for root, dirs, files in os.walk(source): ...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "source", "=", "parameters", "[", "0", "]", ".", "valueAsText", "referenceScale", "=", "parameters", "[", "1", "]", ".", "value", "coordinateSystem", "=", "parameters", "[", "2", ...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# make a file gdb in source", "# check for illegal characters in name", "# rename file if illegal characters found" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
updateParameters
<not_specific>
def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if parameters[1].altered: if parameters[1].value is True: parame...
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", ".", "This", "method", "is", "called", "whenever", "a", "parameter", "has", "been", "changed", "." ]
def updateParameters(self, parameters): if parameters[1].altered: if parameters[1].value is True: parameters[2].enabled = True fieldList = [] for field in arcpy.ListFields(str(parameters[0].value)): fieldList.append(field.name) ...
[ "def", "updateParameters", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "1", "]", ".", "altered", ":", "if", "parameters", "[", "1", "]", ".", "value", "is", "True", ":", "parameters", "[", "2", "]", ".", "enabled", "=", "True",...
Modify the values and properties of parameters before internal validation is performed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", "." ]
[ "\"\"\"Modify the values and properties of parameters before internal\n validation is performed. This method is called whenever a parameter\n has been changed.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
updateMessages
<not_specific>
def updateMessages(self, parameters): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" # check for GeoPy package if parameters[3].value: import imp try: imp.find_mod...
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", ".", "This", "method", "is", "called", "after", "internal", "validation", "." ]
def updateMessages(self, parameters): if parameters[3].value: import imp try: imp.find_module("geopy") except ImportError: parameters[3].setErrorMessage("Your system does not have the GeoPy package installed! \n Click \"Show Help\" for addition...
[ "def", "updateMessages", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "3", "]", ".", "value", ":", "import", "imp", "try", ":", "imp", ".", "find_module", "(", "\"geopy\"", ")", "except", "ImportError", ":", "parameters", "[", "3", ...
Modify the messages created by internal validation for each tool parameter.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", "." ]
[ "\"\"\"Modify the messages created by internal validation for each tool\n parameter. This method is called after internal validation.\"\"\"", "# check for GeoPy package" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
execute
null
def execute(self, parameters, messages): """The source code of the tool.""" # get input feature inFeature = parameters[0].valueAsText addressExists = parameters[1].value addressField = parameters[2].valueAsText service = parameters[3].valueAsText # create the addr...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): inFeature = parameters[0].valueAsText addressExists = parameters[1].value addressField = parameters[2].valueAsText service = parameters[3].valueAsText if addressExists is False: arcpy.AddField_management(inFeature, "Address", "...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "inFeature", "=", "parameters", "[", "0", "]", ".", "valueAsText", "addressExists", "=", "parameters", "[", "1", "]", ".", "value", "addressField", "=", "parameters", "[", "2", ...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# get input feature", "# create the address field if it does not exist", "# search for addresses and populate field" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
updateParameters
<not_specific>
def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" if parameters[0].altered: fieldList = [] for field in arcpy.ListFiel...
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", ".", "This", "method", "is", "called", "whenever", "a", "parameter", "has", "been", "changed", "." ]
def updateParameters(self, parameters): if parameters[0].altered: fieldList = [] for field in arcpy.ListFields(str(parameters[0].value)): fieldList.append(field.name) parameters[2].filter.list = fieldList if parameters[1].value is True: ...
[ "def", "updateParameters", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "0", "]", ".", "altered", ":", "fieldList", "=", "[", "]", "for", "field", "in", "arcpy", ".", "ListFields", "(", "str", "(", "parameters", "[", "0", "]", "...
Modify the values and properties of parameters before internal validation is performed.
[ "Modify", "the", "values", "and", "properties", "of", "parameters", "before", "internal", "validation", "is", "performed", "." ]
[ "\"\"\"Modify the values and properties of parameters before internal\n validation is performed. This method is called whenever a parameter\n has been changed.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
updateMessages
<not_specific>
def updateMessages(self, parameters): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" if parameters[5].value: import imp try: imp.find_module("geopy") except Im...
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", ".", "This", "method", "is", "called", "after", "internal", "validation", "." ]
def updateMessages(self, parameters): if parameters[5].value: import imp try: imp.find_module("geopy") except ImportError: parameters[5].setErrorMessage("Your system does not have the GeoPy package installed! \n Click \"Show Help\" for addition...
[ "def", "updateMessages", "(", "self", ",", "parameters", ")", ":", "if", "parameters", "[", "5", "]", ".", "value", ":", "import", "imp", "try", ":", "imp", ".", "find_module", "(", "\"geopy\"", ")", "except", "ImportError", ":", "parameters", "[", "5", ...
Modify the messages created by internal validation for each tool parameter.
[ "Modify", "the", "messages", "created", "by", "internal", "validation", "for", "each", "tool", "parameter", "." ]
[ "\"\"\"Modify the messages created by internal validation for each tool\n parameter. This method is called after internal validation.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
455c80326d92e24e60fdeda19fccf9ffe3f0ae61
itsalidag/arcgis-python-toolbox
GeocodingTools.py
[ "MIT" ]
Python
execute
null
def execute(self, parameters, messages): """The source code of the tool.""" # get input feature inFeature = parameters[0].valueAsText coordinatesExists = parameters[1].value addressField = parameters[2].valueAsText latField = parameters[3].valueAsText lonField = p...
The source code of the tool.
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
def execute(self, parameters, messages): inFeature = parameters[0].valueAsText coordinatesExists = parameters[1].value addressField = parameters[2].valueAsText latField = parameters[3].valueAsText lonField = parameters[4].valueAsText service = parameters[5].valueAsText ...
[ "def", "execute", "(", "self", ",", "parameters", ",", "messages", ")", ":", "inFeature", "=", "parameters", "[", "0", "]", ".", "valueAsText", "coordinatesExists", "=", "parameters", "[", "1", "]", ".", "value", "addressField", "=", "parameters", "[", "2"...
The source code of the tool.
[ "The", "source", "code", "of", "the", "tool", "." ]
[ "\"\"\"The source code of the tool.\"\"\"", "# get input feature", "# create the address field if it does not exist", "# search for addresses and populate field" ]
[ { "param": "self", "type": null }, { "param": "parameters", "type": null }, { "param": "messages", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parameters", "type": null, "docstring": null, "docstring_toke...
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
reward
<not_specific>
def reward(self, action=None): """ Reward function for the task. Sparse un-normalized reward: - a discrete reward of 1.0 is provided if the drawer is opened Un-normalized summed components if using reward shaping: - Reaching: in [0, 0.25], proportional to the ...
Reward function for the task. Sparse un-normalized reward: - a discrete reward of 1.0 is provided if the drawer is opened Un-normalized summed components if using reward shaping: - Reaching: in [0, 0.25], proportional to the distance between drawer handle and robot a...
Reward function for the task. Sparse un-normalized reward. a discrete reward of 1.0 is provided if the drawer is opened Un-normalized summed components if using reward shaping. in [0, 0.25], proportional to the distance between drawer handle and robot arm Rotating: in [0, 0.25], proportional to angle rotated by draw...
[ "Reward", "function", "for", "the", "task", ".", "Sparse", "un", "-", "normalized", "reward", ".", "a", "discrete", "reward", "of", "1", ".", "0", "is", "provided", "if", "the", "drawer", "is", "opened", "Un", "-", "normalized", "summed", "components", "...
def reward(self, action=None): reward = 0. if self._check_success(): reward = 1.0 if self.reward_scale is not None: reward *= self.reward_scale / 1.0 return reward
[ "def", "reward", "(", "self", ",", "action", "=", "None", ")", ":", "reward", "=", "0.", "if", "self", ".", "_check_success", "(", ")", ":", "reward", "=", "1.0", "if", "self", ".", "reward_scale", "is", "not", "None", ":", "reward", "*=", "self", ...
Reward function for the task.
[ "Reward", "function", "for", "the", "task", "." ]
[ "\"\"\"\n Reward function for the task.\n\n Sparse un-normalized reward:\n\n - a discrete reward of 1.0 is provided if the drawer is opened\n\n Un-normalized summed components if using reward shaping:\n\n - Reaching: in [0, 0.25], proportional to the distance between drawe...
[ { "param": "self", "type": null }, { "param": "action", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "float" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null...
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
_load_model
null
def _load_model(self): """ Loads an xml model, puts it in self.model """ super()._load_model() # Adjust base pose accordingly xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) ...
Loads an xml model, puts it in self.model
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
def _load_model(self): super()._load_model() xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) mujoco_arena = TableArena( table_full_size=self.table_full_size, table_offset=self.tabl...
[ "def", "_load_model", "(", "self", ")", ":", "super", "(", ")", ".", "_load_model", "(", ")", "xpos", "=", "self", ".", "robots", "[", "0", "]", ".", "robot_model", ".", "base_xpos_offset", "[", "\"table\"", "]", "(", "self", ".", "table_full_size", "[...
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
[ "\"\"\"\n Loads an xml model, puts it in self.model\n \"\"\"", "# Adjust base pose accordingly", "# load model for table top workspace", "# Arena always gets set to zero origin", "# Modify default agentview camera", "# Create placement initializer", "# task includes arena, robot, and objec...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
_setup_references
null
def _setup_references(self): """ Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data. """ super()._setup_referen...
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
[ "Sets", "up", "references", "to", "important", "components", ".", "A", "reference", "is", "typically", "an", "index", "or", "a", "list", "of", "indices", "that", "point", "to", "the", "corresponding", "elements", "in", "a", "flatten", "array", "which", "is",...
def _setup_references(self): super()._setup_references() self.object_body_ids = dict() self.object_body_ids["stove_1"] = self.sim.model.body_name2id(self.stove_object_1.root_body) self.pot_object_id = self.sim.model.body_name2id(self.pot_object.root_body) self.button_qpos_addrs.u...
[ "def", "_setup_references", "(", "self", ")", ":", "super", "(", ")", ".", "_setup_references", "(", ")", "self", ".", "object_body_ids", "=", "dict", "(", ")", "self", ".", "object_body_ids", "[", "\"stove_1\"", "]", "=", "self", ".", "sim", ".", "model...
Sets up references to important components.
[ "Sets", "up", "references", "to", "important", "components", "." ]
[ "\"\"\"\n Sets up references to important components. A reference is typically an\n index or a list of indices that point to the corresponding elements\n in a flatten array, which is how MuJoCo stores physical simulation data.\n \"\"\"", "# Additional object references from this env", ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
_setup_observables
<not_specific>
def _setup_observables(self): """ Sets up observables to be used for this environment. Creates object-based observables if enabled Returns: OrderedDict: Dictionary mapping observable names to its corresponding Observable object """ observables = super()._setup_observ...
Sets up observables to be used for this environment. Creates object-based observables if enabled Returns: OrderedDict: Dictionary mapping observable names to its corresponding Observable object
Sets up observables to be used for this environment. Creates object-based observables if enabled
[ "Sets", "up", "observables", "to", "be", "used", "for", "this", "environment", ".", "Creates", "object", "-", "based", "observables", "if", "enabled" ]
def _setup_observables(self): observables = super()._setup_observables() observables["robot0_joint_pos"]._active = True if self.use_object_obs: pf = self.robots[0].robot_model.naming_prefix modality = "object" sensors = [] names = [s.__name__ for s...
[ "def", "_setup_observables", "(", "self", ")", ":", "observables", "=", "super", "(", ")", ".", "_setup_observables", "(", ")", "observables", "[", "\"robot0_joint_pos\"", "]", ".", "_active", "=", "True", "if", "self", ".", "use_object_obs", ":", "pf", "=",...
Sets up observables to be used for this environment.
[ "Sets", "up", "observables", "to", "be", "used", "for", "this", "environment", "." ]
[ "\"\"\"\n Sets up observables to be used for this environment. Creates object-based observables if enabled\n\n Returns:\n OrderedDict: Dictionary mapping observable names to its corresponding Observable object\n \"\"\"", "# low-level object information", "# Get robot prefix and d...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Dictionary mapping observable names to its corresponding Observable object", "docstring_tokens": [ "Dictionary", "mapping", "observable", "names", "to", "its", "corresponding", "Observable", "object"...
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
_create_obj_sensors
<not_specific>
def _create_obj_sensors(self, obj_name, modality="object"): """ Helper function to create sensors for a given object. This is abstracted in a separate function call so that we don't have local function naming collisions during the _setup_observables() call. Args: obj_name (s...
Helper function to create sensors for a given object. This is abstracted in a separate function call so that we don't have local function naming collisions during the _setup_observables() call. Args: obj_name (str): Name of object to create sensors for modality (str): M...
Helper function to create sensors for a given object. This is abstracted in a separate function call so that we don't have local function naming collisions during the _setup_observables() call.
[ "Helper", "function", "to", "create", "sensors", "for", "a", "given", "object", ".", "This", "is", "abstracted", "in", "a", "separate", "function", "call", "so", "that", "we", "don", "'", "t", "have", "local", "function", "naming", "collisions", "during", ...
def _create_obj_sensors(self, obj_name, modality="object"): pf = self.robots[0].robot_model.naming_prefix @sensor(modality=modality) def obj_pos(obs_cache): return np.array(self.sim.data.body_xpos[self.obj_body_id[obj_name]]) @sensor(modality=modality) def obj_quat(ob...
[ "def", "_create_obj_sensors", "(", "self", ",", "obj_name", ",", "modality", "=", "\"object\"", ")", ":", "pf", "=", "self", ".", "robots", "[", "0", "]", ".", "robot_model", ".", "naming_prefix", "@", "sensor", "(", "modality", "=", "modality", ")", "de...
Helper function to create sensors for a given object.
[ "Helper", "function", "to", "create", "sensors", "for", "a", "given", "object", "." ]
[ "\"\"\"\n Helper function to create sensors for a given object. This is abstracted in a separate function call so that we\n don't have local function naming collisions during the _setup_observables() call.\n\n Args:\n obj_name (str): Name of object to create sensors for\n ...
[ { "param": "self", "type": null }, { "param": "obj_name", "type": null }, { "param": "modality", "type": null } ]
{ "returns": [ { "docstring": "sensors (list): Array of sensors for the given obj\nnames (list): array of corresponding observable names", "docstring_tokens": [ "sensors", "(", "list", ")", ":", "Array", "of", "sensors", "for", ...
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
visualize
null
def visualize(self, vis_settings): """ In addition to super call, visualize gripper site proportional to the distance to the drawer handle. Args: vis_settings (dict): Visualization keywords mapped to T/F, determining whether that specific component should be visualiz...
In addition to super call, visualize gripper site proportional to the distance to the drawer handle. Args: vis_settings (dict): Visualization keywords mapped to T/F, determining whether that specific component should be visualized. Should have "grippers" keyword as well as ...
In addition to super call, visualize gripper site proportional to the distance to the drawer handle.
[ "In", "addition", "to", "super", "call", "visualize", "gripper", "site", "proportional", "to", "the", "distance", "to", "the", "drawer", "handle", "." ]
def visualize(self, vis_settings): super().visualize(vis_settings=vis_settings)
[ "def", "visualize", "(", "self", ",", "vis_settings", ")", ":", "super", "(", ")", ".", "visualize", "(", "vis_settings", "=", "vis_settings", ")" ]
In addition to super call, visualize gripper site proportional to the distance to the drawer handle.
[ "In", "addition", "to", "super", "call", "visualize", "gripper", "site", "proportional", "to", "the", "distance", "to", "the", "drawer", "handle", "." ]
[ "\"\"\"\n In addition to super call, visualize gripper site proportional to the distance to the drawer handle.\n\n Args:\n vis_settings (dict): Visualization keywords mapped to T/F, determining whether that specific\n component should be visualized. Should have \"grippers\" k...
[ { "param": "self", "type": null }, { "param": "vis_settings", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vis_settings", "type": null, "docstring": "Visualization keywords m...
6c2bac13b239716ac32b24854d4d52cf6e15298b
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/kitchen.py
[ "MIT" ]
Python
_has_gripper_contact
<not_specific>
def _has_gripper_contact(self): """ Determines whether the gripper is making contact with an object, as defined by the eef force surprassing a certain threshold defined by self.contact_threshold Returns: bool: True if contact is surpasses given threshold magnitude ""...
Determines whether the gripper is making contact with an object, as defined by the eef force surprassing a certain threshold defined by self.contact_threshold Returns: bool: True if contact is surpasses given threshold magnitude
Determines whether the gripper is making contact with an object, as defined by the eef force surprassing a certain threshold defined by self.contact_threshold
[ "Determines", "whether", "the", "gripper", "is", "making", "contact", "with", "an", "object", "as", "defined", "by", "the", "eef", "force", "surprassing", "a", "certain", "threshold", "defined", "by", "self", ".", "contact_threshold" ]
def _has_gripper_contact(self): return np.linalg.norm(self.robots[0].ee_force - self.ee_force_bias) > self.contact_threshold
[ "def", "_has_gripper_contact", "(", "self", ")", ":", "return", "np", ".", "linalg", ".", "norm", "(", "self", ".", "robots", "[", "0", "]", ".", "ee_force", "-", "self", ".", "ee_force_bias", ")", ">", "self", ".", "contact_threshold" ]
Determines whether the gripper is making contact with an object, as defined by the eef force surprassing a certain threshold defined by self.contact_threshold
[ "Determines", "whether", "the", "gripper", "is", "making", "contact", "with", "an", "object", "as", "defined", "by", "the", "eef", "force", "surprassing", "a", "certain", "threshold", "defined", "by", "self", ".", "contact_threshold" ]
[ "\"\"\"\n Determines whether the gripper is making contact with an object, as defined by the eef force surprassing\n a certain threshold defined by self.contact_threshold\n\n Returns:\n bool: True if contact is surpasses given threshold magnitude\n \"\"\"", "# return np.lina...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "True if contact is surpasses given threshold magnitude", "docstring_tokens": [ "True", "if", "contact", "is", "surpasses", "given", "threshold", "magnitude" ], "type": "bool" } ], "raises...
b106ba6224263225337c85890ee9fe8706b5b4d1
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/hammer_place.py
[ "MIT" ]
Python
_load_model
null
def _load_model(self): """ Loads an xml model, puts it in self.model """ super()._load_model() # Adjust base pose accordingly xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) ...
Loads an xml model, puts it in self.model
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
def _load_model(self): super()._load_model() xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) mujoco_arena = TableArena( table_full_size=self.table_full_size, table_offset=self.tabl...
[ "def", "_load_model", "(", "self", ")", ":", "super", "(", ")", ".", "_load_model", "(", ")", "xpos", "=", "self", ".", "robots", "[", "0", "]", ".", "robot_model", ".", "base_xpos_offset", "[", "\"table\"", "]", "(", "self", ".", "table_full_size", "[...
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
[ "\"\"\"\n Loads an xml model, puts it in self.model\n \"\"\"", "# Adjust base pose accordingly", "# load model for table top workspace", "# Arena always gets set to zero origin", "# Modify default agentview camera", "# task includes arena, robot, and objects of interest" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b106ba6224263225337c85890ee9fe8706b5b4d1
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/hammer_place.py
[ "MIT" ]
Python
_setup_references
null
def _setup_references(self): """ Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data. """ super()._setup_referen...
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
[ "Sets", "up", "references", "to", "important", "components", ".", "A", "reference", "is", "typically", "an", "index", "or", "a", "list", "of", "indices", "that", "point", "to", "the", "corresponding", "elements", "in", "a", "flatten", "array", "which", "is",...
def _setup_references(self): super()._setup_references() self.object_body_ids = dict() self.cabinet_qpos_addrs = self.sim.model.get_joint_qpos_addr(self.cabinet_object.joints[0]) self.sorting_object_id = self.sim.model.body_name2id(self.sorting_object.root_body) self.cabinet_obje...
[ "def", "_setup_references", "(", "self", ")", ":", "super", "(", ")", ".", "_setup_references", "(", ")", "self", ".", "object_body_ids", "=", "dict", "(", ")", "self", ".", "cabinet_qpos_addrs", "=", "self", ".", "sim", ".", "model", ".", "get_joint_qpos_...
Sets up references to important components.
[ "Sets", "up", "references", "to", "important", "components", "." ]
[ "\"\"\"\n Sets up references to important components. A reference is typically an\n index or a list of indices that point to the corresponding elements\n in a flatten array, which is how MuJoCo stores physical simulation data.\n \"\"\"", "# Additional object references from this env" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b106ba6224263225337c85890ee9fe8706b5b4d1
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/hammer_place.py
[ "MIT" ]
Python
_check_success
<not_specific>
def _check_success(self): """ Check if drawer has been opened. Returns: bool: True if drawer has been opened """ object_pos = self.sim.data.body_xpos[self.sorting_object_id] object_in_drawer = 1.0 > object_pos[2] > 0.94 and object_pos[1] > 0.22 cabin...
Check if drawer has been opened. Returns: bool: True if drawer has been opened
Check if drawer has been opened.
[ "Check", "if", "drawer", "has", "been", "opened", "." ]
def _check_success(self): object_pos = self.sim.data.body_xpos[self.sorting_object_id] object_in_drawer = 1.0 > object_pos[2] > 0.94 and object_pos[1] > 0.22 cabinet_closed = self.sim.data.qpos[self.cabinet_qpos_addrs] > -0.01 return object_in_drawer and cabinet_closed
[ "def", "_check_success", "(", "self", ")", ":", "object_pos", "=", "self", ".", "sim", ".", "data", ".", "body_xpos", "[", "self", ".", "sorting_object_id", "]", "object_in_drawer", "=", "1.0", ">", "object_pos", "[", "2", "]", ">", "0.94", "and", "objec...
Check if drawer has been opened.
[ "Check", "if", "drawer", "has", "been", "opened", "." ]
[ "\"\"\"\n Check if drawer has been opened.\n\n Returns:\n bool: True if drawer has been opened\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "True if drawer has been opened", "docstring_tokens": [ "True", "if", "drawer", "has", "been", "opened" ], "type": "bool" } ], "raises": [], "params": [ { "identifier": "self", "type": n...
4af1df3b86f66666c6729a17f49b421952b0bb59
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/tool_use.py
[ "MIT" ]
Python
_load_model
null
def _load_model(self): """ Loads an xml model, puts it in self.model """ super()._load_model() # Adjust base pose accordingly xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) ...
Loads an xml model, puts it in self.model
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
def _load_model(self): super()._load_model() xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0]) self.robots[0].robot_model.set_base_xpos(xpos) mujoco_arena = TableArena( table_full_size=self.table_full_size, table_offset=self.tabl...
[ "def", "_load_model", "(", "self", ")", ":", "super", "(", ")", ".", "_load_model", "(", ")", "xpos", "=", "self", ".", "robots", "[", "0", "]", ".", "robot_model", ".", "base_xpos_offset", "[", "\"table\"", "]", "(", "self", ".", "table_full_size", "[...
Loads an xml model, puts it in self.model
[ "Loads", "an", "xml", "model", "puts", "it", "in", "self", ".", "model" ]
[ "\"\"\"\n Loads an xml model, puts it in self.model\n \"\"\"", "# Adjust base pose accordingly", "# load model for table top workspace", "# Arena always gets set to zero origin", "# Modify default agentview camera", "# initialize objects of interest", "# Create placement initializer", "#...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4af1df3b86f66666c6729a17f49b421952b0bb59
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/tool_use.py
[ "MIT" ]
Python
_setup_references
null
def _setup_references(self): """ Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data. """ super()._setup_referen...
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
Sets up references to important components. A reference is typically an index or a list of indices that point to the corresponding elements in a flatten array, which is how MuJoCo stores physical simulation data.
[ "Sets", "up", "references", "to", "important", "components", ".", "A", "reference", "is", "typically", "an", "index", "or", "a", "list", "of", "indices", "that", "point", "to", "the", "corresponding", "elements", "in", "a", "flatten", "array", "which", "is",...
def _setup_references(self): super()._setup_references() self.object_body_ids = dict() self.pot_object_id = self.sim.model.body_name2id(self.pot_object.root_body) self.lshape_tool_id = self.sim.model.body_name2id(self.lshape_tool.root_body) self.cube_id = self.sim.model.body_name...
[ "def", "_setup_references", "(", "self", ")", ":", "super", "(", ")", ".", "_setup_references", "(", ")", "self", ".", "object_body_ids", "=", "dict", "(", ")", "self", ".", "pot_object_id", "=", "self", ".", "sim", ".", "model", ".", "body_name2id", "("...
Sets up references to important components.
[ "Sets", "up", "references", "to", "important", "components", "." ]
[ "\"\"\"\n Sets up references to important components. A reference is typically an\n index or a list of indices that point to the corresponding elements\n in a flatten array, which is how MuJoCo stores physical simulation data.\n \"\"\"", "# Additional object references from this env" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4af1df3b86f66666c6729a17f49b421952b0bb59
peterdavidfagan/robosuite-task-zoo
robosuite_task_zoo/environments/manipulation/tool_use.py
[ "MIT" ]
Python
_setup_observables
<not_specific>
def _setup_observables(self): """ Sets up observables to be used for this environment. Creates object-based observables if enabled Returns: OrderedDict: Dictionary mapping observable names to its corresponding Observable object """ observables = super()._setup_observ...
Sets up observables to be used for this environment. Creates object-based observables if enabled Returns: OrderedDict: Dictionary mapping observable names to its corresponding Observable object
Sets up observables to be used for this environment. Creates object-based observables if enabled
[ "Sets", "up", "observables", "to", "be", "used", "for", "this", "environment", ".", "Creates", "object", "-", "based", "observables", "if", "enabled" ]
def _setup_observables(self): observables = super()._setup_observables() observables["robot0_joint_pos"]._active = True if self.use_object_obs: pf = self.robots[0].robot_model.naming_prefix modality = "object" sensors = [] names = [s.__name__ for s...
[ "def", "_setup_observables", "(", "self", ")", ":", "observables", "=", "super", "(", ")", ".", "_setup_observables", "(", ")", "observables", "[", "\"robot0_joint_pos\"", "]", ".", "_active", "=", "True", "if", "self", ".", "use_object_obs", ":", "pf", "=",...
Sets up observables to be used for this environment.
[ "Sets", "up", "observables", "to", "be", "used", "for", "this", "environment", "." ]
[ "\"\"\"\n Sets up observables to be used for this environment. Creates object-based observables if enabled\n\n Returns:\n OrderedDict: Dictionary mapping observable names to its corresponding Observable object\n \"\"\"", "# low-level object information", "# Get robot prefix and d...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Dictionary mapping observable names to its corresponding Observable object", "docstring_tokens": [ "Dictionary", "mapping", "observable", "names", "to", "its", "corresponding", "Observable", "object"...
503a634d5db6c165b71a932b5c5b0cdb8dd27c3b
yoyouC/network-slimming
main.py
[ "MIT" ]
Python
loss_fn_kd
<not_specific>
def loss_fn_kd(outputs, labels, teacher_outputs, T, alpha): """ Compute the knowledge-distillation (KD) loss given outputs, labels. "Hyperparameters": temperature and alpha NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher and student expects the input tensor to be log probabilit...
Compute the knowledge-distillation (KD) loss given outputs, labels. "Hyperparameters": temperature and alpha NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher and student expects the input tensor to be log probabilities! See Issue #2
Compute the knowledge-distillation (KD) loss given outputs, labels. "Hyperparameters": temperature and alpha NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher and student expects the input tensor to be log probabilities. See Issue #2
[ "Compute", "the", "knowledge", "-", "distillation", "(", "KD", ")", "loss", "given", "outputs", "labels", ".", "\"", "Hyperparameters", "\"", ":", "temperature", "and", "alpha", "NOTE", ":", "the", "KL", "Divergence", "for", "PyTorch", "comparing", "the", "s...
def loss_fn_kd(outputs, labels, teacher_outputs, T, alpha): KD_loss = nn.KLDivLoss()(F.log_softmax(outputs/T, dim=1), F.softmax(teacher_outputs/T, dim=1)) * (alpha * T * T) + \ F.cross_entropy(outputs, labels) * (1. - alpha) return KD_loss
[ "def", "loss_fn_kd", "(", "outputs", ",", "labels", ",", "teacher_outputs", ",", "T", ",", "alpha", ")", ":", "KD_loss", "=", "nn", ".", "KLDivLoss", "(", ")", "(", "F", ".", "log_softmax", "(", "outputs", "/", "T", ",", "dim", "=", "1", ")", ",", ...
Compute the knowledge-distillation (KD) loss given outputs, labels.
[ "Compute", "the", "knowledge", "-", "distillation", "(", "KD", ")", "loss", "given", "outputs", "labels", "." ]
[ "\"\"\"\n Compute the knowledge-distillation (KD) loss given outputs, labels.\n \"Hyperparameters\": temperature and alpha\n NOTE: the KL Divergence for PyTorch comparing the softmaxs of teacher\n and student expects the input tensor to be log probabilities! See Issue #2\n \"\"\"" ]
[ { "param": "outputs", "type": null }, { "param": "labels", "type": null }, { "param": "teacher_outputs", "type": null }, { "param": "T", "type": null }, { "param": "alpha", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "outputs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "labels", "type": null, "docstring": null, "docstring_token...
f617398e0759f815c8c201dcec2c5a9dceefa983
zaveta/Housing-Market-Dashboard-using-Streamlit
plotting.py
[ "Apache-2.0" ]
Python
avg_price_fig
<not_specific>
def avg_price_fig(choosen_df): ''' Make fugure Average Price by month INPUT: dataframe OUTPUT: figure, plotly.graph_objects ''' fig = go.Figure() for m in set(choosen_df["Year"]): color = colors[m % 10] fig.add_trace( go.Bar( x=choosen_df["Month"],...
Make fugure Average Price by month INPUT: dataframe OUTPUT: figure, plotly.graph_objects
Make fugure Average Price by month INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "Average", "Price", "by", "month", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
def avg_price_fig(choosen_df): fig = go.Figure() for m in set(choosen_df["Year"]): color = colors[m % 10] fig.add_trace( go.Bar( x=choosen_df["Month"], y=choosen_df[choosen_df["Year"] == m]["Average"], name=m, text=m, ...
[ "def", "avg_price_fig", "(", "choosen_df", ")", ":", "fig", "=", "go", ".", "Figure", "(", ")", "for", "m", "in", "set", "(", "choosen_df", "[", "\"Year\"", "]", ")", ":", "color", "=", "colors", "[", "m", "%", "10", "]", "fig", ".", "add_trace", ...
Make fugure Average Price by month INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "Average", "Price", "by", "month", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
[ "'''\n Make fugure Average Price by month\n INPUT: dataframe\n OUTPUT: figure, plotly.graph_objects\n '''" ]
[ { "param": "choosen_df", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "choosen_df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f617398e0759f815c8c201dcec2c5a9dceefa983
zaveta/Housing-Market-Dashboard-using-Streamlit
plotting.py
[ "Apache-2.0" ]
Python
diff_price_fig
<not_specific>
def diff_price_fig(choosen_df): ''' Make fugure Percent of Original List Price INPUT: dataframe OUTPUT: figure, plotly.graph_objects ''' fig = go.Figure() price_diff = [p - 100 for p in choosen_df[ "Percent of Original List Price Received" ]] for m in ...
Make fugure Percent of Original List Price INPUT: dataframe OUTPUT: figure, plotly.graph_objects
Make fugure Percent of Original List Price INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "Percent", "of", "Original", "List", "Price", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
def diff_price_fig(choosen_df): fig = go.Figure() price_diff = [p - 100 for p in choosen_df[ "Percent of Original List Price Received" ]] for m in set(choosen_df["Year"]): color = colors[m % 10] fig.add_trace( go.Bar( x=choosen_...
[ "def", "diff_price_fig", "(", "choosen_df", ")", ":", "fig", "=", "go", ".", "Figure", "(", ")", "price_diff", "=", "[", "p", "-", "100", "for", "p", "in", "choosen_df", "[", "\"Percent of Original List Price Received\"", "]", "]", "for", "m", "in", "set",...
Make fugure Percent of Original List Price INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "Percent", "of", "Original", "List", "Price", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
[ "'''\n Make fugure Percent of Original List Price\n INPUT: dataframe\n OUTPUT: figure, plotly.graph_objects\n '''" ]
[ { "param": "choosen_df", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "choosen_df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f617398e0759f815c8c201dcec2c5a9dceefa983
zaveta/Housing-Market-Dashboard-using-Streamlit
plotting.py
[ "Apache-2.0" ]
Python
new_listing_fig
<not_specific>
def new_listing_fig(choosen_df): ''' Make fugure compare New Listings and Closed Sales INPUT: dataframe OUTPUT: figure, plotly.graph_objects ''' fig = go.Figure() for m in set(choosen_df["Year"]): color = colors[m % 10] fig.add_trace( go.Bar( x=cho...
Make fugure compare New Listings and Closed Sales INPUT: dataframe OUTPUT: figure, plotly.graph_objects
Make fugure compare New Listings and Closed Sales INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "compare", "New", "Listings", "and", "Closed", "Sales", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
def new_listing_fig(choosen_df): fig = go.Figure() for m in set(choosen_df["Year"]): color = colors[m % 10] fig.add_trace( go.Bar( x=choosen_df["Month"], y=choosen_df[choosen_df["Year"] == m]["New Listings"], name=m, tex...
[ "def", "new_listing_fig", "(", "choosen_df", ")", ":", "fig", "=", "go", ".", "Figure", "(", ")", "for", "m", "in", "set", "(", "choosen_df", "[", "\"Year\"", "]", ")", ":", "color", "=", "colors", "[", "m", "%", "10", "]", "fig", ".", "add_trace",...
Make fugure compare New Listings and Closed Sales INPUT: dataframe OUTPUT: figure, plotly.graph_objects
[ "Make", "fugure", "compare", "New", "Listings", "and", "Closed", "Sales", "INPUT", ":", "dataframe", "OUTPUT", ":", "figure", "plotly", ".", "graph_objects" ]
[ "'''\n Make fugure compare New Listings and Closed Sales\n INPUT: dataframe\n OUTPUT: figure, plotly.graph_objects\n '''" ]
[ { "param": "choosen_df", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "choosen_df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f29998faf8a43e218469b0ae26e2632f0acffb79
Azure-Samples/key-vault-python-storage-accounts
sas_definition_sample.py
[ "MIT" ]
Python
create_account_sas_definition
null
def create_account_sas_definition(self): """ Creates an account sas definition, to manage storage account and its entities. """ from azure.storage.common import SharedAccessSignature, CloudStorageAccount from azure.keyvault.models import SasTokenType, SasDefinitionAttributes ...
Creates an account sas definition, to manage storage account and its entities.
Creates an account sas definition, to manage storage account and its entities.
[ "Creates", "an", "account", "sas", "definition", "to", "manage", "storage", "account", "and", "its", "entities", "." ]
def create_account_sas_definition(self): from azure.storage.common import SharedAccessSignature, CloudStorageAccount from azure.keyvault.models import SasTokenType, SasDefinitionAttributes from azure.keyvault import SecretId sas = SharedAccessSignature(account_name=self.config.storage_ac...
[ "def", "create_account_sas_definition", "(", "self", ")", ":", "from", "azure", ".", "storage", ".", "common", "import", "SharedAccessSignature", ",", "CloudStorageAccount", "from", "azure", ".", "keyvault", ".", "models", "import", "SasTokenType", ",", "SasDefiniti...
Creates an account sas definition, to manage storage account and its entities.
[ "Creates", "an", "account", "sas", "definition", "to", "manage", "storage", "account", "and", "its", "entities", "." ]
[ "\"\"\"\n Creates an account sas definition, to manage storage account and its entities.\n \"\"\"", "# To create an account sas definition in the vault we must first create the template. The", "# template_uri for an account sas definition is the intended account sas token signed with an arbitrary ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f29998faf8a43e218469b0ae26e2632f0acffb79
Azure-Samples/key-vault-python-storage-accounts
sas_definition_sample.py
[ "MIT" ]
Python
create_blob_sas_defintion
null
def create_blob_sas_defintion(self): """ Creates a service SAS definition with access to a blob container. """ from azure.storage.blob import BlockBlobService, ContainerPermissions from azure.keyvault.models import SasTokenType, SasDefinitionAttributes from azure.keyvaul...
Creates a service SAS definition with access to a blob container.
Creates a service SAS definition with access to a blob container.
[ "Creates", "a", "service", "SAS", "definition", "with", "access", "to", "a", "blob", "container", "." ]
def create_blob_sas_defintion(self): from azure.storage.blob import BlockBlobService, ContainerPermissions from azure.keyvault.models import SasTokenType, SasDefinitionAttributes from azure.keyvault import SecretId service = BlockBlobService(account_name=self.config.storage_account_name,...
[ "def", "create_blob_sas_defintion", "(", "self", ")", ":", "from", "azure", ".", "storage", ".", "blob", "import", "BlockBlobService", ",", "ContainerPermissions", "from", "azure", ".", "keyvault", ".", "models", "import", "SasTokenType", ",", "SasDefinitionAttribut...
Creates a service SAS definition with access to a blob container.
[ "Creates", "a", "service", "SAS", "definition", "with", "access", "to", "a", "blob", "container", "." ]
[ "\"\"\"\n Creates a service SAS definition with access to a blob container.\n \"\"\"", "# create the blob sas definition template", "# the sas template uri for service sas definitions contains the storage entity url with the template token", "# this sample demonstrates constructing the template ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }