repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
BerkeleyAutomation/perception | perception/image.py | BinaryImage.most_free_pixel | def most_free_pixel(self):
""" Find the black pixel with the largest distance from the white pixels.
Returns
-------
:obj:`numpy.ndarray`
2-vector containing the most free pixel
"""
dist_tf = self.to_distance_im()
max_px = np.where(dist_tf == np.max(d... | python | def most_free_pixel(self):
""" Find the black pixel with the largest distance from the white pixels.
Returns
-------
:obj:`numpy.ndarray`
2-vector containing the most free pixel
"""
dist_tf = self.to_distance_im()
max_px = np.where(dist_tf == np.max(d... | Find the black pixel with the largest distance from the white pixels.
Returns
-------
:obj:`numpy.ndarray`
2-vector containing the most free pixel | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2599-L2610 |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.diff_with_target | def diff_with_target(self, binary_im):
""" Creates a color image to visualize the overlap between two images.
Nonzero pixels that match in both images are green.
Nonzero pixels of this image that aren't in the other image are yellow
Nonzero pixels of the other image that aren't in this i... | python | def diff_with_target(self, binary_im):
""" Creates a color image to visualize the overlap between two images.
Nonzero pixels that match in both images are green.
Nonzero pixels of this image that aren't in the other image are yellow
Nonzero pixels of the other image that aren't in this i... | Creates a color image to visualize the overlap between two images.
Nonzero pixels that match in both images are green.
Nonzero pixels of this image that aren't in the other image are yellow
Nonzero pixels of the other image that aren't in this image are red
Parameters
----------... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2612-L2638 |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.num_adjacent | def num_adjacent(self, i, j):
""" Counts the number of adjacent nonzero pixels to a given pixel.
Parameters
----------
i : int
row index of query pixel
j : int
col index of query pixel
Returns
-------
int
number of adj... | python | def num_adjacent(self, i, j):
""" Counts the number of adjacent nonzero pixels to a given pixel.
Parameters
----------
i : int
row index of query pixel
j : int
col index of query pixel
Returns
-------
int
number of adj... | Counts the number of adjacent nonzero pixels to a given pixel.
Parameters
----------
i : int
row index of query pixel
j : int
col index of query pixel
Returns
-------
int
number of adjacent nonzero pixels | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2640-L2665 |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.to_sdf | def to_sdf(self):
""" Converts the 2D image to a 2D signed distance field.
Returns
-------
:obj:`numpy.ndarray`
2D float array of the signed distance field
"""
# compute medial axis transform
skel, sdf_in = morph.medial_axis(self.data, return_distance... | python | def to_sdf(self):
""" Converts the 2D image to a 2D signed distance field.
Returns
-------
:obj:`numpy.ndarray`
2D float array of the signed distance field
"""
# compute medial axis transform
skel, sdf_in = morph.medial_axis(self.data, return_distance... | Converts the 2D image to a 2D signed distance field.
Returns
-------
:obj:`numpy.ndarray`
2D float array of the signed distance field | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2667-L2682 |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.to_color | def to_color(self):
"""Creates a ColorImage from the binary image.
Returns
-------
:obj:`ColorImage`
The newly-created color image.
"""
color_data = np.zeros([self.height, self.width, 3])
color_data[:, :, 0] = self.data
color_data[:, :, 1] = s... | python | def to_color(self):
"""Creates a ColorImage from the binary image.
Returns
-------
:obj:`ColorImage`
The newly-created color image.
"""
color_data = np.zeros([self.height, self.width, 3])
color_data[:, :, 0] = self.data
color_data[:, :, 1] = s... | Creates a ColorImage from the binary image.
Returns
-------
:obj:`ColorImage`
The newly-created color image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2684-L2696 |
BerkeleyAutomation/perception | perception/image.py | BinaryImage.open | def open(filename, frame='unspecified'):
"""Creates a BinaryImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the ... | python | def open(filename, frame='unspecified'):
"""Creates a BinaryImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the ... | Creates a BinaryImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2699-L2720 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage._check_valid_data | def _check_valid_data(self, data):
"""Checks that the given data is a float array with four channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
"""
... | python | def _check_valid_data(self, data):
"""Checks that the given data is a float array with four channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid.
"""
... | Checks that the given data is a float array with four channels.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to check.
Raises
------
ValueError
If the data is invalid. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2751-L2776 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.from_color_and_depth | def from_color_and_depth(color_im, depth_im):
""" Creates an RGB-D image from a separate color and depth image. """
# check shape
if color_im.height != depth_im.height or color_im.width != depth_im.width:
raise ValueError('Color and depth images must have the same shape')
# ... | python | def from_color_and_depth(color_im, depth_im):
""" Creates an RGB-D image from a separate color and depth image. """
# check shape
if color_im.height != depth_im.height or color_im.width != depth_im.width:
raise ValueError('Color and depth images must have the same shape')
# ... | Creates an RGB-D image from a separate color and depth image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2779-L2793 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.color | def color(self):
""" Returns the color image. """
return ColorImage(self.raw_data[:, :, :3].astype(
np.uint8), frame=self.frame) | python | def color(self):
""" Returns the color image. """
return ColorImage(self.raw_data[:, :, :3].astype(
np.uint8), frame=self.frame) | Returns the color image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2796-L2799 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.mask_binary | def mask_binary(self, binary_im):
"""Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wh... | python | def mask_binary(self, binary_im):
"""Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wh... | Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wherever this image has zero pixels, we'll zero... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2824-L2842 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.resize | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | python | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2844-L2864 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.crop | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | python | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
The center height point at which to crop. If not specified, the... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2866-L2900 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.transform | def transform(self, translation, theta, method='opencv'):
"""Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in rad... | python | def transform(self, translation, theta, method='opencv'):
"""Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in rad... | Create a new image by translating and rotating the current image.
Parameters
----------
translation : :obj:`numpy.ndarray` of float
The XY translation vector.
theta : float
Rotation angle in radians, with positive meaning counter-clockwise.
method : :obj:... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2902-L2924 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.to_grayscale_depth | def to_grayscale_depth(self):
""" Converts to a grayscale and depth (G-D) image. """
gray = self.color.to_grayscale()
return GdImage.from_grayscale_and_depth(gray, self.depth) | python | def to_grayscale_depth(self):
""" Converts to a grayscale and depth (G-D) image. """
gray = self.color.to_grayscale()
return GdImage.from_grayscale_and_depth(gray, self.depth) | Converts to a grayscale and depth (G-D) image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2926-L2929 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.combine_with | def combine_with(self, rgbd_im):
"""
Replaces all zeros in the source rgbd image with the values of a different rgbd image
Parameters
----------
rgbd_im : :obj:`RgbdImage`
rgbd image to combine with
Returns
-------
:obj:`RgbdImage`
... | python | def combine_with(self, rgbd_im):
"""
Replaces all zeros in the source rgbd image with the values of a different rgbd image
Parameters
----------
rgbd_im : :obj:`RgbdImage`
rgbd image to combine with
Returns
-------
:obj:`RgbdImage`
... | Replaces all zeros in the source rgbd image with the values of a different rgbd image
Parameters
----------
rgbd_im : :obj:`RgbdImage`
rgbd image to combine with
Returns
-------
:obj:`RgbdImage`
the combined rgbd image | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2931-L2962 |
BerkeleyAutomation/perception | perception/image.py | RgbdImage.crop | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | python | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
The center height point at which to crop. If not specified, the... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L2964-L2990 |
BerkeleyAutomation/perception | perception/image.py | GdImage.from_grayscale_and_depth | def from_grayscale_and_depth(gray_im, depth_im):
""" Creates an G-D image from a separate grayscale and depth image. """
# check shape
if gray_im.height != depth_im.height or gray_im.width != depth_im.width:
raise ValueError(
'Grayscale and depth images must have the ... | python | def from_grayscale_and_depth(gray_im, depth_im):
""" Creates an G-D image from a separate grayscale and depth image. """
# check shape
if gray_im.height != depth_im.height or gray_im.width != depth_im.width:
raise ValueError(
'Grayscale and depth images must have the ... | Creates an G-D image from a separate grayscale and depth image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3049-L3065 |
BerkeleyAutomation/perception | perception/image.py | GdImage.gray | def gray(self):
""" Returns the grayscale image. """
return GrayscaleImage(
self.raw_data[:, :, 0].astype(np.uint8), frame=self.frame) | python | def gray(self):
""" Returns the grayscale image. """
return GrayscaleImage(
self.raw_data[:, :, 0].astype(np.uint8), frame=self.frame) | Returns the grayscale image. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3068-L3071 |
BerkeleyAutomation/perception | perception/image.py | GdImage.resize | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | python | def resize(self, size, interp='bilinear'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3096-L3116 |
BerkeleyAutomation/perception | perception/image.py | GdImage.crop | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | python | def crop(self, height, width, center_i=None, center_j=None):
"""Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
... | Crop the image centered around center_i, center_j.
Parameters
----------
height : int
The height of the desired image.
width : int
The width of the desired image.
center_i : int
The center height point at which to crop. If not specified, the... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3118-L3144 |
BerkeleyAutomation/perception | perception/image.py | SegmentationImage.border_pixels | def border_pixels(
self,
grad_sigma=0.5,
grad_lower_thresh=0.1,
grad_upper_thresh=1.0):
"""
Returns the pixels on the boundary between all segments, excluding the zero segment.
Parameters
----------
grad_sigma : float
s... | python | def border_pixels(
self,
grad_sigma=0.5,
grad_lower_thresh=0.1,
grad_upper_thresh=1.0):
"""
Returns the pixels on the boundary between all segments, excluding the zero segment.
Parameters
----------
grad_sigma : float
s... | Returns the pixels on the boundary between all segments, excluding the zero segment.
Parameters
----------
grad_sigma : float
standard deviation used for gaussian gradient filter
grad_lower_thresh : float
lower threshold on gradient threshold used to determine th... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3192-L3230 |
BerkeleyAutomation/perception | perception/image.py | SegmentationImage.segment_mask | def segment_mask(self, segnum):
""" Returns a binary image of just the segment corresponding to the given number.
Parameters
----------
segnum : int
the number of the segment to generate a mask for
Returns
-------
:obj:`BinaryImage`
bina... | python | def segment_mask(self, segnum):
""" Returns a binary image of just the segment corresponding to the given number.
Parameters
----------
segnum : int
the number of the segment to generate a mask for
Returns
-------
:obj:`BinaryImage`
bina... | Returns a binary image of just the segment corresponding to the given number.
Parameters
----------
segnum : int
the number of the segment to generate a mask for
Returns
-------
:obj:`BinaryImage`
binary image data | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3232-L3247 |
BerkeleyAutomation/perception | perception/image.py | SegmentationImage.mask_binary | def mask_binary(self, binary_im):
"""Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wh... | python | def mask_binary(self, binary_im):
"""Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wh... | Create a new image by zeroing out data at locations
where binary_im == 0.0.
Parameters
----------
binary_im : :obj:`BinaryImage`
A BinaryImage of the same size as this image, with pixel values of either
zero or one. Wherever this image has zero pixels, we'll zero... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3249-L3268 |
BerkeleyAutomation/perception | perception/image.py | SegmentationImage.resize | def resize(self, size, interp='nearest'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`... | python | def resize(self, size, interp='nearest'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3270-L3285 |
BerkeleyAutomation/perception | perception/image.py | SegmentationImage.open | def open(filename, frame='unspecified'):
""" Opens a segmentation image """
data = Image.load_data(filename)
return SegmentationImage(data, frame) | python | def open(filename, frame='unspecified'):
""" Opens a segmentation image """
data = Image.load_data(filename)
return SegmentationImage(data, frame) | Opens a segmentation image | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3288-L3291 |
BerkeleyAutomation/perception | perception/image.py | PointCloudImage.resize | def resize(self, size, interp='nearest'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`... | python | def resize(self, size, interp='nearest'):
"""Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`... | Resize the image.
Parameters
----------
size : int, float, or tuple
* int - Percentage of current size.
* float - Fraction of current size.
* tuple - Size of the output image.
interp : :obj:`str`, optional
Interpolation to use for re-si... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3351-L3379 |
BerkeleyAutomation/perception | perception/image.py | PointCloudImage.to_mesh | def to_mesh(self, dist_thresh=0.01):
""" Convert the point cloud to a mesh.
Returns
-------
:obj:`trimesh.Trimesh`
mesh of the point cloud
"""
# init vertex and triangle buffers
vertices = []
triangles = []
vertex_indices = -1 * np.one... | python | def to_mesh(self, dist_thresh=0.01):
""" Convert the point cloud to a mesh.
Returns
-------
:obj:`trimesh.Trimesh`
mesh of the point cloud
"""
# init vertex and triangle buffers
vertices = []
triangles = []
vertex_indices = -1 * np.one... | Convert the point cloud to a mesh.
Returns
-------
:obj:`trimesh.Trimesh`
mesh of the point cloud | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3381-L3450 |
BerkeleyAutomation/perception | perception/image.py | PointCloudImage.to_point_cloud | def to_point_cloud(self):
"""Convert the image to a PointCloud object.
Returns
-------
:obj:`autolab_core.PointCloud`
The corresponding PointCloud.
"""
return PointCloud(
data=self._data.reshape(
self.height *
self.... | python | def to_point_cloud(self):
"""Convert the image to a PointCloud object.
Returns
-------
:obj:`autolab_core.PointCloud`
The corresponding PointCloud.
"""
return PointCloud(
data=self._data.reshape(
self.height *
self.... | Convert the image to a PointCloud object.
Returns
-------
:obj:`autolab_core.PointCloud`
The corresponding PointCloud. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3452-L3465 |
BerkeleyAutomation/perception | perception/image.py | PointCloudImage.normal_cloud_im | def normal_cloud_im(self, ksize=3):
"""Generate a NormalCloudImage from the PointCloudImage using Sobel filtering.
Parameters
----------
ksize : int
Size of the kernel to use for derivative computation
Returns
-------
:obj:`NormalCloudImage`
... | python | def normal_cloud_im(self, ksize=3):
"""Generate a NormalCloudImage from the PointCloudImage using Sobel filtering.
Parameters
----------
ksize : int
Size of the kernel to use for derivative computation
Returns
-------
:obj:`NormalCloudImage`
... | Generate a NormalCloudImage from the PointCloudImage using Sobel filtering.
Parameters
----------
ksize : int
Size of the kernel to use for derivative computation
Returns
-------
:obj:`NormalCloudImage`
The corresponding NormalCloudImage. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3467-L3499 |
BerkeleyAutomation/perception | perception/image.py | PointCloudImage.open | def open(filename, frame='unspecified'):
"""Creates a PointCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing ... | python | def open(filename, frame='unspecified'):
"""Creates a PointCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing ... | Creates a PointCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3502-L3521 |
BerkeleyAutomation/perception | perception/image.py | NormalCloudImage.to_normal_cloud | def to_normal_cloud(self):
"""Convert the image to a NormalCloud object.
Returns
-------
:obj:`autolab_core.NormalCloud`
The corresponding NormalCloud.
"""
return NormalCloud(
data=self._data.reshape(
self.height *
... | python | def to_normal_cloud(self):
"""Convert the image to a NormalCloud object.
Returns
-------
:obj:`autolab_core.NormalCloud`
The corresponding NormalCloud.
"""
return NormalCloud(
data=self._data.reshape(
self.height *
... | Convert the image to a NormalCloud object.
Returns
-------
:obj:`autolab_core.NormalCloud`
The corresponding NormalCloud. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3595-L3608 |
BerkeleyAutomation/perception | perception/image.py | NormalCloudImage.open | def open(filename, frame='unspecified'):
"""Creates a NormalCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing... | python | def open(filename, frame='unspecified'):
"""Creates a NormalCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing... | Creates a NormalCloudImage from a file.
Parameters
----------
filename : :obj:`str`
The file to load the data from. Must be one of .png, .jpg,
.npy, or .npz.
frame : :obj:`str`
A string representing the frame of reference in which the new image
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/image.py#L3611-L3630 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.S | def S(self):
""":obj:`numpy.ndarray` : The 3x3 scaling matrix for this projection
"""
S = np.array([[self._plane_width / self._vol_width, 0, 0],
[0, self._plane_height / self._vol_height, 0],
[0, 0, self._depth_scale / self._vol_depth]])
return... | python | def S(self):
""":obj:`numpy.ndarray` : The 3x3 scaling matrix for this projection
"""
S = np.array([[self._plane_width / self._vol_width, 0, 0],
[0, self._plane_height / self._vol_height, 0],
[0, 0, self._depth_scale / self._vol_depth]])
return... | :obj:`numpy.ndarray` : The 3x3 scaling matrix for this projection | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L73-L79 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.t | def t(self):
""":obj:`numpy.ndarray` : The 3x1 translation matrix for this projection
"""
t = np.array([self._plane_width / 2,
self._plane_height / 2,
self._depth_scale / 2])
return t | python | def t(self):
""":obj:`numpy.ndarray` : The 3x1 translation matrix for this projection
"""
t = np.array([self._plane_width / 2,
self._plane_height / 2,
self._depth_scale / 2])
return t | :obj:`numpy.ndarray` : The 3x1 translation matrix for this projection | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L82-L88 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.P | def P(self):
""":obj:`numpy.ndarray` : The 4x4 projection matrix for this camera.
"""
P = np.r_[np.c_[self.S, self.t], np.array([0,0,0,1])]
return P | python | def P(self):
""":obj:`numpy.ndarray` : The 4x4 projection matrix for this camera.
"""
P = np.r_[np.c_[self.S, self.t], np.array([0,0,0,1])]
return P | :obj:`numpy.ndarray` : The 4x4 projection matrix for this camera. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L97-L101 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.project_to_image | def project_to_image(self, point_cloud, round_px=True):
"""Projects a point cloud onto the camera image plane and creates
a depth image. Zero depth means no point projected into the camera
at that pixel location (i.e. infinite depth).
Parameters
----------
point_cloud : ... | python | def project_to_image(self, point_cloud, round_px=True):
"""Projects a point cloud onto the camera image plane and creates
a depth image. Zero depth means no point projected into the camera
at that pixel location (i.e. infinite depth).
Parameters
----------
point_cloud : ... | Projects a point cloud onto the camera image plane and creates
a depth image. Zero depth means no point projected into the camera
at that pixel location (i.e. infinite depth).
Parameters
----------
point_cloud : :obj:`autolab_core.PointCloud` or :obj:`autolab_core.Point`
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L144-L191 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.deproject | def deproject(self, depth_image):
"""Deprojects a DepthImage into a PointCloud.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`autolab_core.PointCloud`
A 3D poi... | python | def deproject(self, depth_image):
"""Deprojects a DepthImage into a PointCloud.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`autolab_core.PointCloud`
A 3D poi... | Deprojects a DepthImage into a PointCloud.
Parameters
----------
depth_image : :obj:`DepthImage`
The 2D depth image to projet into a point cloud.
Returns
-------
:obj:`autolab_core.PointCloud`
A 3D point cloud created from the depth image.
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L193-L228 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.deproject_pixel | def deproject_pixel(self, depth, pixel):
"""Deprojects a single pixel with a given depth into a 3D point.
Parameters
----------
depth : float
The depth value at the given pixel location.
pixel : :obj:`autolab_core.Point`
A 2D point representing the pixel... | python | def deproject_pixel(self, depth, pixel):
"""Deprojects a single pixel with a given depth into a 3D point.
Parameters
----------
depth : float
The depth value at the given pixel location.
pixel : :obj:`autolab_core.Point`
A 2D point representing the pixel... | Deprojects a single pixel with a given depth into a 3D point.
Parameters
----------
depth : float
The depth value at the given pixel location.
pixel : :obj:`autolab_core.Point`
A 2D point representing the pixel's location in the camera image.
Returns
... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L254-L283 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.save | def save(self, filename):
"""Save the CameraIntrinsics object to a .intr file.
Parameters
----------
filename : :obj:`str`
The .intr file to save the object to.
Raises
------
ValueError
If filename does not have the .intr extension.
... | python | def save(self, filename):
"""Save the CameraIntrinsics object to a .intr file.
Parameters
----------
filename : :obj:`str`
The .intr file to save the object to.
Raises
------
ValueError
If filename does not have the .intr extension.
... | Save the CameraIntrinsics object to a .intr file.
Parameters
----------
filename : :obj:`str`
The .intr file to save the object to.
Raises
------
ValueError
If filename does not have the .intr extension. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L285-L305 |
BerkeleyAutomation/perception | perception/orthographic_intrinsics.py | OrthographicIntrinsics.load | def load(filename):
"""Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the fil... | python | def load(filename):
"""Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the fil... | Load a CameraIntrinsics object from a file.
Parameters
----------
filename : :obj:`str`
The .intr file to load the object from.
Returns
-------
:obj:`CameraIntrinsics`
The CameraIntrinsics object loaded from the file.
Raises
----... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/orthographic_intrinsics.py#L308-L339 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor.start | def start(self):
"""Start the sensor.
"""
if rospy.get_name() == '/unnamed':
raise ValueError('PhoXi sensor must be run inside a ros node!')
# Connect to the cameras
if not self._connect_to_sensor():
self._running = False
return False
... | python | def start(self):
"""Start the sensor.
"""
if rospy.get_name() == '/unnamed':
raise ValueError('PhoXi sensor must be run inside a ros node!')
# Connect to the cameras
if not self._connect_to_sensor():
self._running = False
return False
... | Start the sensor. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L108-L126 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor.stop | def stop(self):
"""Stop the sensor.
"""
# Check that everything is running
if not self._running:
logging.warning('PhoXi not running. Aborting stop')
return False
# Stop the subscribers
self._color_im_sub.unregister()
self._depth_im_sub.unr... | python | def stop(self):
"""Stop the sensor.
"""
# Check that everything is running
if not self._running:
logging.warning('PhoXi not running. Aborting stop')
return False
# Stop the subscribers
self._color_im_sub.unregister()
self._depth_im_sub.unr... | Stop the sensor. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L128-L146 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor.frames | def frames(self):
"""Retrieve a new frame from the PhoXi and convert it to a ColorImage,
a DepthImage, and an IrImage.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, DepthImage, and IrImage o... | python | def frames(self):
"""Retrieve a new frame from the PhoXi and convert it to a ColorImage,
a DepthImage, and an IrImage.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, DepthImage, and IrImage o... | Retrieve a new frame from the PhoXi and convert it to a ColorImage,
a DepthImage, and an IrImage.
Returns
-------
:obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray`
The ColorImage, DepthImage, and IrImage of the current frame. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L148-L176 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor._connect_to_sensor | def _connect_to_sensor(self):
"""Connect to the sensor.
"""
name = self._device_name
try:
# Check if device is actively in list
rospy.wait_for_service('phoxi_camera/get_device_list')
device_list = rospy.ServiceProxy('phoxi_camera/get_device_list', GetD... | python | def _connect_to_sensor(self):
"""Connect to the sensor.
"""
name = self._device_name
try:
# Check if device is actively in list
rospy.wait_for_service('phoxi_camera/get_device_list')
device_list = rospy.ServiceProxy('phoxi_camera/get_device_list', GetD... | Connect to the sensor. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L201-L223 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor._color_im_callback | def _color_im_callback(self, msg):
"""Callback for handling textures (greyscale images).
"""
try:
data = self._bridge.imgmsg_to_cv2(msg)
if np.max(data) > 255.0:
data = 255.0 * data / 1200.0 # Experimentally set value for white
data = np.clip(d... | python | def _color_im_callback(self, msg):
"""Callback for handling textures (greyscale images).
"""
try:
data = self._bridge.imgmsg_to_cv2(msg)
if np.max(data) > 255.0:
data = 255.0 * data / 1200.0 # Experimentally set value for white
data = np.clip(d... | Callback for handling textures (greyscale images). | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L225-L236 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor._depth_im_callback | def _depth_im_callback(self, msg):
"""Callback for handling depth images.
"""
try:
self._cur_depth_im = DepthImage(self._bridge.imgmsg_to_cv2(msg) / 1000.0, frame=self._frame)
except:
self._cur_depth_im = None | python | def _depth_im_callback(self, msg):
"""Callback for handling depth images.
"""
try:
self._cur_depth_im = DepthImage(self._bridge.imgmsg_to_cv2(msg) / 1000.0, frame=self._frame)
except:
self._cur_depth_im = None | Callback for handling depth images. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L238-L244 |
BerkeleyAutomation/perception | perception/phoxi_sensor.py | PhoXiSensor._normal_map_callback | def _normal_map_callback(self, msg):
"""Callback for handling normal maps.
"""
try:
self._cur_normal_map = self._bridge.imgmsg_to_cv2(msg)
except:
self._cur_normal_map = None | python | def _normal_map_callback(self, msg):
"""Callback for handling normal maps.
"""
try:
self._cur_normal_map = self._bridge.imgmsg_to_cv2(msg)
except:
self._cur_normal_map = None | Callback for handling normal maps. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L246-L252 |
BerkeleyAutomation/perception | perception/opencv_camera_sensor.py | OpenCVCameraSensor.start | def start(self):
""" Starts the OpenCVCameraSensor Stream
Raises:
Exception if unable to open stream
"""
self._sensor = cv2.VideoCapture(self._device_id)
if not self._sensor.isOpened():
raise Exception("Unable to open OpenCVCameraSensor for id {0}".format(... | python | def start(self):
""" Starts the OpenCVCameraSensor Stream
Raises:
Exception if unable to open stream
"""
self._sensor = cv2.VideoCapture(self._device_id)
if not self._sensor.isOpened():
raise Exception("Unable to open OpenCVCameraSensor for id {0}".format(... | Starts the OpenCVCameraSensor Stream
Raises:
Exception if unable to open stream | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/opencv_camera_sensor.py#L18-L26 |
BerkeleyAutomation/perception | perception/opencv_camera_sensor.py | OpenCVCameraSensor.frames | def frames(self, flush=True):
""" Returns the latest color image from the stream
Raises:
Exception if opencv sensor gives ret_val of 0
"""
self.flush()
ret_val, frame = self._sensor.read()
if not ret_val:
raise Exception("Unable to retrieve frame f... | python | def frames(self, flush=True):
""" Returns the latest color image from the stream
Raises:
Exception if opencv sensor gives ret_val of 0
"""
self.flush()
ret_val, frame = self._sensor.read()
if not ret_val:
raise Exception("Unable to retrieve frame f... | Returns the latest color image from the stream
Raises:
Exception if opencv sensor gives ret_val of 0 | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/opencv_camera_sensor.py#L36-L49 |
BerkeleyAutomation/perception | perception/detector.py | RgbdDetection.image | def image(self, render_mode):
""" Get the image associated with a particular render mode """
if render_mode == RenderMode.SEGMASK:
return self.query_im
elif render_mode == RenderMode.COLOR:
return self.color_im
elif render_mode == RenderMode.DEPTH:
ret... | python | def image(self, render_mode):
""" Get the image associated with a particular render mode """
if render_mode == RenderMode.SEGMASK:
return self.query_im
elif render_mode == RenderMode.COLOR:
return self.color_im
elif render_mode == RenderMode.DEPTH:
ret... | Get the image associated with a particular render mode | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L101-L110 |
BerkeleyAutomation/perception | perception/detector.py | RgbdForegroundMaskDetector.detect | def detect(self, color_im, depth_im, cfg, camera_intr=None,
T_camera_world=None, segmask=None):
"""
Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorImage`
color image for detectio... | python | def detect(self, color_im, depth_im, cfg, camera_intr=None,
T_camera_world=None, segmask=None):
"""
Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorImage`
color image for detectio... | Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorImage`
color image for detection
depth_im : :obj:`DepthImage`
depth image for detection (corresponds to color image)
cfg : :obj:`YamlC... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L149-L217 |
BerkeleyAutomation/perception | perception/detector.py | RgbdForegroundMaskQueryImageDetector._segment_color | def _segment_color(self, color_im, bounding_box, bgmodel, cfg, vis_segmentation=False):
""" Re-segments a color image to isolate an object of interest using foreground masking and kmeans """
# read params
foreground_mask_tolerance = cfg['foreground_mask_tolerance']
color_seg_rgb_weight =... | python | def _segment_color(self, color_im, bounding_box, bgmodel, cfg, vis_segmentation=False):
""" Re-segments a color image to isolate an object of interest using foreground masking and kmeans """
# read params
foreground_mask_tolerance = cfg['foreground_mask_tolerance']
color_seg_rgb_weight =... | Re-segments a color image to isolate an object of interest using foreground masking and kmeans | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L225-L298 |
BerkeleyAutomation/perception | perception/detector.py | RgbdForegroundMaskQueryImageDetector.detect | def detect(self, color_im, depth_im, cfg, camera_intr=None,
T_camera_world=None,
vis_foreground=False, vis_segmentation=False, segmask=None):
"""
Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
colo... | python | def detect(self, color_im, depth_im, cfg, camera_intr=None,
T_camera_world=None,
vis_foreground=False, vis_segmentation=False, segmask=None):
"""
Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
colo... | Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorImage`
color image for detection
depth_im : :obj:`DepthImage`
depth image for detection (corresponds to color image)
cfg : :obj:`YamlC... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L300-L427 |
BerkeleyAutomation/perception | perception/detector.py | PointCloudBoxDetector.detect | def detect(self, color_im, depth_im, cfg, camera_intr,
T_camera_world,
vis_foreground=False, vis_segmentation=False, segmask=None):
"""Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorI... | python | def detect(self, color_im, depth_im, cfg, camera_intr,
T_camera_world,
vis_foreground=False, vis_segmentation=False, segmask=None):
"""Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorI... | Detects all relevant objects in an rgbd image pair using foreground masking.
Parameters
----------
color_im : :obj:`ColorImage`
color image for detection
depth_im : :obj:`DepthImage`
depth image for detection (corresponds to color image)
cfg : :obj:`YamlC... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L435-L599 |
BerkeleyAutomation/perception | perception/detector.py | RgbdDetectorFactory.detector | def detector(detector_type):
""" Returns a detector of the specified type. """
if detector_type == 'point_cloud_box':
return PointCloudBoxDetector()
elif detector_type == 'rgbd_foreground_mask_query':
return RgbdForegroundMaskQueryImageDetector()
elif detector_typ... | python | def detector(detector_type):
""" Returns a detector of the specified type. """
if detector_type == 'point_cloud_box':
return PointCloudBoxDetector()
elif detector_type == 'rgbd_foreground_mask_query':
return RgbdForegroundMaskQueryImageDetector()
elif detector_typ... | Returns a detector of the specified type. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/detector.py#L604-L612 |
BerkeleyAutomation/perception | tools/capture_dataset.py | preprocess_images | def preprocess_images(raw_color_im,
raw_depth_im,
camera_intr,
T_camera_world,
workspace_box,
workspace_im,
image_proc_config):
""" Preprocess a set of color and depth images. """
... | python | def preprocess_images(raw_color_im,
raw_depth_im,
camera_intr,
T_camera_world,
workspace_box,
workspace_im,
image_proc_config):
""" Preprocess a set of color and depth images. """
... | Preprocess a set of color and depth images. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/tools/capture_dataset.py#L31-L122 |
BerkeleyAutomation/perception | perception/cnn.py | conv | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1):
"""
Convolution layer helper function
From https://github.com/ethereon/caffe-tensorflow
"""
c_i = input.get_shape()[-1]
assert c_i%group==0
assert c_o%group==0
convolve = lambda i, k: tf.nn.conv2d(i, k, ... | python | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding="VALID", group=1):
"""
Convolution layer helper function
From https://github.com/ethereon/caffe-tensorflow
"""
c_i = input.get_shape()[-1]
assert c_i%group==0
assert c_o%group==0
convolve = lambda i, k: tf.nn.conv2d(i, k, ... | Convolution layer helper function
From https://github.com/ethereon/caffe-tensorflow | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L14-L31 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet._parse_config | def _parse_config(self, config):
""" Parses a tensorflow configuration """
self._batch_size = config['batch_size']
self._im_height = config['im_height']
self._im_width = config['im_width']
self._num_channels = config['channels']
self._output_layer = config['out_layer']
... | python | def _parse_config(self, config):
""" Parses a tensorflow configuration """
self._batch_size = config['batch_size']
self._im_height = config['im_height']
self._im_width = config['im_width']
self._num_channels = config['channels']
self._output_layer = config['out_layer']
... | Parses a tensorflow configuration | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L72-L93 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet._load | def _load(self):
""" Loads a model into weights """
if self._model_filename is None:
raise ValueError('Model filename not specified')
# read the input image
self._graph = tf.Graph()
with self._graph.as_default():
# read in filenames
reader = t... | python | def _load(self):
""" Loads a model into weights """
if self._model_filename is None:
raise ValueError('Model filename not specified')
# read the input image
self._graph = tf.Graph()
with self._graph.as_default():
# read in filenames
reader = t... | Loads a model into weights | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L95-L129 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet._initialize | def _initialize(self):
""" Open from caffe weights """
self._graph = tf.Graph()
with self._graph.as_default():
self._input_node = tf.placeholder(tf.float32, (self._batch_size, self._im_height, self._im_width, self._num_channels))
weights = self.build_alexnet_weights()
... | python | def _initialize(self):
""" Open from caffe weights """
self._graph = tf.Graph()
with self._graph.as_default():
self._input_node = tf.placeholder(tf.float32, (self._batch_size, self._im_height, self._im_width, self._num_channels))
weights = self.build_alexnet_weights()
... | Open from caffe weights | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L131-L139 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet.open_session | def open_session(self):
""" Open tensorflow session. Exposed for memory management. """
with self._graph.as_default():
init = tf.initialize_all_variables()
self._sess = tf.Session()
self._sess.run(init) | python | def open_session(self):
""" Open tensorflow session. Exposed for memory management. """
with self._graph.as_default():
init = tf.initialize_all_variables()
self._sess = tf.Session()
self._sess.run(init) | Open tensorflow session. Exposed for memory management. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L141-L146 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet.close_session | def close_session(self):
""" Close tensorflow session. Exposes for memory management. """
with self._graph.as_default():
self._sess.close()
self._sess = None | python | def close_session(self):
""" Close tensorflow session. Exposes for memory management. """
with self._graph.as_default():
self._sess.close()
self._sess = None | Close tensorflow session. Exposes for memory management. | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L148-L152 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet.predict | def predict(self, image_arr, featurize=False):
""" Predict a set of images in batches.
Parameters
----------
image_arr : NxHxWxC :obj:`numpy.ndarray`
input set of images in a num_images x image height x image width x image channels array (must match parameters of network)
... | python | def predict(self, image_arr, featurize=False):
""" Predict a set of images in batches.
Parameters
----------
image_arr : NxHxWxC :obj:`numpy.ndarray`
input set of images in a num_images x image height x image width x image channels array (must match parameters of network)
... | Predict a set of images in batches.
Parameters
----------
image_arr : NxHxWxC :obj:`numpy.ndarray`
input set of images in a num_images x image height x image width x image channels array (must match parameters of network)
featurize : bool
whether or not to use th... | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L154-L202 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet.build_alexnet_weights | def build_alexnet_weights(self):
""" Build a set of convnet weights for AlexNet """
net_data = self._net_data
#conv1
#conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
k_h = 11; k_w = 11; c_o = 96; s_h = 4; s_w = 4
conv1W = tf.Variable(net_data["conv1"][0])
co... | python | def build_alexnet_weights(self):
""" Build a set of convnet weights for AlexNet """
net_data = self._net_data
#conv1
#conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
k_h = 11; k_w = 11; c_o = 96; s_h = 4; s_w = 4
conv1W = tf.Variable(net_data["conv1"][0])
co... | Build a set of convnet weights for AlexNet | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L219-L293 |
BerkeleyAutomation/perception | perception/cnn.py | AlexNet.build_alexnet | def build_alexnet(self, weights, output_layer=None):
""" Connects graph of alexnet from weights """
if output_layer is None:
output_layer = self._output_layer
#conv1
#conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
k_h = 11; k_w = 11; c_o = 96; s_h = 4; s_w = 4... | python | def build_alexnet(self, weights, output_layer=None):
""" Connects graph of alexnet from weights """
if output_layer is None:
output_layer = self._output_layer
#conv1
#conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
k_h = 11; k_w = 11; c_o = 96; s_h = 4; s_w = 4... | Connects graph of alexnet from weights | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/cnn.py#L295-L394 |
BerkeleyAutomation/perception | perception/feature_extractors.py | CNNBatchFeatureExtractor._forward_pass | def _forward_pass(self, images):
""" Forward pass a list of images through the CNN """
# form image array
num_images = len(images)
if num_images == 0:
return None
for image in images:
if not isinstance(image, Image):
new_images = []
... | python | def _forward_pass(self, images):
""" Forward pass a list of images through the CNN """
# form image array
num_images = len(images)
if num_images == 0:
return None
for image in images:
if not isinstance(image, Image):
new_images = []
... | Forward pass a list of images through the CNN | https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/feature_extractors.py#L51-L86 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | Engine.repositories | def repositories(self):
"""
Returns a DataFrame with the data about the repositories found at
the specified repositories path in the form of siva files.
>>> repos_df = engine.repositories
:rtype: RepositoriesDataFrame
"""
return RepositoriesDataFrame(self.__engi... | python | def repositories(self):
"""
Returns a DataFrame with the data about the repositories found at
the specified repositories path in the form of siva files.
>>> repos_df = engine.repositories
:rtype: RepositoriesDataFrame
"""
return RepositoriesDataFrame(self.__engi... | Returns a DataFrame with the data about the repositories found at
the specified repositories path in the form of siva files.
>>> repos_df = engine.repositories
:rtype: RepositoriesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L57-L67 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | Engine.blobs | def blobs(self, repository_ids=[], reference_names=[], commit_hashes=[]):
"""
Retrieves the blobs of a list of repositories, reference names and commit hashes.
So the result will be a DataFrame of all the blobs in the given commits that are
in the given references that belong to the give... | python | def blobs(self, repository_ids=[], reference_names=[], commit_hashes=[]):
"""
Retrieves the blobs of a list of repositories, reference names and commit hashes.
So the result will be a DataFrame of all the blobs in the given commits that are
in the given references that belong to the give... | Retrieves the blobs of a list of repositories, reference names and commit hashes.
So the result will be a DataFrame of all the blobs in the given commits that are
in the given references that belong to the given repositories.
>>> blobs_df = engine.blobs(repo_ids, ref_names, hashes)
Cal... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L70-L103 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | Engine.from_metadata | def from_metadata(self, db_path, db_name='engine_metadata.db'):
"""
Registers in the current session the views of the MetadataSource so the
data is obtained from the metadata database instead of reading the
repositories with the DefaultSource.
:param db_path: path to the folder ... | python | def from_metadata(self, db_path, db_name='engine_metadata.db'):
"""
Registers in the current session the views of the MetadataSource so the
data is obtained from the metadata database instead of reading the
repositories with the DefaultSource.
:param db_path: path to the folder ... | Registers in the current session the views of the MetadataSource so the
data is obtained from the metadata database instead of reading the
repositories with the DefaultSource.
:param db_path: path to the folder that contains the database.
:type db_path: str
:param db_name: name ... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L106-L121 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | SourcedDataFrame.__generate_method | def __generate_method(name):
"""
Wraps the DataFrame's original method by name to return the derived class instance.
"""
try:
func = getattr(DataFrame, name)
except AttributeError as e:
# PySpark version is too old
def func(self, *args, **kwarg... | python | def __generate_method(name):
"""
Wraps the DataFrame's original method by name to return the derived class instance.
"""
try:
func = getattr(DataFrame, name)
except AttributeError as e:
# PySpark version is too old
def func(self, *args, **kwarg... | Wraps the DataFrame's original method by name to return the derived class instance. | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L176-L198 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | RepositoriesDataFrame.references | def references(self):
"""
Returns the joined DataFrame of references and repositories.
>>> refs_df = repos_df.references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences(),
self._session, ... | python | def references(self):
"""
Returns the joined DataFrame of references and repositories.
>>> refs_df = repos_df.references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences(),
self._session, ... | Returns the joined DataFrame of references and repositories.
>>> refs_df = repos_df.references
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L261-L270 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | RepositoriesDataFrame.remote_references | def remote_references(self):
"""
Returns a new DataFrame with only the remote references of the
current repositories.
>>> remote_refs_df = repos_df.remote_references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getRemoteRefer... | python | def remote_references(self):
"""
Returns a new DataFrame with only the remote references of the
current repositories.
>>> remote_refs_df = repos_df.remote_references
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getRemoteRefer... | Returns a new DataFrame with only the remote references of the
current repositories.
>>> remote_refs_df = repos_df.remote_references
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L274-L284 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | RepositoriesDataFrame.master_ref | def master_ref(self):
"""
Filters the current DataFrame references to only contain those rows whose reference is master.
>>> master_df = repos_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences().getHEAD(),
... | python | def master_ref(self):
"""
Filters the current DataFrame references to only contain those rows whose reference is master.
>>> master_df = repos_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getReferences().getHEAD(),
... | Filters the current DataFrame references to only contain those rows whose reference is master.
>>> master_df = repos_df.master_ref
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L301-L310 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.head_ref | def head_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is HEAD.
>>> heads_df = refs_df.head_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getHEAD(),
self... | python | def head_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is HEAD.
>>> heads_df = refs_df.head_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getHEAD(),
self... | Filters the current DataFrame to only contain those rows whose reference is HEAD.
>>> heads_df = refs_df.head_ref
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L346-L355 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.master_ref | def master_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is master.
>>> master_df = refs_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getMaster(),
... | python | def master_ref(self):
"""
Filters the current DataFrame to only contain those rows whose reference is master.
>>> master_df = refs_df.master_ref
:rtype: ReferencesDataFrame
"""
return ReferencesDataFrame(self._engine_dataframe.getMaster(),
... | Filters the current DataFrame to only contain those rows whose reference is master.
>>> master_df = refs_df.master_ref
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L359-L369 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.ref | def ref(self, ref):
"""
Filters the current DataFrame to only contain those rows whose reference is the given
reference name.
>>> heads_df = refs_df.ref('refs/heads/HEAD')
:param ref: Reference to get
:type ref: str
:rtype: ReferencesDataFrame
"""
... | python | def ref(self, ref):
"""
Filters the current DataFrame to only contain those rows whose reference is the given
reference name.
>>> heads_df = refs_df.ref('refs/heads/HEAD')
:param ref: Reference to get
:type ref: str
:rtype: ReferencesDataFrame
"""
... | Filters the current DataFrame to only contain those rows whose reference is the given
reference name.
>>> heads_df = refs_df.ref('refs/heads/HEAD')
:param ref: Reference to get
:type ref: str
:rtype: ReferencesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L372-L384 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.all_reference_commits | def all_reference_commits(self):
"""
Returns the current DataFrame joined with the commits DataFrame, with all of the commits
in all references.
>>> commits_df = refs_df.all_reference_commits
Take into account that getting all the commits will lead to a lot of repeated tree
... | python | def all_reference_commits(self):
"""
Returns the current DataFrame joined with the commits DataFrame, with all of the commits
in all references.
>>> commits_df = refs_df.all_reference_commits
Take into account that getting all the commits will lead to a lot of repeated tree
... | Returns the current DataFrame joined with the commits DataFrame, with all of the commits
in all references.
>>> commits_df = refs_df.all_reference_commits
Take into account that getting all the commits will lead to a lot of repeated tree
entries and blobs, thus making your query very s... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L388-L404 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.commits | def commits(self):
"""
Returns the current DataFrame joined with the commits DataFrame. It just returns
the last commit in a reference (aka the current state).
>>> commits_df = refs_df.commits
If you want all commits from the references, use the `all_reference_commits` method,
... | python | def commits(self):
"""
Returns the current DataFrame joined with the commits DataFrame. It just returns
the last commit in a reference (aka the current state).
>>> commits_df = refs_df.commits
If you want all commits from the references, use the `all_reference_commits` method,
... | Returns the current DataFrame joined with the commits DataFrame. It just returns
the last commit in a reference (aka the current state).
>>> commits_df = refs_df.commits
If you want all commits from the references, use the `all_reference_commits` method,
but take into account that gett... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L408-L423 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | ReferencesDataFrame.blobs | def blobs(self):
"""
Returns this DataFrame joined with the blobs DataSource.
>>> blobs_df = refs_df.blobs
:rtype: BlobsDataFrame
"""
return BlobsDataFrame(self._engine_dataframe.getBlobs(), self._session, self._implicits) | python | def blobs(self):
"""
Returns this DataFrame joined with the blobs DataSource.
>>> blobs_df = refs_df.blobs
:rtype: BlobsDataFrame
"""
return BlobsDataFrame(self._engine_dataframe.getBlobs(), self._session, self._implicits) | Returns this DataFrame joined with the blobs DataSource.
>>> blobs_df = refs_df.blobs
:rtype: BlobsDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L427-L435 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | CommitsDataFrame.tree_entries | def tree_entries(self):
"""
Returns this DataFrame joined with the tree entries DataSource.
>>> entries_df = commits_df.tree_entries
:rtype: TreeEntriesDataFrame
"""
return TreeEntriesDataFrame(self._engine_dataframe.getTreeEntries(), self._session, self._implicits) | python | def tree_entries(self):
"""
Returns this DataFrame joined with the tree entries DataSource.
>>> entries_df = commits_df.tree_entries
:rtype: TreeEntriesDataFrame
"""
return TreeEntriesDataFrame(self._engine_dataframe.getTreeEntries(), self._session, self._implicits) | Returns this DataFrame joined with the tree entries DataSource.
>>> entries_df = commits_df.tree_entries
:rtype: TreeEntriesDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L476-L484 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | BlobsDataFrame.classify_languages | def classify_languages(self):
"""
Returns a new DataFrame with the language data of any blob added to
its row.
>>> blobs_lang_df = blobs_df.classify_languages
:rtype: BlobsWithLanguageDataFrame
"""
return BlobsWithLanguageDataFrame(self._engine_dataframe.classif... | python | def classify_languages(self):
"""
Returns a new DataFrame with the language data of any blob added to
its row.
>>> blobs_lang_df = blobs_df.classify_languages
:rtype: BlobsWithLanguageDataFrame
"""
return BlobsWithLanguageDataFrame(self._engine_dataframe.classif... | Returns a new DataFrame with the language data of any blob added to
its row.
>>> blobs_lang_df = blobs_df.classify_languages
:rtype: BlobsWithLanguageDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L549-L559 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | BlobsDataFrame.extract_uasts | def extract_uasts(self):
"""
Returns a new DataFrame with the parsed UAST data of any blob added to
its row.
>>> blobs_df.extract_uasts
:rtype: UASTsDataFrame
"""
return UASTsDataFrame(self._engine_dataframe.extractUASTs(),
self._se... | python | def extract_uasts(self):
"""
Returns a new DataFrame with the parsed UAST data of any blob added to
its row.
>>> blobs_df.extract_uasts
:rtype: UASTsDataFrame
"""
return UASTsDataFrame(self._engine_dataframe.extractUASTs(),
self._se... | Returns a new DataFrame with the parsed UAST data of any blob added to
its row.
>>> blobs_df.extract_uasts
:rtype: UASTsDataFrame | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L562-L572 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | UASTsDataFrame.query_uast | def query_uast(self, query, query_col='uast', output_col='result'):
"""
Queries the UAST of a file with the given query to get specific nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', 'foo', 'bar')
:... | python | def query_uast(self, query, query_col='uast', output_col='result'):
"""
Queries the UAST of a file with the given query to get specific nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', 'foo', 'bar')
:... | Queries the UAST of a file with the given query to get specific nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', 'foo', 'bar')
:param query: xpath query
:type query: str
:param query_col: column conta... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L624-L642 |
src-d/jgit-spark-connector | python/sourced/engine/engine.py | UASTsDataFrame.extract_tokens | def extract_tokens(self, input_col='result', output_col='tokens'):
"""
Extracts the tokens from UAST nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').extract_tokens().collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', output_col='foo').extract_tokens('foo', 'b... | python | def extract_tokens(self, input_col='result', output_col='tokens'):
"""
Extracts the tokens from UAST nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').extract_tokens().collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', output_col='foo').extract_tokens('foo', 'b... | Extracts the tokens from UAST nodes.
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]').extract_tokens().collect()
>>> rows = uasts_df.query_uast('//*[@roleIdentifier]', output_col='foo').extract_tokens('foo', 'bar')
:param input_col: column containing the list of nodes to extract tokens f... | https://github.com/src-d/jgit-spark-connector/blob/79d05a0bcf0da435685d6118828a8884e2fe4b94/python/sourced/engine/engine.py#L645-L659 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.list | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the
... | python | def list(
self,
bucket: str,
prefix: str=None,
delimiter: str=None,
) -> typing.Iterator[str]:
"""
Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the
... | Returns an iterator of all blob entries in a bucket that match a given prefix. Do not return any keys that
contain the delimiter past the
prefix. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L104-L122 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.delete | def delete(self, bucket: str, key: str):
"""
Deletes an object in a bucket. If the operation definitely did not delete anything, return False. Any other
return value is treated as something was possibly deleted.
"""
bucket_obj = self._ensure_bucket_loaded(bucket)
try:
... | python | def delete(self, bucket: str, key: str):
"""
Deletes an object in a bucket. If the operation definitely did not delete anything, return False. Any other
return value is treated as something was possibly deleted.
"""
bucket_obj = self._ensure_bucket_loaded(bucket)
try:
... | Deletes an object in a bucket. If the operation definitely did not delete anything, return False. Any other
return value is treated as something was possibly deleted. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L167-L176 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get | def get(self, bucket: str, key: str) -> bytes:
"""
Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data
"""
buck... | python | def get(self, bucket: str, key: str) -> bytes:
"""
Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data
"""
buck... | Retrieves the data for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is being
retrieved.
:return: the data | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L179-L193 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_cloud_checksum | def get_cloud_checksum(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is b... | python | def get_cloud_checksum(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is b... | Retrieves the cloud-provided checksum for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which checksum is being retrieved.
:return: the cloud-provided checksum | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L196-L208 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_content_type | def get_content_type(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retr... | python | def get_content_type(
self,
bucket: str,
key: str
) -> str:
"""
Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retr... | Retrieves the content-type for a given object in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which content-type is being retrieved.
:return: the content-type | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L211-L223 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_copy_token | def get_copy_token(
self,
bucket: str,
key: str,
cloud_checksum: str,
) -> typing.Any:
"""
Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guar... | python | def get_copy_token(
self,
bucket: str,
key: str,
cloud_checksum: str,
) -> typing.Any:
"""
Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guar... | Given a bucket, key, and the expected cloud-provided checksum, retrieve a token that can be passed into
:func:`~cloud_blobstore.BlobStore.copy` that guarantees the copy refers to the same version of the blob
identified by the checksum.
:param bucket: the bucket the object resides in.
:pa... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L226-L243 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_creation_date | def get_creation_date(
self,
bucket: str,
key: str,
) -> datetime.datetime:
"""
Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation... | python | def get_creation_date(
self,
bucket: str,
key: str,
) -> datetime.datetime:
"""
Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation... | Retrieves the creation date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the creation date is being retrieved.
:return: the creation date | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L246-L258 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_last_modified_date | def get_last_modified_date(
self,
bucket: str,
key: str,
) -> datetime.datetime:
"""
Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the la... | python | def get_last_modified_date(
self,
bucket: str,
key: str,
) -> datetime.datetime:
"""
Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the la... | Retrieves last modified date for a given key in a given bucket.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which the last modified date is being retrieved.
:return: the last modified date | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L261-L273 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_user_metadata | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | python | def get_user_metadata(
self,
bucket: str,
key: str
) -> typing.Dict[str, str]:
"""
Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped befo... | Retrieves the user metadata for a given object in a given bucket. If the platform has any mandatory prefixes or
suffixes for the metadata keys, they should be stripped before being returned.
:param bucket: the bucket the object resides in.
:param key: the key of the object for which metadata is... | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L276-L290 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.get_size | def get_size(
self,
bucket: str,
key: str
) -> int:
"""
Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes... | python | def get_size(
self,
bucket: str,
key: str
) -> int:
"""
Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes... | Retrieves the filesize
:param bucket: the bucket the object resides in.
:param key: the key of the object for which size is being retrieved.
:return: integer equal to filesize in bytes | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L293-L305 |
HumanCellAtlas/cloud-blobstore | cloud_blobstore/gs.py | GSBlobStore.check_bucket_exists | def check_bucket_exists(self, bucket: str) -> bool:
"""
Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists.
"""
bucket_obj = self.gcp_client.bucket(bucket) # type: Bucket
return bucket_ob... | python | def check_bucket_exists(self, bucket: str) -> bool:
"""
Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists.
"""
bucket_obj = self.gcp_client.bucket(bucket) # type: Bucket
return bucket_ob... | Checks if bucket with specified name exists.
:param bucket: the bucket to be checked.
:return: true if specified bucket exists. | https://github.com/HumanCellAtlas/cloud-blobstore/blob/b8a60e8e8c0da0e39dda084cb467a34cd2d1ef0a/cloud_blobstore/gs.py#L324-L331 |
DolphDev/pynationstates | nationstates/objects.py | API_WRAPPER._get_shard | def _get_shard(self, shard):
"""Dynamically Builds methods to query shard with proper with arg and kwargs support"""
@wraps(API_WRAPPER._get_shard)
def get_shard(*arg, **kwargs):
"""Gets the shard '{}'""".format(shard)
return self.get_shards(Shard(shard, *arg, **kwargs))
... | python | def _get_shard(self, shard):
"""Dynamically Builds methods to query shard with proper with arg and kwargs support"""
@wraps(API_WRAPPER._get_shard)
def get_shard(*arg, **kwargs):
"""Gets the shard '{}'""".format(shard)
return self.get_shards(Shard(shard, *arg, **kwargs))
... | Dynamically Builds methods to query shard with proper with arg and kwargs support | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L111-L117 |
DolphDev/pynationstates | nationstates/objects.py | API_WRAPPER.request | def request(self, shards, full_response, return_status_tuple=False):
"""Request the API
This method is wrapped by similar functions
"""
try:
resp = self._request(shards)
if return_status_tuple:
return (self._parser(resp, full_response), True)
... | python | def request(self, shards, full_response, return_status_tuple=False):
"""Request the API
This method is wrapped by similar functions
"""
try:
resp = self._request(shards)
if return_status_tuple:
return (self._parser(resp, full_response), True)
... | Request the API
This method is wrapped by similar functions | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L119-L144 |
DolphDev/pynationstates | nationstates/objects.py | API_WRAPPER.get_shards | def get_shards(self, *args, full_response=False):
"""Get Shards"""
resp = self.request(shards=args, full_response=full_response)
return resp | python | def get_shards(self, *args, full_response=False):
"""Get Shards"""
resp = self.request(shards=args, full_response=full_response)
return resp | Get Shards | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L146-L150 |
DolphDev/pynationstates | nationstates/objects.py | API_WRAPPER.command | def command(self, command, full_response=False, **kwargs): # pragma: no cover
"""Method Interface to the command API for Nationstates"""
command = Shard(c=command)
return self.get_shards(*(command, Shard(**kwargs)), full_response=full_response) | python | def command(self, command, full_response=False, **kwargs): # pragma: no cover
"""Method Interface to the command API for Nationstates"""
command = Shard(c=command)
return self.get_shards(*(command, Shard(**kwargs)), full_response=full_response) | Method Interface to the command API for Nationstates | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L152-L155 |
DolphDev/pynationstates | nationstates/objects.py | Nation.send_telegram | def send_telegram(telegram=None, client_key=None, tgid=None, key=None): # pragma: no cover
"""Sends Telegram. Can either provide a telegram directly, or provide the api details and created internally
"""
if telegram:
pass
else:
telegram = self.api_mot... | python | def send_telegram(telegram=None, client_key=None, tgid=None, key=None): # pragma: no cover
"""Sends Telegram. Can either provide a telegram directly, or provide the api details and created internally
"""
if telegram:
pass
else:
telegram = self.api_mot... | Sends Telegram. Can either provide a telegram directly, or provide the api details and created internally | https://github.com/DolphDev/pynationstates/blob/3d5502aaae9404cf98c152fc4206742f036bf071/nationstates/objects.py#L214-L222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.