id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9,600 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.interpolate_with | def interpolate_with(self, other_tf, t):
"""Interpolate with another rigid transformation.
Parameters
----------
other_tf : :obj:`RigidTransform`
The transform to interpolate with.
t : float
The interpolation step in [0,1], where 0 favors this RigidTrans... | python | def interpolate_with(self, other_tf, t):
"""Interpolate with another rigid transformation.
Parameters
----------
other_tf : :obj:`RigidTransform`
The transform to interpolate with.
t : float
The interpolation step in [0,1], where 0 favors this RigidTrans... | [
"def",
"interpolate_with",
"(",
"self",
",",
"other_tf",
",",
"t",
")",
":",
"if",
"t",
"<",
"0",
"or",
"t",
">",
"1",
":",
"raise",
"ValueError",
"(",
"'Must interpolate between 0 and 1'",
")",
"interp_translation",
"=",
"(",
"1.0",
"-",
"t",
")",
"*",
... | Interpolate with another rigid transformation.
Parameters
----------
other_tf : :obj:`RigidTransform`
The transform to interpolate with.
t : float
The interpolation step in [0,1], where 0 favors this RigidTransform.
Returns
-------
:obj:... | [
"Interpolate",
"with",
"another",
"rigid",
"transformation",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L288-L316 |
9,601 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.linear_trajectory_to | def linear_trajectory_to(self, target_tf, traj_len):
"""Creates a trajectory of poses linearly interpolated from this tf to a target tf.
Parameters
----------
target_tf : :obj:`RigidTransform`
The RigidTransform to interpolate to.
traj_len : int
The numbe... | python | def linear_trajectory_to(self, target_tf, traj_len):
"""Creates a trajectory of poses linearly interpolated from this tf to a target tf.
Parameters
----------
target_tf : :obj:`RigidTransform`
The RigidTransform to interpolate to.
traj_len : int
The numbe... | [
"def",
"linear_trajectory_to",
"(",
"self",
",",
"target_tf",
",",
"traj_len",
")",
":",
"if",
"traj_len",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'Traj len must at least 0'",
")",
"delta_t",
"=",
"1.0",
"/",
"(",
"traj_len",
"+",
"1",
")",
"t",
"=",
... | Creates a trajectory of poses linearly interpolated from this tf to a target tf.
Parameters
----------
target_tf : :obj:`RigidTransform`
The RigidTransform to interpolate to.
traj_len : int
The number of RigidTransforms in the returned trajectory.
Return... | [
"Creates",
"a",
"trajectory",
"of",
"poses",
"linearly",
"interpolated",
"from",
"this",
"tf",
"to",
"a",
"target",
"tf",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L318-L342 |
9,602 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.apply | def apply(self, points):
"""Applies the rigid transformation to a set of 3D objects.
Parameters
----------
points : :obj:`BagOfPoints`
A set of objects to transform. Could be any subclass of BagOfPoints.
Returns
-------
:obj:`BagOfPoints`
... | python | def apply(self, points):
"""Applies the rigid transformation to a set of 3D objects.
Parameters
----------
points : :obj:`BagOfPoints`
A set of objects to transform. Could be any subclass of BagOfPoints.
Returns
-------
:obj:`BagOfPoints`
... | [
"def",
"apply",
"(",
"self",
",",
"points",
")",
":",
"if",
"not",
"isinstance",
"(",
"points",
",",
"BagOfPoints",
")",
":",
"raise",
"ValueError",
"(",
"'Rigid transformations can only be applied to bags of points'",
")",
"if",
"points",
".",
"dim",
"!=",
"3",... | Applies the rigid transformation to a set of 3D objects.
Parameters
----------
points : :obj:`BagOfPoints`
A set of objects to transform. Could be any subclass of BagOfPoints.
Returns
-------
:obj:`BagOfPoints`
A transformed set of objects of the... | [
"Applies",
"the",
"rigid",
"transformation",
"to",
"a",
"set",
"of",
"3D",
"objects",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L344-L392 |
9,603 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.dot | def dot(self, other_tf):
"""Compose this rigid transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`RigidTransform`
The other RigidTransform to compose with this one.
Returns
----... | python | def dot(self, other_tf):
"""Compose this rigid transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`RigidTransform`
The other RigidTransform to compose with this one.
Returns
----... | [
"def",
"dot",
"(",
"self",
",",
"other_tf",
")",
":",
"if",
"other_tf",
".",
"to_frame",
"!=",
"self",
".",
"from_frame",
":",
"raise",
"ValueError",
"(",
"'To frame of right hand side ({0}) must match from frame of left hand side ({1})'",
".",
"format",
"(",
"other_t... | Compose this rigid transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`RigidTransform`
The other RigidTransform to compose with this one.
Returns
-------
:obj:`RigidTransform`
... | [
"Compose",
"this",
"rigid",
"transform",
"with",
"another",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L394-L427 |
9,604 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.inverse | def inverse(self):
"""Take the inverse of the rigid transform.
Returns
-------
:obj:`RigidTransform`
The inverse of this RigidTransform.
"""
inv_rotation = self.rotation.T
inv_translation = np.dot(-self.rotation.T, self.translation)
return Rig... | python | def inverse(self):
"""Take the inverse of the rigid transform.
Returns
-------
:obj:`RigidTransform`
The inverse of this RigidTransform.
"""
inv_rotation = self.rotation.T
inv_translation = np.dot(-self.rotation.T, self.translation)
return Rig... | [
"def",
"inverse",
"(",
"self",
")",
":",
"inv_rotation",
"=",
"self",
".",
"rotation",
".",
"T",
"inv_translation",
"=",
"np",
".",
"dot",
"(",
"-",
"self",
".",
"rotation",
".",
"T",
",",
"self",
".",
"translation",
")",
"return",
"RigidTransform",
"(... | Take the inverse of the rigid transform.
Returns
-------
:obj:`RigidTransform`
The inverse of this RigidTransform. | [
"Take",
"the",
"inverse",
"of",
"the",
"rigid",
"transform",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L456-L468 |
9,605 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.save | def save(self, filename):
"""Save the RigidTransform to a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
... | python | def save(self, filename):
"""Save the RigidTransform to a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"file_ext",
".",
"lower",
"(",
")",
"!=",
"TF_EXTENSION",
":",
"raise",
"ValueError",
"(",
"'Exten... | Save the RigidTransform to a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
----------
filename : :... | [
"Save",
"the",
"RigidTransform",
"to",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L470-L502 |
9,606 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.as_frames | def as_frames(self, from_frame, to_frame='world'):
"""Return a shallow copy of this rigid transform with just the frames
changed.
Parameters
----------
from_frame : :obj:`str`
The new from_frame.
to_frame : :obj:`str`
The new to_frame.
R... | python | def as_frames(self, from_frame, to_frame='world'):
"""Return a shallow copy of this rigid transform with just the frames
changed.
Parameters
----------
from_frame : :obj:`str`
The new from_frame.
to_frame : :obj:`str`
The new to_frame.
R... | [
"def",
"as_frames",
"(",
"self",
",",
"from_frame",
",",
"to_frame",
"=",
"'world'",
")",
":",
"return",
"RigidTransform",
"(",
"self",
".",
"rotation",
",",
"self",
".",
"translation",
",",
"from_frame",
",",
"to_frame",
")"
] | Return a shallow copy of this rigid transform with just the frames
changed.
Parameters
----------
from_frame : :obj:`str`
The new from_frame.
to_frame : :obj:`str`
The new to_frame.
Returns
-------
:obj:`RigidTransform`
... | [
"Return",
"a",
"shallow",
"copy",
"of",
"this",
"rigid",
"transform",
"with",
"just",
"the",
"frames",
"changed",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L504-L521 |
9,607 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.rotation_from_quaternion | def rotation_from_quaternion(q_wxyz):
"""Convert quaternion array to rotation matrix.
Parameters
----------
q_wxyz : :obj:`numpy.ndarray` of float
A quaternion in wxyz order.
Returns
-------
:obj:`numpy.ndarray` of float
A 3x3 rotation ma... | python | def rotation_from_quaternion(q_wxyz):
"""Convert quaternion array to rotation matrix.
Parameters
----------
q_wxyz : :obj:`numpy.ndarray` of float
A quaternion in wxyz order.
Returns
-------
:obj:`numpy.ndarray` of float
A 3x3 rotation ma... | [
"def",
"rotation_from_quaternion",
"(",
"q_wxyz",
")",
":",
"q_xyzw",
"=",
"np",
".",
"array",
"(",
"[",
"q_wxyz",
"[",
"1",
"]",
",",
"q_wxyz",
"[",
"2",
"]",
",",
"q_wxyz",
"[",
"3",
"]",
",",
"q_wxyz",
"[",
"0",
"]",
"]",
")",
"R",
"=",
"tra... | Convert quaternion array to rotation matrix.
Parameters
----------
q_wxyz : :obj:`numpy.ndarray` of float
A quaternion in wxyz order.
Returns
-------
:obj:`numpy.ndarray` of float
A 3x3 rotation matrix made from the quaternion. | [
"Convert",
"quaternion",
"array",
"to",
"rotation",
"matrix",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L700-L715 |
9,608 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.quaternion_from_axis_angle | def quaternion_from_axis_angle(v):
"""Convert axis-angle representation to a quaternion vector.
Parameters
----------
v : :obj:`numpy.ndarray` of float
An axis-angle representation.
Returns
-------
:obj:`numpy.ndarray` of float
A quaterni... | python | def quaternion_from_axis_angle(v):
"""Convert axis-angle representation to a quaternion vector.
Parameters
----------
v : :obj:`numpy.ndarray` of float
An axis-angle representation.
Returns
-------
:obj:`numpy.ndarray` of float
A quaterni... | [
"def",
"quaternion_from_axis_angle",
"(",
"v",
")",
":",
"theta",
"=",
"np",
".",
"linalg",
".",
"norm",
"(",
"v",
")",
"if",
"theta",
">",
"0",
":",
"v",
"=",
"v",
"/",
"np",
".",
"linalg",
".",
"norm",
"(",
"v",
")",
"ax",
",",
"ay",
",",
"... | Convert axis-angle representation to a quaternion vector.
Parameters
----------
v : :obj:`numpy.ndarray` of float
An axis-angle representation.
Returns
-------
:obj:`numpy.ndarray` of float
A quaternion vector from the axis-angle vector. | [
"Convert",
"axis",
"-",
"angle",
"representation",
"to",
"a",
"quaternion",
"vector",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L719-L741 |
9,609 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.transform_from_dual_quaternion | def transform_from_dual_quaternion(dq, from_frame='unassigned', to_frame='world'):
"""Create a RigidTransform from a DualQuaternion.
Parameters
----------
dq : :obj:`DualQuaternion`
The DualQuaternion to transform.
from_frame : :obj:`str`
A name for the ... | python | def transform_from_dual_quaternion(dq, from_frame='unassigned', to_frame='world'):
"""Create a RigidTransform from a DualQuaternion.
Parameters
----------
dq : :obj:`DualQuaternion`
The DualQuaternion to transform.
from_frame : :obj:`str`
A name for the ... | [
"def",
"transform_from_dual_quaternion",
"(",
"dq",
",",
"from_frame",
"=",
"'unassigned'",
",",
"to_frame",
"=",
"'world'",
")",
":",
"quaternion",
"=",
"dq",
".",
"qr",
"translation",
"=",
"2",
"*",
"dq",
".",
"qd",
"[",
"1",
":",
"]",
"return",
"Rigid... | Create a RigidTransform from a DualQuaternion.
Parameters
----------
dq : :obj:`DualQuaternion`
The DualQuaternion to transform.
from_frame : :obj:`str`
A name for the frame of reference on which this transform
operates.
to_frame : :obj:`str... | [
"Create",
"a",
"RigidTransform",
"from",
"a",
"DualQuaternion",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L760-L783 |
9,610 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.rotation_and_translation_from_matrix | def rotation_and_translation_from_matrix(matrix):
"""Helper to convert 4x4 matrix to rotation matrix and translation vector.
Parameters
----------
matrix : :obj:`numpy.ndarray` of float
4x4 rigid transformation matrix to be converted.
Returns
-------
... | python | def rotation_and_translation_from_matrix(matrix):
"""Helper to convert 4x4 matrix to rotation matrix and translation vector.
Parameters
----------
matrix : :obj:`numpy.ndarray` of float
4x4 rigid transformation matrix to be converted.
Returns
-------
... | [
"def",
"rotation_and_translation_from_matrix",
"(",
"matrix",
")",
":",
"if",
"not",
"isinstance",
"(",
"matrix",
",",
"np",
".",
"ndarray",
")",
"or",
"matrix",
".",
"shape",
"[",
"0",
"]",
"!=",
"4",
"or",
"matrix",
".",
"shape",
"[",
"1",
"]",
"!=",... | Helper to convert 4x4 matrix to rotation matrix and translation vector.
Parameters
----------
matrix : :obj:`numpy.ndarray` of float
4x4 rigid transformation matrix to be converted.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
A ... | [
"Helper",
"to",
"convert",
"4x4",
"matrix",
"to",
"rotation",
"matrix",
"and",
"translation",
"vector",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L786-L809 |
9,611 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.rotation_from_axis_and_origin | def rotation_from_axis_and_origin(axis, origin, angle, to_frame='world'):
"""
Returns a rotation matrix around some arbitrary axis, about the point origin, using Rodrigues Formula
Parameters
----------
axis : :obj:`numpy.ndarray` of float
3x1 vector representing whic... | python | def rotation_from_axis_and_origin(axis, origin, angle, to_frame='world'):
"""
Returns a rotation matrix around some arbitrary axis, about the point origin, using Rodrigues Formula
Parameters
----------
axis : :obj:`numpy.ndarray` of float
3x1 vector representing whic... | [
"def",
"rotation_from_axis_and_origin",
"(",
"axis",
",",
"origin",
",",
"angle",
",",
"to_frame",
"=",
"'world'",
")",
":",
"axis_hat",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"-",
"axis",
"[",
"2",
"]",
",",
"axis",
"[",
"1",
"]",
"]",
... | Returns a rotation matrix around some arbitrary axis, about the point origin, using Rodrigues Formula
Parameters
----------
axis : :obj:`numpy.ndarray` of float
3x1 vector representing which axis we should be rotating about
origin : :obj:`numpy.ndarray` of float
... | [
"Returns",
"a",
"rotation",
"matrix",
"around",
"some",
"arbitrary",
"axis",
"about",
"the",
"point",
"origin",
"using",
"Rodrigues",
"Formula"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L812-L840 |
9,612 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.x_axis_rotation | def x_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the x axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | python | def x_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the x axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | [
"def",
"x_axis_rotation",
"(",
"theta",
")",
":",
"R",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"1",
",",
"0",
",",
"0",
",",
"]",
",",
"[",
"0",
",",
"np",
".",
"cos",
"(",
"theta",
")",
",",
"-",
"np",
".",
"sin",
"(",
"theta",
")",
"]",... | Generates a 3x3 rotation matrix for a rotation of angle
theta about the x axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix. | [
"Generates",
"a",
"3x3",
"rotation",
"matrix",
"for",
"a",
"rotation",
"of",
"angle",
"theta",
"about",
"the",
"x",
"axis",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L843-L860 |
9,613 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.y_axis_rotation | def y_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the y axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | python | def y_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the y axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | [
"def",
"y_axis_rotation",
"(",
"theta",
")",
":",
"R",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"np",
".",
"cos",
"(",
"theta",
")",
",",
"0",
",",
"np",
".",
"sin",
"(",
"theta",
")",
"]",
",",
"[",
"0",
",",
"1",
",",
"0",
"]",
",",
"[",... | Generates a 3x3 rotation matrix for a rotation of angle
theta about the y axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix. | [
"Generates",
"a",
"3x3",
"rotation",
"matrix",
"for",
"a",
"rotation",
"of",
"angle",
"theta",
"about",
"the",
"y",
"axis",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L863-L880 |
9,614 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.z_axis_rotation | def z_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the z axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | python | def z_axis_rotation(theta):
"""Generates a 3x3 rotation matrix for a rotation of angle
theta about the z axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random... | [
"def",
"z_axis_rotation",
"(",
"theta",
")",
":",
"R",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"np",
".",
"cos",
"(",
"theta",
")",
",",
"-",
"np",
".",
"sin",
"(",
"theta",
")",
",",
"0",
"]",
",",
"[",
"np",
".",
"sin",
"(",
"theta",
")",... | Generates a 3x3 rotation matrix for a rotation of angle
theta about the z axis.
Parameters
----------
theta : float
amount to rotate, in radians
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix. | [
"Generates",
"a",
"3x3",
"rotation",
"matrix",
"for",
"a",
"rotation",
"of",
"angle",
"theta",
"about",
"the",
"z",
"axis",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L883-L900 |
9,615 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.random_rotation | def random_rotation():
"""Generates a random 3x3 rotation matrix with SVD.
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix.
"""
rand_seed = np.random.rand(3, 3)
U, S, V = np.linalg.svd(rand_seed)
return U | python | def random_rotation():
"""Generates a random 3x3 rotation matrix with SVD.
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix.
"""
rand_seed = np.random.rand(3, 3)
U, S, V = np.linalg.svd(rand_seed)
return U | [
"def",
"random_rotation",
"(",
")",
":",
"rand_seed",
"=",
"np",
".",
"random",
".",
"rand",
"(",
"3",
",",
"3",
")",
"U",
",",
"S",
",",
"V",
"=",
"np",
".",
"linalg",
".",
"svd",
"(",
"rand_seed",
")",
"return",
"U"
] | Generates a random 3x3 rotation matrix with SVD.
Returns
-------
:obj:`numpy.ndarray` of float
A random 3x3 rotation matrix. | [
"Generates",
"a",
"random",
"3x3",
"rotation",
"matrix",
"with",
"SVD",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L903-L913 |
9,616 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.rotation_from_axes | def rotation_from_axes(x_axis, y_axis, z_axis):
"""Convert specification of axis in target frame to
a rotation matrix from source to target frame.
Parameters
----------
x_axis : :obj:`numpy.ndarray` of float
A normalized 3-vector for the target frame's x-axis.
... | python | def rotation_from_axes(x_axis, y_axis, z_axis):
"""Convert specification of axis in target frame to
a rotation matrix from source to target frame.
Parameters
----------
x_axis : :obj:`numpy.ndarray` of float
A normalized 3-vector for the target frame's x-axis.
... | [
"def",
"rotation_from_axes",
"(",
"x_axis",
",",
"y_axis",
",",
"z_axis",
")",
":",
"return",
"np",
".",
"hstack",
"(",
"(",
"x_axis",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
",",
"y_axis",
"[",
":",
",",
"np",
".",
"newaxis",
"]",
",",
"z_axis",... | Convert specification of axis in target frame to
a rotation matrix from source to target frame.
Parameters
----------
x_axis : :obj:`numpy.ndarray` of float
A normalized 3-vector for the target frame's x-axis.
y_axis : :obj:`numpy.ndarray` of float
A nor... | [
"Convert",
"specification",
"of",
"axis",
"in",
"target",
"frame",
"to",
"a",
"rotation",
"matrix",
"from",
"source",
"to",
"target",
"frame",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L927-L948 |
9,617 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.interpolate | def interpolate(T0, T1, t):
"""Return an interpolation of two RigidTransforms.
Parameters
----------
T0 : :obj:`RigidTransform`
The first RigidTransform to interpolate.
T1 : :obj:`RigidTransform`
The second RigidTransform to interpolate.
t : flo... | python | def interpolate(T0, T1, t):
"""Return an interpolation of two RigidTransforms.
Parameters
----------
T0 : :obj:`RigidTransform`
The first RigidTransform to interpolate.
T1 : :obj:`RigidTransform`
The second RigidTransform to interpolate.
t : flo... | [
"def",
"interpolate",
"(",
"T0",
",",
"T1",
",",
"t",
")",
":",
"if",
"T0",
".",
"to_frame",
"!=",
"T1",
".",
"to_frame",
":",
"raise",
"ValueError",
"(",
"'Cannot interpolate between 2 transforms with different to frames! Got T1 {0} and T2 {1}'",
".",
"format",
"("... | Return an interpolation of two RigidTransforms.
Parameters
----------
T0 : :obj:`RigidTransform`
The first RigidTransform to interpolate.
T1 : :obj:`RigidTransform`
The second RigidTransform to interpolate.
t : float
The interpolation step i... | [
"Return",
"an",
"interpolation",
"of",
"two",
"RigidTransforms",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L973-L1004 |
9,618 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | RigidTransform.load | def load(filename):
"""Load a RigidTransform from a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
... | python | def load(filename):
"""Load a RigidTransform from a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
... | [
"def",
"load",
"(",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"file_ext",
".",
"lower",
"(",
")",
"!=",
"TF_EXTENSION",
":",
"raise",
"ValueError",
"(",
"'Extension %s not suppo... | Load a RigidTransform from a file.
The file format is:
from_frame
to_frame
translation (space separated)
rotation_row_0 (space separated)
rotation_row_1 (space separated)
rotation_row_2 (space separated)
Parameters
----------
filename : :... | [
"Load",
"a",
"RigidTransform",
"from",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L1007-L1066 |
9,619 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | SimilarityTransform.dot | def dot(self, other_tf):
"""Compose this simliarity transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`SimilarityTransform`
The other SimilarityTransform to compose with this one.
Retur... | python | def dot(self, other_tf):
"""Compose this simliarity transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`SimilarityTransform`
The other SimilarityTransform to compose with this one.
Retur... | [
"def",
"dot",
"(",
"self",
",",
"other_tf",
")",
":",
"if",
"other_tf",
".",
"to_frame",
"!=",
"self",
".",
"from_frame",
":",
"raise",
"ValueError",
"(",
"'To frame of right hand side ({0}) must match from frame of left hand side ({1})'",
".",
"format",
"(",
"other_t... | Compose this simliarity transform with another.
This transform is on the left-hand side of the composition.
Parameters
----------
other_tf : :obj:`SimilarityTransform`
The other SimilarityTransform to compose with this one.
Returns
-------
:obj:`Sim... | [
"Compose",
"this",
"simliarity",
"transform",
"with",
"another",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L1187-L1222 |
9,620 | BerkeleyAutomation/autolab_core | autolab_core/rigid_transformations.py | SimilarityTransform.inverse | def inverse(self):
"""Take the inverse of the similarity transform.
Returns
-------
:obj:`SimilarityTransform`
The inverse of this SimilarityTransform.
"""
inv_rot = np.linalg.inv(self.rotation)
inv_scale = 1.0 / self.scale
inv_trans = -inv_sc... | python | def inverse(self):
"""Take the inverse of the similarity transform.
Returns
-------
:obj:`SimilarityTransform`
The inverse of this SimilarityTransform.
"""
inv_rot = np.linalg.inv(self.rotation)
inv_scale = 1.0 / self.scale
inv_trans = -inv_sc... | [
"def",
"inverse",
"(",
"self",
")",
":",
"inv_rot",
"=",
"np",
".",
"linalg",
".",
"inv",
"(",
"self",
".",
"rotation",
")",
"inv_scale",
"=",
"1.0",
"/",
"self",
".",
"scale",
"inv_trans",
"=",
"-",
"inv_scale",
"*",
"inv_rot",
".",
"dot",
"(",
"s... | Take the inverse of the similarity transform.
Returns
-------
:obj:`SimilarityTransform`
The inverse of this SimilarityTransform. | [
"Take",
"the",
"inverse",
"of",
"the",
"similarity",
"transform",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/rigid_transformations.py#L1224-L1237 |
9,621 | BerkeleyAutomation/autolab_core | autolab_core/points.py | BagOfPoints.save | def save(self, filename):
"""Saves the collection to a file.
Parameters
----------
filename : :obj:`str`
The file to save the collection to.
Raises
------
ValueError
If the file extension is not .npy or .npz.
"""
file_root... | python | def save(self, filename):
"""Saves the collection to a file.
Parameters
----------
filename : :obj:`str`
The file to save the collection to.
Raises
------
ValueError
If the file extension is not .npy or .npz.
"""
file_root... | [
"def",
"save",
"(",
"self",
",",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"file_ext",
"==",
"'.npy'",
":",
"np",
".",
"save",
"(",
"filename",
",",
"self",
".",
"_data",
... | Saves the collection to a file.
Parameters
----------
filename : :obj:`str`
The file to save the collection to.
Raises
------
ValueError
If the file extension is not .npy or .npz. | [
"Saves",
"the",
"collection",
"to",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L112-L131 |
9,622 | BerkeleyAutomation/autolab_core | autolab_core/points.py | BagOfPoints.load_data | def load_data(filename):
"""Loads data from a file.
Parameters
----------
filename : :obj:`str`
The file to load the collection from.
Returns
-------
:obj:`numpy.ndarray` of float
The data read from the file.
Raises
-----... | python | def load_data(filename):
"""Loads data from a file.
Parameters
----------
filename : :obj:`str`
The file to load the collection from.
Returns
-------
:obj:`numpy.ndarray` of float
The data read from the file.
Raises
-----... | [
"def",
"load_data",
"(",
"filename",
")",
":",
"file_root",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"data",
"=",
"None",
"if",
"file_ext",
"==",
"'.npy'",
":",
"data",
"=",
"np",
".",
"load",
"(",
"filename",
"... | Loads data from a file.
Parameters
----------
filename : :obj:`str`
The file to load the collection from.
Returns
-------
:obj:`numpy.ndarray` of float
The data read from the file.
Raises
------
ValueError
If ... | [
"Loads",
"data",
"from",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L133-L159 |
9,623 | BerkeleyAutomation/autolab_core | autolab_core/points.py | Point.open | def open(filename, frame='unspecified'):
"""Create a Point from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created point.
Returns
-------
... | python | def open(filename, frame='unspecified'):
"""Create a Point from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created point.
Returns
-------
... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"Point",
"(",
"data",
",",
"frame",
")"
] | Create a Point from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created point.
Returns
-------
:obj:`Point`
A point created from t... | [
"Create",
"a",
"Point",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L371-L388 |
9,624 | BerkeleyAutomation/autolab_core | autolab_core/points.py | Direction._check_valid_data | def _check_valid_data(self, data):
"""Checks that the incoming data is a Nx1 ndarray.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to verify.
Raises
------
ValueError
If the data is not of the correct shape or if the vector ... | python | def _check_valid_data(self, data):
"""Checks that the incoming data is a Nx1 ndarray.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to verify.
Raises
------
ValueError
If the data is not of the correct shape or if the vector ... | [
"def",
"_check_valid_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"len",
"(",
"data",
".",
"shape",
")",
"==",
"2",
"and",
"data",
".",
"shape",
"[",
"1",
"]",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"'Can only initialize Direction from a single Nx... | Checks that the incoming data is a Nx1 ndarray.
Parameters
----------
data : :obj:`numpy.ndarray`
The data to verify.
Raises
------
ValueError
If the data is not of the correct shape or if the vector is not
normed. | [
"Checks",
"that",
"the",
"incoming",
"data",
"is",
"a",
"Nx1",
"ndarray",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L405-L422 |
9,625 | BerkeleyAutomation/autolab_core | autolab_core/points.py | Direction.orthogonal_basis | def orthogonal_basis(self):
"""Return an orthogonal basis to this direction.
Note
----
Only implemented in 3D.
Returns
-------
:obj:`tuple` of :obj:`Direction`
The pair of normalized Direction vectors that form a basis of
this directi... | python | def orthogonal_basis(self):
"""Return an orthogonal basis to this direction.
Note
----
Only implemented in 3D.
Returns
-------
:obj:`tuple` of :obj:`Direction`
The pair of normalized Direction vectors that form a basis of
this directi... | [
"def",
"orthogonal_basis",
"(",
"self",
")",
":",
"if",
"self",
".",
"dim",
"==",
"3",
":",
"x_arr",
"=",
"np",
".",
"array",
"(",
"[",
"-",
"self",
".",
"data",
"[",
"1",
"]",
",",
"self",
".",
"data",
"[",
"0",
"]",
",",
"0",
"]",
")",
"i... | Return an orthogonal basis to this direction.
Note
----
Only implemented in 3D.
Returns
-------
:obj:`tuple` of :obj:`Direction`
The pair of normalized Direction vectors that form a basis of
this direction's orthogonal complement.
Ra... | [
"Return",
"an",
"orthogonal",
"basis",
"to",
"this",
"direction",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L424-L449 |
9,626 | BerkeleyAutomation/autolab_core | autolab_core/points.py | Direction.open | def open(filename, frame='unspecified'):
"""Create a Direction from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created Direction.
Returns
---... | python | def open(filename, frame='unspecified'):
"""Create a Direction from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created Direction.
Returns
---... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"Direction",
"(",
"data",
",",
"frame",
")"
] | Create a Direction from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created Direction.
Returns
-------
:obj:`Direction`
A Directio... | [
"Create",
"a",
"Direction",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L452-L469 |
9,627 | BerkeleyAutomation/autolab_core | autolab_core/points.py | Plane3D.split_points | def split_points(self, point_cloud):
"""Split a point cloud into two along this plane.
Parameters
----------
point_cloud : :obj:`PointCloud`
The PointCloud to divide in two.
Returns
-------
:obj:`tuple` of :obj:`PointCloud`
Two new PointC... | python | def split_points(self, point_cloud):
"""Split a point cloud into two along this plane.
Parameters
----------
point_cloud : :obj:`PointCloud`
The PointCloud to divide in two.
Returns
-------
:obj:`tuple` of :obj:`PointCloud`
Two new PointC... | [
"def",
"split_points",
"(",
"self",
",",
"point_cloud",
")",
":",
"if",
"not",
"isinstance",
"(",
"point_cloud",
",",
"PointCloud",
")",
":",
"raise",
"ValueError",
"(",
"'Can only split point clouds'",
")",
"# compute indices above and below",
"above_plane",
"=",
"... | Split a point cloud into two along this plane.
Parameters
----------
point_cloud : :obj:`PointCloud`
The PointCloud to divide in two.
Returns
-------
:obj:`tuple` of :obj:`PointCloud`
Two new PointCloud objects. The first contains points above th... | [
"Split",
"a",
"point",
"cloud",
"into",
"two",
"along",
"this",
"plane",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L498-L528 |
9,628 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.mean | def mean(self):
"""Returns the average point in the cloud.
Returns
-------
:obj:`Point`
The mean point in the PointCloud.
"""
mean_point_data = np.mean(self._data, axis=1)
return Point(mean_point_data, self._frame) | python | def mean(self):
"""Returns the average point in the cloud.
Returns
-------
:obj:`Point`
The mean point in the PointCloud.
"""
mean_point_data = np.mean(self._data, axis=1)
return Point(mean_point_data, self._frame) | [
"def",
"mean",
"(",
"self",
")",
":",
"mean_point_data",
"=",
"np",
".",
"mean",
"(",
"self",
".",
"_data",
",",
"axis",
"=",
"1",
")",
"return",
"Point",
"(",
"mean_point_data",
",",
"self",
".",
"_frame",
")"
] | Returns the average point in the cloud.
Returns
-------
:obj:`Point`
The mean point in the PointCloud. | [
"Returns",
"the",
"average",
"point",
"in",
"the",
"cloud",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L587-L596 |
9,629 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.subsample | def subsample(self, rate, random=False):
"""Returns a subsampled version of the PointCloud.
Parameters
----------
rate : int
Only every rate-th element of the PointCloud is returned.
Returns
-------
:obj:`PointCloud`
A subsampled point cl... | python | def subsample(self, rate, random=False):
"""Returns a subsampled version of the PointCloud.
Parameters
----------
rate : int
Only every rate-th element of the PointCloud is returned.
Returns
-------
:obj:`PointCloud`
A subsampled point cl... | [
"def",
"subsample",
"(",
"self",
",",
"rate",
",",
"random",
"=",
"False",
")",
":",
"if",
"type",
"(",
"rate",
")",
"!=",
"int",
"and",
"rate",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'Can only subsample with strictly positive integer rate'",
")",
"indi... | Returns a subsampled version of the PointCloud.
Parameters
----------
rate : int
Only every rate-th element of the PointCloud is returned.
Returns
-------
:obj:`PointCloud`
A subsampled point cloud with N / rate total samples.
Raises
... | [
"Returns",
"a",
"subsampled",
"version",
"of",
"the",
"PointCloud",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L598-L623 |
9,630 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.box_mask | def box_mask(self, box):
"""Return a PointCloud containing only points within the given Box.
Parameters
----------
box : :obj:`Box`
A box whose boundaries are used to filter points.
Returns
-------
:obj:`PointCloud`
A filtered PointCloud ... | python | def box_mask(self, box):
"""Return a PointCloud containing only points within the given Box.
Parameters
----------
box : :obj:`Box`
A box whose boundaries are used to filter points.
Returns
-------
:obj:`PointCloud`
A filtered PointCloud ... | [
"def",
"box_mask",
"(",
"self",
",",
"box",
")",
":",
"if",
"not",
"isinstance",
"(",
"box",
",",
"Box",
")",
":",
"raise",
"ValueError",
"(",
"'Must provide Box object'",
")",
"if",
"box",
".",
"frame",
"!=",
"self",
".",
"frame",
":",
"raise",
"Value... | Return a PointCloud containing only points within the given Box.
Parameters
----------
box : :obj:`Box`
A box whose boundaries are used to filter points.
Returns
-------
:obj:`PointCloud`
A filtered PointCloud whose points are all in the given bo... | [
"Return",
"a",
"PointCloud",
"containing",
"only",
"points",
"within",
"the",
"given",
"Box",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L625-L655 |
9,631 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.best_fit_plane | def best_fit_plane(self):
"""Fits a plane to the point cloud using least squares.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
A normal vector to and point in the fitted plane.
"""
X = np.c_[self.x_coords, self.y_coords, np.ones(self.num_poin... | python | def best_fit_plane(self):
"""Fits a plane to the point cloud using least squares.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
A normal vector to and point in the fitted plane.
"""
X = np.c_[self.x_coords, self.y_coords, np.ones(self.num_poin... | [
"def",
"best_fit_plane",
"(",
"self",
")",
":",
"X",
"=",
"np",
".",
"c_",
"[",
"self",
".",
"x_coords",
",",
"self",
".",
"y_coords",
",",
"np",
".",
"ones",
"(",
"self",
".",
"num_points",
")",
"]",
"y",
"=",
"self",
".",
"z_coords",
"A",
"=",
... | Fits a plane to the point cloud using least squares.
Returns
-------
:obj:`tuple` of :obj:`numpy.ndarray` of float
A normal vector to and point in the fitted plane. | [
"Fits",
"a",
"plane",
"to",
"the",
"point",
"cloud",
"using",
"least",
"squares",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L657-L674 |
9,632 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.remove_zero_points | def remove_zero_points(self):
"""Removes points with a zero in the z-axis.
Note
----
This returns nothing and updates the PointCloud in-place.
"""
points_of_interest = np.where(self.z_coords != 0.0)[0]
self._data = self.data[:, points_of_interest] | python | def remove_zero_points(self):
"""Removes points with a zero in the z-axis.
Note
----
This returns nothing and updates the PointCloud in-place.
"""
points_of_interest = np.where(self.z_coords != 0.0)[0]
self._data = self.data[:, points_of_interest] | [
"def",
"remove_zero_points",
"(",
"self",
")",
":",
"points_of_interest",
"=",
"np",
".",
"where",
"(",
"self",
".",
"z_coords",
"!=",
"0.0",
")",
"[",
"0",
"]",
"self",
".",
"_data",
"=",
"self",
".",
"data",
"[",
":",
",",
"points_of_interest",
"]"
] | Removes points with a zero in the z-axis.
Note
----
This returns nothing and updates the PointCloud in-place. | [
"Removes",
"points",
"with",
"a",
"zero",
"in",
"the",
"z",
"-",
"axis",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L687-L695 |
9,633 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.remove_infinite_points | def remove_infinite_points(self):
"""Removes infinite points.
Note
----
This returns nothing and updates the PointCloud in-place.
"""
points_of_interest = np.where(np.all(np.isfinite(self.data), axis=0))[0]
self._data = self.data[:, points_of_interest] | python | def remove_infinite_points(self):
"""Removes infinite points.
Note
----
This returns nothing and updates the PointCloud in-place.
"""
points_of_interest = np.where(np.all(np.isfinite(self.data), axis=0))[0]
self._data = self.data[:, points_of_interest] | [
"def",
"remove_infinite_points",
"(",
"self",
")",
":",
"points_of_interest",
"=",
"np",
".",
"where",
"(",
"np",
".",
"all",
"(",
"np",
".",
"isfinite",
"(",
"self",
".",
"data",
")",
",",
"axis",
"=",
"0",
")",
")",
"[",
"0",
"]",
"self",
".",
... | Removes infinite points.
Note
----
This returns nothing and updates the PointCloud in-place. | [
"Removes",
"infinite",
"points",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L697-L705 |
9,634 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointCloud.open | def open(filename, frame='unspecified'):
"""Create a PointCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created PointCloud.
Returns
-... | python | def open(filename, frame='unspecified'):
"""Create a PointCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created PointCloud.
Returns
-... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"PointCloud",
"(",
"data",
",",
"frame",
")"
] | Create a PointCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created PointCloud.
Returns
-------
:obj:`PointCloud`
A Point... | [
"Create",
"a",
"PointCloud",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L817-L834 |
9,635 | BerkeleyAutomation/autolab_core | autolab_core/points.py | NormalCloud.subsample | def subsample(self, rate):
"""Returns a subsampled version of the NormalCloud.
Parameters
----------
rate : int
Only every rate-th element of the NormalCloud is returned.
Returns
-------
:obj:`RateCloud`
A subsampled point cloud with N / ... | python | def subsample(self, rate):
"""Returns a subsampled version of the NormalCloud.
Parameters
----------
rate : int
Only every rate-th element of the NormalCloud is returned.
Returns
-------
:obj:`RateCloud`
A subsampled point cloud with N / ... | [
"def",
"subsample",
"(",
"self",
",",
"rate",
")",
":",
"if",
"type",
"(",
"rate",
")",
"!=",
"int",
"and",
"rate",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'Can only subsample with strictly positive integer rate'",
")",
"subsample_inds",
"=",
"np",
".",
... | Returns a subsampled version of the NormalCloud.
Parameters
----------
rate : int
Only every rate-th element of the NormalCloud is returned.
Returns
-------
:obj:`RateCloud`
A subsampled point cloud with N / rate total samples.
Raises
... | [
"Returns",
"a",
"subsampled",
"version",
"of",
"the",
"NormalCloud",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L897-L919 |
9,636 | BerkeleyAutomation/autolab_core | autolab_core/points.py | NormalCloud.remove_zero_normals | def remove_zero_normals(self):
"""Removes normal vectors with a zero magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where(np.linalg.norm(self._data, axis=0) != 0.0)[0]
self._data = self._data[:, points_... | python | def remove_zero_normals(self):
"""Removes normal vectors with a zero magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where(np.linalg.norm(self._data, axis=0) != 0.0)[0]
self._data = self._data[:, points_... | [
"def",
"remove_zero_normals",
"(",
"self",
")",
":",
"points_of_interest",
"=",
"np",
".",
"where",
"(",
"np",
".",
"linalg",
".",
"norm",
"(",
"self",
".",
"_data",
",",
"axis",
"=",
"0",
")",
"!=",
"0.0",
")",
"[",
"0",
"]",
"self",
".",
"_data",... | Removes normal vectors with a zero magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place. | [
"Removes",
"normal",
"vectors",
"with",
"a",
"zero",
"magnitude",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L921-L929 |
9,637 | BerkeleyAutomation/autolab_core | autolab_core/points.py | NormalCloud.remove_nan_normals | def remove_nan_normals(self):
"""Removes normal vectors with nan magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where(np.isfinite(np.linalg.norm(self._data, axis=0)))[0]
self._data = self._data[:, point... | python | def remove_nan_normals(self):
"""Removes normal vectors with nan magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where(np.isfinite(np.linalg.norm(self._data, axis=0)))[0]
self._data = self._data[:, point... | [
"def",
"remove_nan_normals",
"(",
"self",
")",
":",
"points_of_interest",
"=",
"np",
".",
"where",
"(",
"np",
".",
"isfinite",
"(",
"np",
".",
"linalg",
".",
"norm",
"(",
"self",
".",
"_data",
",",
"axis",
"=",
"0",
")",
")",
")",
"[",
"0",
"]",
... | Removes normal vectors with nan magnitude.
Note
----
This returns nothing and updates the NormalCloud in-place. | [
"Removes",
"normal",
"vectors",
"with",
"nan",
"magnitude",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L931-L939 |
9,638 | BerkeleyAutomation/autolab_core | autolab_core/points.py | NormalCloud.open | def open(filename, frame='unspecified'):
"""Create a NormalCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created NormalCloud.
Returns
... | python | def open(filename, frame='unspecified'):
"""Create a NormalCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created NormalCloud.
Returns
... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"NormalCloud",
"(",
"data",
",",
"frame",
")"
] | Create a NormalCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created NormalCloud.
Returns
-------
:obj:`NormalCloud`
A No... | [
"Create",
"a",
"NormalCloud",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L942-L959 |
9,639 | BerkeleyAutomation/autolab_core | autolab_core/points.py | ImageCoords.open | def open(filename, frame='unspecified'):
"""Create an ImageCoords from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created ImageCoords.
Returns
... | python | def open(filename, frame='unspecified'):
"""Create an ImageCoords from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created ImageCoords.
Returns
... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"ImageCoords",
"(",
"data",
",",
"frame",
")"
] | Create an ImageCoords from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created ImageCoords.
Returns
-------
:obj:`ImageCoords`
An ... | [
"Create",
"an",
"ImageCoords",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L1015-L1032 |
9,640 | BerkeleyAutomation/autolab_core | autolab_core/points.py | RgbCloud.open | def open(filename, frame='unspecified'):
"""Create a RgbCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created RgbCloud.
Returns
-----... | python | def open(filename, frame='unspecified'):
"""Create a RgbCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created RgbCloud.
Returns
-----... | [
"def",
"open",
"(",
"filename",
",",
"frame",
"=",
"'unspecified'",
")",
":",
"data",
"=",
"BagOfPoints",
".",
"load_data",
"(",
"filename",
")",
"return",
"RgbCloud",
"(",
"data",
",",
"frame",
")"
] | Create a RgbCloud from data saved in a file.
Parameters
----------
filename : :obj:`str`
The file to load data from.
frame : :obj:`str`
The frame to apply to the created RgbCloud.
Returns
-------
:obj:`RgbCloud`
A RgdCloud cr... | [
"Create",
"a",
"RgbCloud",
"from",
"data",
"saved",
"in",
"a",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L1093-L1110 |
9,641 | BerkeleyAutomation/autolab_core | autolab_core/points.py | PointNormalCloud.remove_zero_points | def remove_zero_points(self):
"""Remove all elements where the norms and points are zero.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where((np.linalg.norm(self.point_cloud.data, axis=0) != 0.0) &
... | python | def remove_zero_points(self):
"""Remove all elements where the norms and points are zero.
Note
----
This returns nothing and updates the NormalCloud in-place.
"""
points_of_interest = np.where((np.linalg.norm(self.point_cloud.data, axis=0) != 0.0) &
... | [
"def",
"remove_zero_points",
"(",
"self",
")",
":",
"points_of_interest",
"=",
"np",
".",
"where",
"(",
"(",
"np",
".",
"linalg",
".",
"norm",
"(",
"self",
".",
"point_cloud",
".",
"data",
",",
"axis",
"=",
"0",
")",
"!=",
"0.0",
")",
"&",
"(",
"np... | Remove all elements where the norms and points are zero.
Note
----
This returns nothing and updates the NormalCloud in-place. | [
"Remove",
"all",
"elements",
"where",
"the",
"norms",
"and",
"points",
"are",
"zero",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/points.py#L1201-L1212 |
9,642 | BerkeleyAutomation/autolab_core | autolab_core/experiment_logger.py | ExperimentLogger.gen_experiment_ref | def gen_experiment_ref(experiment_tag, n=10):
""" Generate a random string for naming.
Parameters
----------
experiment_tag : :obj:`str`
tag to prefix name with
n : int
number of random chars to use
Returns
-------
:obj:`str`
... | python | def gen_experiment_ref(experiment_tag, n=10):
""" Generate a random string for naming.
Parameters
----------
experiment_tag : :obj:`str`
tag to prefix name with
n : int
number of random chars to use
Returns
-------
:obj:`str`
... | [
"def",
"gen_experiment_ref",
"(",
"experiment_tag",
",",
"n",
"=",
"10",
")",
":",
"experiment_id",
"=",
"gen_experiment_id",
"(",
"n",
"=",
"n",
")",
"return",
"'{0}_{1}'",
".",
"format",
"(",
"experiment_tag",
",",
"experiment_id",
")"
] | Generate a random string for naming.
Parameters
----------
experiment_tag : :obj:`str`
tag to prefix name with
n : int
number of random chars to use
Returns
-------
:obj:`str`
string experiment ref | [
"Generate",
"a",
"random",
"string",
"for",
"naming",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/experiment_logger.py#L82-L98 |
9,643 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.add | def add(self, datapoint):
""" Adds the datapoint to the tensor if room is available. """
if not self.is_full:
self.set_datapoint(self.cur_index, datapoint)
self.cur_index += 1 | python | def add(self, datapoint):
""" Adds the datapoint to the tensor if room is available. """
if not self.is_full:
self.set_datapoint(self.cur_index, datapoint)
self.cur_index += 1 | [
"def",
"add",
"(",
"self",
",",
"datapoint",
")",
":",
"if",
"not",
"self",
".",
"is_full",
":",
"self",
".",
"set_datapoint",
"(",
"self",
".",
"cur_index",
",",
"datapoint",
")",
"self",
".",
"cur_index",
"+=",
"1"
] | Adds the datapoint to the tensor if room is available. | [
"Adds",
"the",
"datapoint",
"to",
"the",
"tensor",
"if",
"room",
"is",
"available",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L121-L125 |
9,644 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.add_batch | def add_batch(self, datapoints):
""" Adds a batch of datapoints to the tensor if room is available. """
num_datapoints_to_add = datapoints.shape[0]
end_index = self.cur_index + num_datapoints_to_add
if end_index <= self.num_datapoints:
self.data[self.cur_index:end_index,...] ... | python | def add_batch(self, datapoints):
""" Adds a batch of datapoints to the tensor if room is available. """
num_datapoints_to_add = datapoints.shape[0]
end_index = self.cur_index + num_datapoints_to_add
if end_index <= self.num_datapoints:
self.data[self.cur_index:end_index,...] ... | [
"def",
"add_batch",
"(",
"self",
",",
"datapoints",
")",
":",
"num_datapoints_to_add",
"=",
"datapoints",
".",
"shape",
"[",
"0",
"]",
"end_index",
"=",
"self",
".",
"cur_index",
"+",
"num_datapoints_to_add",
"if",
"end_index",
"<=",
"self",
".",
"num_datapoin... | Adds a batch of datapoints to the tensor if room is available. | [
"Adds",
"a",
"batch",
"of",
"datapoints",
"to",
"the",
"tensor",
"if",
"room",
"is",
"available",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L127-L133 |
9,645 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.datapoint | def datapoint(self, ind):
""" Returns the datapoint at the given index. """
if self.height is None:
return self.data[ind]
return self.data[ind, ...].copy() | python | def datapoint(self, ind):
""" Returns the datapoint at the given index. """
if self.height is None:
return self.data[ind]
return self.data[ind, ...].copy() | [
"def",
"datapoint",
"(",
"self",
",",
"ind",
")",
":",
"if",
"self",
".",
"height",
"is",
"None",
":",
"return",
"self",
".",
"data",
"[",
"ind",
"]",
"return",
"self",
".",
"data",
"[",
"ind",
",",
"...",
"]",
".",
"copy",
"(",
")"
] | Returns the datapoint at the given index. | [
"Returns",
"the",
"datapoint",
"at",
"the",
"given",
"index",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L141-L145 |
9,646 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.set_datapoint | def set_datapoint(self, ind, datapoint):
""" Sets the value of the datapoint at the given index. """
if ind >= self.num_datapoints:
raise ValueError('Index %d out of bounds! Tensor has %d datapoints' %(ind, self.num_datapoints))
self.data[ind, ...] = np.array(datapoint).astype(self.d... | python | def set_datapoint(self, ind, datapoint):
""" Sets the value of the datapoint at the given index. """
if ind >= self.num_datapoints:
raise ValueError('Index %d out of bounds! Tensor has %d datapoints' %(ind, self.num_datapoints))
self.data[ind, ...] = np.array(datapoint).astype(self.d... | [
"def",
"set_datapoint",
"(",
"self",
",",
"ind",
",",
"datapoint",
")",
":",
"if",
"ind",
">=",
"self",
".",
"num_datapoints",
":",
"raise",
"ValueError",
"(",
"'Index %d out of bounds! Tensor has %d datapoints'",
"%",
"(",
"ind",
",",
"self",
".",
"num_datapoin... | Sets the value of the datapoint at the given index. | [
"Sets",
"the",
"value",
"of",
"the",
"datapoint",
"at",
"the",
"given",
"index",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L147-L151 |
9,647 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.data_slice | def data_slice(self, slice_ind):
""" Returns a slice of datapoints """
if self.height is None:
return self.data[slice_ind]
return self.data[slice_ind, ...] | python | def data_slice(self, slice_ind):
""" Returns a slice of datapoints """
if self.height is None:
return self.data[slice_ind]
return self.data[slice_ind, ...] | [
"def",
"data_slice",
"(",
"self",
",",
"slice_ind",
")",
":",
"if",
"self",
".",
"height",
"is",
"None",
":",
"return",
"self",
".",
"data",
"[",
"slice_ind",
"]",
"return",
"self",
".",
"data",
"[",
"slice_ind",
",",
"...",
"]"
] | Returns a slice of datapoints | [
"Returns",
"a",
"slice",
"of",
"datapoints"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L153-L157 |
9,648 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.save | def save(self, filename, compressed=True):
""" Save a tensor to disk. """
# check for data
if not self.has_data:
return False
# read ext and save accordingly
_, file_ext = os.path.splitext(filename)
if compressed:
if file_ext != COMPRESSED_TENSOR_... | python | def save(self, filename, compressed=True):
""" Save a tensor to disk. """
# check for data
if not self.has_data:
return False
# read ext and save accordingly
_, file_ext = os.path.splitext(filename)
if compressed:
if file_ext != COMPRESSED_TENSOR_... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"compressed",
"=",
"True",
")",
":",
"# check for data",
"if",
"not",
"self",
".",
"has_data",
":",
"return",
"False",
"# read ext and save accordingly",
"_",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"... | Save a tensor to disk. | [
"Save",
"a",
"tensor",
"to",
"disk",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L159-L176 |
9,649 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | Tensor.load | def load(filename, compressed=True, prealloc=None):
""" Loads a tensor from disk. """
# switch load based on file ext
_, file_ext = os.path.splitext(filename)
if compressed:
if file_ext != COMPRESSED_TENSOR_EXT:
raise ValueError('Can only load compressed tenso... | python | def load(filename, compressed=True, prealloc=None):
""" Loads a tensor from disk. """
# switch load based on file ext
_, file_ext = os.path.splitext(filename)
if compressed:
if file_ext != COMPRESSED_TENSOR_EXT:
raise ValueError('Can only load compressed tenso... | [
"def",
"load",
"(",
"filename",
",",
"compressed",
"=",
"True",
",",
"prealloc",
"=",
"None",
")",
":",
"# switch load based on file ext",
"_",
",",
"file_ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"compressed",
":",
"if",
... | Loads a tensor from disk. | [
"Loads",
"a",
"tensor",
"from",
"disk",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L179-L200 |
9,650 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.datapoint_indices_for_tensor | def datapoint_indices_for_tensor(self, tensor_index):
""" Returns the indices for all datapoints in the given tensor. """
if tensor_index >= self._num_tensors:
raise ValueError('Tensor index %d is greater than the number of tensors (%d)' %(tensor_index, self._num_tensors))
return sel... | python | def datapoint_indices_for_tensor(self, tensor_index):
""" Returns the indices for all datapoints in the given tensor. """
if tensor_index >= self._num_tensors:
raise ValueError('Tensor index %d is greater than the number of tensors (%d)' %(tensor_index, self._num_tensors))
return sel... | [
"def",
"datapoint_indices_for_tensor",
"(",
"self",
",",
"tensor_index",
")",
":",
"if",
"tensor_index",
">=",
"self",
".",
"_num_tensors",
":",
"raise",
"ValueError",
"(",
"'Tensor index %d is greater than the number of tensors (%d)'",
"%",
"(",
"tensor_index",
",",
"s... | Returns the indices for all datapoints in the given tensor. | [
"Returns",
"the",
"indices",
"for",
"all",
"datapoints",
"in",
"the",
"given",
"tensor",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L415-L419 |
9,651 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.tensor_index | def tensor_index(self, datapoint_index):
""" Returns the index of the tensor containing the referenced datapoint. """
if datapoint_index >= self._num_datapoints:
raise ValueError('Datapoint index %d is greater than the number of datapoints (%d)' %(datapoint_index, self._num_datapoints))
... | python | def tensor_index(self, datapoint_index):
""" Returns the index of the tensor containing the referenced datapoint. """
if datapoint_index >= self._num_datapoints:
raise ValueError('Datapoint index %d is greater than the number of datapoints (%d)' %(datapoint_index, self._num_datapoints))
... | [
"def",
"tensor_index",
"(",
"self",
",",
"datapoint_index",
")",
":",
"if",
"datapoint_index",
">=",
"self",
".",
"_num_datapoints",
":",
"raise",
"ValueError",
"(",
"'Datapoint index %d is greater than the number of datapoints (%d)'",
"%",
"(",
"datapoint_index",
",",
... | Returns the index of the tensor containing the referenced datapoint. | [
"Returns",
"the",
"index",
"of",
"the",
"tensor",
"containing",
"the",
"referenced",
"datapoint",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L421-L425 |
9,652 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.generate_tensor_filename | def generate_tensor_filename(self, field_name, file_num, compressed=True):
""" Generate a filename for a tensor. """
file_ext = TENSOR_EXT
if compressed:
file_ext = COMPRESSED_TENSOR_EXT
filename = os.path.join(self.filename, 'tensors', '%s_%05d%s' %(field_name, file_num, fil... | python | def generate_tensor_filename(self, field_name, file_num, compressed=True):
""" Generate a filename for a tensor. """
file_ext = TENSOR_EXT
if compressed:
file_ext = COMPRESSED_TENSOR_EXT
filename = os.path.join(self.filename, 'tensors', '%s_%05d%s' %(field_name, file_num, fil... | [
"def",
"generate_tensor_filename",
"(",
"self",
",",
"field_name",
",",
"file_num",
",",
"compressed",
"=",
"True",
")",
":",
"file_ext",
"=",
"TENSOR_EXT",
"if",
"compressed",
":",
"file_ext",
"=",
"COMPRESSED_TENSOR_EXT",
"filename",
"=",
"os",
".",
"path",
... | Generate a filename for a tensor. | [
"Generate",
"a",
"filename",
"for",
"a",
"tensor",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L427-L433 |
9,653 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset._allocate_tensors | def _allocate_tensors(self):
""" Allocates the tensors in the dataset. """
# init tensors dict
self._tensors = {}
# allocate tensor for each data field
for field_name, field_spec in self._config['fields'].items():
# parse attributes
field_dtype = np.dtype... | python | def _allocate_tensors(self):
""" Allocates the tensors in the dataset. """
# init tensors dict
self._tensors = {}
# allocate tensor for each data field
for field_name, field_spec in self._config['fields'].items():
# parse attributes
field_dtype = np.dtype... | [
"def",
"_allocate_tensors",
"(",
"self",
")",
":",
"# init tensors dict",
"self",
".",
"_tensors",
"=",
"{",
"}",
"# allocate tensor for each data field",
"for",
"field_name",
",",
"field_spec",
"in",
"self",
".",
"_config",
"[",
"'fields'",
"]",
".",
"items",
"... | Allocates the tensors in the dataset. | [
"Allocates",
"the",
"tensors",
"in",
"the",
"dataset",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L459-L479 |
9,654 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.add | def add(self, datapoint):
""" Adds a datapoint to the file. """
# check access level
if self._access_mode == READ_ONLY_ACCESS:
raise ValueError('Cannot add datapoints with read-only access')
# read tensor datapoint ind
tensor_ind = self._num_datapoints // self._datap... | python | def add(self, datapoint):
""" Adds a datapoint to the file. """
# check access level
if self._access_mode == READ_ONLY_ACCESS:
raise ValueError('Cannot add datapoints with read-only access')
# read tensor datapoint ind
tensor_ind = self._num_datapoints // self._datap... | [
"def",
"add",
"(",
"self",
",",
"datapoint",
")",
":",
"# check access level",
"if",
"self",
".",
"_access_mode",
"==",
"READ_ONLY_ACCESS",
":",
"raise",
"ValueError",
"(",
"'Cannot add datapoints with read-only access'",
")",
"# read tensor datapoint ind",
"tensor_ind",
... | Adds a datapoint to the file. | [
"Adds",
"a",
"datapoint",
"to",
"the",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L481-L527 |
9,655 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.datapoint | def datapoint(self, ind, field_names=None):
""" Loads a tensor datapoint for a given global index.
Parameters
----------
ind : int
global index in the tensor
field_names : :obj:`list` of str
field names to load
Returns
-------
:ob... | python | def datapoint(self, ind, field_names=None):
""" Loads a tensor datapoint for a given global index.
Parameters
----------
ind : int
global index in the tensor
field_names : :obj:`list` of str
field names to load
Returns
-------
:ob... | [
"def",
"datapoint",
"(",
"self",
",",
"ind",
",",
"field_names",
"=",
"None",
")",
":",
"# flush if necessary",
"if",
"self",
".",
"_has_unsaved_data",
":",
"self",
".",
"flush",
"(",
")",
"# check valid input",
"if",
"ind",
">=",
"self",
".",
"_num_datapoin... | Loads a tensor datapoint for a given global index.
Parameters
----------
ind : int
global index in the tensor
field_names : :obj:`list` of str
field names to load
Returns
-------
:obj:`TensorDatapoint`
the desired tensor datap... | [
"Loads",
"a",
"tensor",
"datapoint",
"for",
"a",
"given",
"global",
"index",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L533-L567 |
9,656 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.tensor | def tensor(self, field_name, tensor_ind):
""" Returns the tensor for a given field and tensor index.
Parameters
----------
field_name : str
the name of the field to load
tensor_index : int
the index of the tensor
Returns
-------
:... | python | def tensor(self, field_name, tensor_ind):
""" Returns the tensor for a given field and tensor index.
Parameters
----------
field_name : str
the name of the field to load
tensor_index : int
the index of the tensor
Returns
-------
:... | [
"def",
"tensor",
"(",
"self",
",",
"field_name",
",",
"tensor_ind",
")",
":",
"if",
"tensor_ind",
"==",
"self",
".",
"_tensor_cache_file_num",
"[",
"field_name",
"]",
":",
"return",
"self",
".",
"_tensors",
"[",
"field_name",
"]",
"filename",
"=",
"self",
... | Returns the tensor for a given field and tensor index.
Parameters
----------
field_name : str
the name of the field to load
tensor_index : int
the index of the tensor
Returns
-------
:obj:`Tensor`
the desired tensor | [
"Returns",
"the",
"tensor",
"for",
"a",
"given",
"field",
"and",
"tensor",
"index",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L569-L590 |
9,657 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.delete_last | def delete_last(self, num_to_delete=1):
""" Deletes the last N datapoints from the dataset.
Parameters
----------
num_to_delete : int
the number of datapoints to remove from the end of the dataset
"""
# check access level
if self._access_mode == READ_... | python | def delete_last(self, num_to_delete=1):
""" Deletes the last N datapoints from the dataset.
Parameters
----------
num_to_delete : int
the number of datapoints to remove from the end of the dataset
"""
# check access level
if self._access_mode == READ_... | [
"def",
"delete_last",
"(",
"self",
",",
"num_to_delete",
"=",
"1",
")",
":",
"# check access level",
"if",
"self",
".",
"_access_mode",
"==",
"READ_ONLY_ACCESS",
":",
"raise",
"ValueError",
"(",
"'Cannot delete datapoints with read-only access'",
")",
"# check num to de... | Deletes the last N datapoints from the dataset.
Parameters
----------
num_to_delete : int
the number of datapoints to remove from the end of the dataset | [
"Deletes",
"the",
"last",
"N",
"datapoints",
"from",
"the",
"dataset",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L617-L677 |
9,658 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.write | def write(self):
""" Writes all tensors to the next file number. """
# write the next file for all fields
for field_name in self.field_names:
filename = self.generate_tensor_filename(field_name, self._num_tensors-1)
self._tensors[field_name].save(filename, compressed=True... | python | def write(self):
""" Writes all tensors to the next file number. """
# write the next file for all fields
for field_name in self.field_names:
filename = self.generate_tensor_filename(field_name, self._num_tensors-1)
self._tensors[field_name].save(filename, compressed=True... | [
"def",
"write",
"(",
"self",
")",
":",
"# write the next file for all fields",
"for",
"field_name",
"in",
"self",
".",
"field_names",
":",
"filename",
"=",
"self",
".",
"generate_tensor_filename",
"(",
"field_name",
",",
"self",
".",
"_num_tensors",
"-",
"1",
")... | Writes all tensors to the next file number. | [
"Writes",
"all",
"tensors",
"to",
"the",
"next",
"file",
"number",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L696-L709 |
9,659 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.open | def open(dataset_dir, access_mode=READ_ONLY_ACCESS):
""" Opens a tensor dataset. """
# check access mode
if access_mode == WRITE_ACCESS:
raise ValueError('Cannot open a dataset with write-only access')
# read config
try:
# json load
config_fil... | python | def open(dataset_dir, access_mode=READ_ONLY_ACCESS):
""" Opens a tensor dataset. """
# check access mode
if access_mode == WRITE_ACCESS:
raise ValueError('Cannot open a dataset with write-only access')
# read config
try:
# json load
config_fil... | [
"def",
"open",
"(",
"dataset_dir",
",",
"access_mode",
"=",
"READ_ONLY_ACCESS",
")",
":",
"# check access mode",
"if",
"access_mode",
"==",
"WRITE_ACCESS",
":",
"raise",
"ValueError",
"(",
"'Cannot open a dataset with write-only access'",
")",
"# read config",
"try",
":... | Opens a tensor dataset. | [
"Opens",
"a",
"tensor",
"dataset",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L716-L734 |
9,660 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.split | def split(self, split_name):
""" Return the training and validation indices for the requested split.
Parameters
----------
split_name : str
name of the split
Returns
-------
:obj:`numpy.ndarray`
array of training indices in the global dat... | python | def split(self, split_name):
""" Return the training and validation indices for the requested split.
Parameters
----------
split_name : str
name of the split
Returns
-------
:obj:`numpy.ndarray`
array of training indices in the global dat... | [
"def",
"split",
"(",
"self",
",",
"split_name",
")",
":",
"if",
"not",
"self",
".",
"has_split",
"(",
"split_name",
")",
":",
"raise",
"ValueError",
"(",
"'Split %s does not exist!'",
"%",
"(",
"split_name",
")",
")",
"metadata_filename",
"=",
"self",
".",
... | Return the training and validation indices for the requested split.
Parameters
----------
split_name : str
name of the split
Returns
-------
:obj:`numpy.ndarray`
array of training indices in the global dataset
:obj:`numpy.ndarray`
... | [
"Return",
"the",
"training",
"and",
"validation",
"indices",
"for",
"the",
"requested",
"split",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L736-L762 |
9,661 | BerkeleyAutomation/autolab_core | autolab_core/tensor_dataset.py | TensorDataset.delete_split | def delete_split(self, split_name):
""" Delete a split of the dataset.
Parameters
----------
split_name : str
name of the split to delete
"""
if self.has_split(split_name):
shutil.rmtree(os.path.join(self.split_dir, split_name)) | python | def delete_split(self, split_name):
""" Delete a split of the dataset.
Parameters
----------
split_name : str
name of the split to delete
"""
if self.has_split(split_name):
shutil.rmtree(os.path.join(self.split_dir, split_name)) | [
"def",
"delete_split",
"(",
"self",
",",
"split_name",
")",
":",
"if",
"self",
".",
"has_split",
"(",
"split_name",
")",
":",
"shutil",
".",
"rmtree",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"split_dir",
",",
"split_name",
")",
")"
] | Delete a split of the dataset.
Parameters
----------
split_name : str
name of the split to delete | [
"Delete",
"a",
"split",
"of",
"the",
"dataset",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/tensor_dataset.py#L878-L887 |
9,662 | BerkeleyAutomation/autolab_core | autolab_core/yaml_config.py | YamlConfig._load_config | def _load_config(self, filename):
"""Loads a yaml configuration file from the given filename.
Parameters
----------
filename : :obj:`str`
The filename of the .yaml file that contains the configuration.
"""
# Read entire file for metadata
fh = open(fil... | python | def _load_config(self, filename):
"""Loads a yaml configuration file from the given filename.
Parameters
----------
filename : :obj:`str`
The filename of the .yaml file that contains the configuration.
"""
# Read entire file for metadata
fh = open(fil... | [
"def",
"_load_config",
"(",
"self",
",",
"filename",
")",
":",
"# Read entire file for metadata",
"fh",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"self",
".",
"file_contents",
"=",
"fh",
".",
"read",
"(",
")",
"# Replace !include directives with content",
"... | Loads a yaml configuration file from the given filename.
Parameters
----------
filename : :obj:`str`
The filename of the .yaml file that contains the configuration. | [
"Loads",
"a",
"yaml",
"configuration",
"file",
"from",
"the",
"given",
"filename",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/yaml_config.py#L75-L126 |
9,663 | BerkeleyAutomation/autolab_core | autolab_core/yaml_config.py | YamlConfig.__convert_key | def __convert_key(expression):
"""Converts keys in YAML that reference other keys.
"""
if type(expression) is str and len(expression) > 2 and expression[1] == '!':
expression = eval(expression[2:-1])
return expression | python | def __convert_key(expression):
"""Converts keys in YAML that reference other keys.
"""
if type(expression) is str and len(expression) > 2 and expression[1] == '!':
expression = eval(expression[2:-1])
return expression | [
"def",
"__convert_key",
"(",
"expression",
")",
":",
"if",
"type",
"(",
"expression",
")",
"is",
"str",
"and",
"len",
"(",
"expression",
")",
">",
"2",
"and",
"expression",
"[",
"1",
"]",
"==",
"'!'",
":",
"expression",
"=",
"eval",
"(",
"expression",
... | Converts keys in YAML that reference other keys. | [
"Converts",
"keys",
"in",
"YAML",
"that",
"reference",
"other",
"keys",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/yaml_config.py#L129-L134 |
9,664 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | ClassificationResult.make_summary_table | def make_summary_table(train_result, val_result, plot=True, save_dir=None, prepend="", save=False):
"""
Makes a matplotlib table object with relevant data.
Thanks to Lucas Manuelli for the contribution.
Parameters
----------
train_result: ClassificationResult
... | python | def make_summary_table(train_result, val_result, plot=True, save_dir=None, prepend="", save=False):
"""
Makes a matplotlib table object with relevant data.
Thanks to Lucas Manuelli for the contribution.
Parameters
----------
train_result: ClassificationResult
... | [
"def",
"make_summary_table",
"(",
"train_result",
",",
"val_result",
",",
"plot",
"=",
"True",
",",
"save_dir",
"=",
"None",
",",
"prepend",
"=",
"\"\"",
",",
"save",
"=",
"False",
")",
":",
"table_key_list",
"=",
"[",
"'error_rate'",
",",
"'recall_at_99_pre... | Makes a matplotlib table object with relevant data.
Thanks to Lucas Manuelli for the contribution.
Parameters
----------
train_result: ClassificationResult
result on train split
val_result: ClassificationResult
result on validation split
save_di... | [
"Makes",
"a",
"matplotlib",
"table",
"object",
"with",
"relevant",
"data",
".",
"Thanks",
"to",
"Lucas",
"Manuelli",
"for",
"the",
"contribution",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L236-L304 |
9,665 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | BinaryClassificationResult.app_score | def app_score(self):
""" Computes the area under the app curve. """
# compute curve
precisions, pct_pred_pos, taus = self.precision_pct_pred_pos_curve(interval=False)
# compute area
app = 0
total = 0
for k in range(len(precisions)-1):
# read cur data
... | python | def app_score(self):
""" Computes the area under the app curve. """
# compute curve
precisions, pct_pred_pos, taus = self.precision_pct_pred_pos_curve(interval=False)
# compute area
app = 0
total = 0
for k in range(len(precisions)-1):
# read cur data
... | [
"def",
"app_score",
"(",
"self",
")",
":",
"# compute curve",
"precisions",
",",
"pct_pred_pos",
",",
"taus",
"=",
"self",
".",
"precision_pct_pred_pos_curve",
"(",
"interval",
"=",
"False",
")",
"# compute area",
"app",
"=",
"0",
"total",
"=",
"0",
"for",
"... | Computes the area under the app curve. | [
"Computes",
"the",
"area",
"under",
"the",
"app",
"curve",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L467-L492 |
9,666 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | BinaryClassificationResult.accuracy_curve | def accuracy_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification accuracy. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
sco... | python | def accuracy_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification accuracy. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
sco... | [
"def",
"accuracy_curve",
"(",
"self",
",",
"delta_tau",
"=",
"0.01",
")",
":",
"# compute thresholds based on the sorted probabilities",
"orig_thresh",
"=",
"self",
".",
"threshold",
"sorted_labels",
",",
"sorted_probs",
"=",
"self",
".",
"sorted_values",
"scores",
"=... | Computes the relationship between probability threshold
and classification accuracy. | [
"Computes",
"the",
"relationship",
"between",
"probability",
"threshold",
"and",
"classification",
"accuracy",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L515-L541 |
9,667 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | BinaryClassificationResult.f1_curve | def f1_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification F1 score. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
scores = ... | python | def f1_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification F1 score. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
scores = ... | [
"def",
"f1_curve",
"(",
"self",
",",
"delta_tau",
"=",
"0.01",
")",
":",
"# compute thresholds based on the sorted probabilities",
"orig_thresh",
"=",
"self",
".",
"threshold",
"sorted_labels",
",",
"sorted_probs",
"=",
"self",
".",
"sorted_values",
"scores",
"=",
"... | Computes the relationship between probability threshold
and classification F1 score. | [
"Computes",
"the",
"relationship",
"between",
"probability",
"threshold",
"and",
"classification",
"F1",
"score",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L599-L625 |
9,668 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | BinaryClassificationResult.phi_coef_curve | def phi_coef_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification phi coefficient. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
... | python | def phi_coef_curve(self, delta_tau=0.01):
""" Computes the relationship between probability threshold
and classification phi coefficient. """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, sorted_probs = self.sorted_values
... | [
"def",
"phi_coef_curve",
"(",
"self",
",",
"delta_tau",
"=",
"0.01",
")",
":",
"# compute thresholds based on the sorted probabilities",
"orig_thresh",
"=",
"self",
".",
"threshold",
"sorted_labels",
",",
"sorted_probs",
"=",
"self",
".",
"sorted_values",
"scores",
"=... | Computes the relationship between probability threshold
and classification phi coefficient. | [
"Computes",
"the",
"relationship",
"between",
"probability",
"threshold",
"and",
"classification",
"phi",
"coefficient",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L627-L653 |
9,669 | BerkeleyAutomation/autolab_core | autolab_core/learning_analysis.py | BinaryClassificationResult.precision_pct_pred_pos_curve | def precision_pct_pred_pos_curve(self, interval=False, delta_tau=0.001):
""" Computes the relationship between precision
and the percent of positively classified datapoints . """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, so... | python | def precision_pct_pred_pos_curve(self, interval=False, delta_tau=0.001):
""" Computes the relationship between precision
and the percent of positively classified datapoints . """
# compute thresholds based on the sorted probabilities
orig_thresh = self.threshold
sorted_labels, so... | [
"def",
"precision_pct_pred_pos_curve",
"(",
"self",
",",
"interval",
"=",
"False",
",",
"delta_tau",
"=",
"0.001",
")",
":",
"# compute thresholds based on the sorted probabilities",
"orig_thresh",
"=",
"self",
".",
"threshold",
"sorted_labels",
",",
"sorted_probs",
"="... | Computes the relationship between precision
and the percent of positively classified datapoints . | [
"Computes",
"the",
"relationship",
"between",
"precision",
"and",
"the",
"percent",
"of",
"positively",
"classified",
"datapoints",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/learning_analysis.py#L655-L700 |
9,670 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | gen_experiment_id | def gen_experiment_id(n=10):
"""Generate a random string with n characters.
Parameters
----------
n : int
The length of the string to be generated.
Returns
-------
:obj:`str`
A string with only alphabetic characters.
"""
chrs = 'abcdefghijklmnopqrstuvwxyz'
inds... | python | def gen_experiment_id(n=10):
"""Generate a random string with n characters.
Parameters
----------
n : int
The length of the string to be generated.
Returns
-------
:obj:`str`
A string with only alphabetic characters.
"""
chrs = 'abcdefghijklmnopqrstuvwxyz'
inds... | [
"def",
"gen_experiment_id",
"(",
"n",
"=",
"10",
")",
":",
"chrs",
"=",
"'abcdefghijklmnopqrstuvwxyz'",
"inds",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"chrs",
")",
",",
"size",
"=",
"n",
")",
"return",
"''",
".",
"join",... | Generate a random string with n characters.
Parameters
----------
n : int
The length of the string to be generated.
Returns
-------
:obj:`str`
A string with only alphabetic characters. | [
"Generate",
"a",
"random",
"string",
"with",
"n",
"characters",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L11-L26 |
9,671 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | histogram | def histogram(values, num_bins, bounds, normalized=True, plot=False, color='b'):
"""Generate a histogram plot.
Parameters
----------
values : :obj:`numpy.ndarray`
An array of values to put in the histogram.
num_bins : int
The number equal-width bins in the histogram.
bounds : ... | python | def histogram(values, num_bins, bounds, normalized=True, plot=False, color='b'):
"""Generate a histogram plot.
Parameters
----------
values : :obj:`numpy.ndarray`
An array of values to put in the histogram.
num_bins : int
The number equal-width bins in the histogram.
bounds : ... | [
"def",
"histogram",
"(",
"values",
",",
"num_bins",
",",
"bounds",
",",
"normalized",
"=",
"True",
",",
"plot",
"=",
"False",
",",
"color",
"=",
"'b'",
")",
":",
"hist",
",",
"bins",
"=",
"np",
".",
"histogram",
"(",
"values",
",",
"bins",
"=",
"nu... | Generate a histogram plot.
Parameters
----------
values : :obj:`numpy.ndarray`
An array of values to put in the histogram.
num_bins : int
The number equal-width bins in the histogram.
bounds : :obj:`tuple` of float
Two floats - a min and a max - that define the lower and u... | [
"Generate",
"a",
"histogram",
"plot",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L64-L102 |
9,672 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | skew | def skew(xi):
"""Return the skew-symmetric matrix that can be used to calculate
cross-products with vector xi.
Multiplying this matrix by a vector `v` gives the same result
as `xi x v`.
Parameters
----------
xi : :obj:`numpy.ndarray` of float
A 3-entry vector.
Returns
----... | python | def skew(xi):
"""Return the skew-symmetric matrix that can be used to calculate
cross-products with vector xi.
Multiplying this matrix by a vector `v` gives the same result
as `xi x v`.
Parameters
----------
xi : :obj:`numpy.ndarray` of float
A 3-entry vector.
Returns
----... | [
"def",
"skew",
"(",
"xi",
")",
":",
"S",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"-",
"xi",
"[",
"2",
"]",
",",
"xi",
"[",
"1",
"]",
"]",
",",
"[",
"xi",
"[",
"2",
"]",
",",
"0",
",",
"-",
"xi",
"[",
"0",
"]",
"]",
",",
... | Return the skew-symmetric matrix that can be used to calculate
cross-products with vector xi.
Multiplying this matrix by a vector `v` gives the same result
as `xi x v`.
Parameters
----------
xi : :obj:`numpy.ndarray` of float
A 3-entry vector.
Returns
-------
:obj:`numpy.n... | [
"Return",
"the",
"skew",
"-",
"symmetric",
"matrix",
"that",
"can",
"be",
"used",
"to",
"calculate",
"cross",
"-",
"products",
"with",
"vector",
"xi",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L104-L124 |
9,673 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | deskew | def deskew(S):
"""Converts a skew-symmetric cross-product matrix to its corresponding
vector. Only works for 3x3 matrices.
Parameters
----------
S : :obj:`numpy.ndarray` of float
A 3x3 skew-symmetric matrix.
Returns
-------
:obj:`numpy.ndarray` of float
A 3-entry vector... | python | def deskew(S):
"""Converts a skew-symmetric cross-product matrix to its corresponding
vector. Only works for 3x3 matrices.
Parameters
----------
S : :obj:`numpy.ndarray` of float
A 3x3 skew-symmetric matrix.
Returns
-------
:obj:`numpy.ndarray` of float
A 3-entry vector... | [
"def",
"deskew",
"(",
"S",
")",
":",
"x",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
"x",
"[",
"0",
"]",
"=",
"S",
"[",
"2",
",",
"1",
"]",
"x",
"[",
"1",
"]",
"=",
"S",
"[",
"0",
",",
"2",
"]",
"x",
"[",
"2",
"]",
"=",
"S",
"[",
"1"... | Converts a skew-symmetric cross-product matrix to its corresponding
vector. Only works for 3x3 matrices.
Parameters
----------
S : :obj:`numpy.ndarray` of float
A 3x3 skew-symmetric matrix.
Returns
-------
:obj:`numpy.ndarray` of float
A 3-entry vector that corresponds to t... | [
"Converts",
"a",
"skew",
"-",
"symmetric",
"cross",
"-",
"product",
"matrix",
"to",
"its",
"corresponding",
"vector",
".",
"Only",
"works",
"for",
"3x3",
"matrices",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L126-L144 |
9,674 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | reverse_dictionary | def reverse_dictionary(d):
""" Reverses the key value pairs for a given dictionary.
Parameters
----------
d : :obj:`dict`
dictionary to reverse
Returns
-------
:obj:`dict`
dictionary with keys and values swapped
"""
rev_d = {}
[rev_d.update({v:k}) for k, v in d.... | python | def reverse_dictionary(d):
""" Reverses the key value pairs for a given dictionary.
Parameters
----------
d : :obj:`dict`
dictionary to reverse
Returns
-------
:obj:`dict`
dictionary with keys and values swapped
"""
rev_d = {}
[rev_d.update({v:k}) for k, v in d.... | [
"def",
"reverse_dictionary",
"(",
"d",
")",
":",
"rev_d",
"=",
"{",
"}",
"[",
"rev_d",
".",
"update",
"(",
"{",
"v",
":",
"k",
"}",
")",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
"]",
"return",
"rev_d"
] | Reverses the key value pairs for a given dictionary.
Parameters
----------
d : :obj:`dict`
dictionary to reverse
Returns
-------
:obj:`dict`
dictionary with keys and values swapped | [
"Reverses",
"the",
"key",
"value",
"pairs",
"for",
"a",
"given",
"dictionary",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L146-L161 |
9,675 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | filenames | def filenames(directory, tag='', sorted=False, recursive=False):
""" Reads in all filenames from a directory that contain a specified substring.
Parameters
----------
directory : :obj:`str`
the directory to read from
tag : :obj:`str`
optional tag to match in the filenames
sorted... | python | def filenames(directory, tag='', sorted=False, recursive=False):
""" Reads in all filenames from a directory that contain a specified substring.
Parameters
----------
directory : :obj:`str`
the directory to read from
tag : :obj:`str`
optional tag to match in the filenames
sorted... | [
"def",
"filenames",
"(",
"directory",
",",
"tag",
"=",
"''",
",",
"sorted",
"=",
"False",
",",
"recursive",
"=",
"False",
")",
":",
"if",
"recursive",
":",
"f",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"f",
")",
"for",
"di... | Reads in all filenames from a directory that contain a specified substring.
Parameters
----------
directory : :obj:`str`
the directory to read from
tag : :obj:`str`
optional tag to match in the filenames
sorted : bool
whether or not to sort the filenames
recursive : bool... | [
"Reads",
"in",
"all",
"filenames",
"from",
"a",
"directory",
"that",
"contain",
"a",
"specified",
"substring",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L178-L203 |
9,676 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | sph2cart | def sph2cart(r, az, elev):
""" Convert spherical to cartesian coordinates.
Attributes
----------
r : float
radius
az : float
aziumth (angle about z axis)
elev : float
elevation from xy plane
Returns
-------
float
x-coordinate
float
y-coor... | python | def sph2cart(r, az, elev):
""" Convert spherical to cartesian coordinates.
Attributes
----------
r : float
radius
az : float
aziumth (angle about z axis)
elev : float
elevation from xy plane
Returns
-------
float
x-coordinate
float
y-coor... | [
"def",
"sph2cart",
"(",
"r",
",",
"az",
",",
"elev",
")",
":",
"x",
"=",
"r",
"*",
"np",
".",
"cos",
"(",
"az",
")",
"*",
"np",
".",
"sin",
"(",
"elev",
")",
"y",
"=",
"r",
"*",
"np",
".",
"sin",
"(",
"az",
")",
"*",
"np",
".",
"sin",
... | Convert spherical to cartesian coordinates.
Attributes
----------
r : float
radius
az : float
aziumth (angle about z axis)
elev : float
elevation from xy plane
Returns
-------
float
x-coordinate
float
y-coordinate
float
z-coordina... | [
"Convert",
"spherical",
"to",
"cartesian",
"coordinates",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L205-L229 |
9,677 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | cart2sph | def cart2sph(x, y, z):
""" Convert cartesian to spherical coordinates.
Attributes
----------
x : float
x-coordinate
y : float
y-coordinate
z : float
z-coordinate
Returns
-------
float
radius
float
aziumth
float
elevation
"... | python | def cart2sph(x, y, z):
""" Convert cartesian to spherical coordinates.
Attributes
----------
x : float
x-coordinate
y : float
y-coordinate
z : float
z-coordinate
Returns
-------
float
radius
float
aziumth
float
elevation
"... | [
"def",
"cart2sph",
"(",
"x",
",",
"y",
",",
"z",
")",
":",
"r",
"=",
"np",
".",
"sqrt",
"(",
"x",
"**",
"2",
"+",
"y",
"**",
"2",
"+",
"z",
"**",
"2",
")",
"if",
"x",
">",
"0",
"and",
"y",
">",
"0",
":",
"az",
"=",
"np",
".",
"arctan"... | Convert cartesian to spherical coordinates.
Attributes
----------
x : float
x-coordinate
y : float
y-coordinate
z : float
z-coordinate
Returns
-------
float
radius
float
aziumth
float
elevation | [
"Convert",
"cartesian",
"to",
"spherical",
"coordinates",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L231-L270 |
9,678 | BerkeleyAutomation/autolab_core | autolab_core/utils.py | keyboard_input | def keyboard_input(message, yesno=False):
""" Get keyboard input from a human, optionally reasking for valid
yes or no input.
Parameters
----------
message : :obj:`str`
the message to display to the user
yesno : :obj:`bool`
whether or not to enforce yes or no inputs
Ret... | python | def keyboard_input(message, yesno=False):
""" Get keyboard input from a human, optionally reasking for valid
yes or no input.
Parameters
----------
message : :obj:`str`
the message to display to the user
yesno : :obj:`bool`
whether or not to enforce yes or no inputs
Ret... | [
"def",
"keyboard_input",
"(",
"message",
",",
"yesno",
"=",
"False",
")",
":",
"# add space for readability",
"message",
"+=",
"' '",
"# add yes or no to message",
"if",
"yesno",
":",
"message",
"+=",
"'[y/n] '",
"# ask human",
"human_input",
"=",
"input",
"(",
"m... | Get keyboard input from a human, optionally reasking for valid
yes or no input.
Parameters
----------
message : :obj:`str`
the message to display to the user
yesno : :obj:`bool`
whether or not to enforce yes or no inputs
Returns
-------
:obj:`str`
string inp... | [
"Get",
"keyboard",
"input",
"from",
"a",
"human",
"optionally",
"reasking",
"for",
"valid",
"yes",
"or",
"no",
"input",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/utils.py#L272-L301 |
9,679 | BerkeleyAutomation/autolab_core | autolab_core/dual_quaternion.py | DualQuaternion.interpolate | def interpolate(dq0, dq1, t):
"""Return the interpolation of two DualQuaternions.
This uses the Dual Quaternion Linear Blending Method as described by Matthew Smith's
'Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation'
https://www.cosc.canterbury.ac.... | python | def interpolate(dq0, dq1, t):
"""Return the interpolation of two DualQuaternions.
This uses the Dual Quaternion Linear Blending Method as described by Matthew Smith's
'Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation'
https://www.cosc.canterbury.ac.... | [
"def",
"interpolate",
"(",
"dq0",
",",
"dq1",
",",
"t",
")",
":",
"if",
"not",
"0",
"<=",
"t",
"<=",
"1",
":",
"raise",
"ValueError",
"(",
"\"Interpolation step must be between 0 and 1! Got {0}\"",
".",
"format",
"(",
"t",
")",
")",
"dqt",
"=",
"dq0",
"*... | Return the interpolation of two DualQuaternions.
This uses the Dual Quaternion Linear Blending Method as described by Matthew Smith's
'Applications of Dual Quaternions in Three Dimensional Transformation and Interpolation'
https://www.cosc.canterbury.ac.nz/research/reports/HonsReps/2013/hons_13... | [
"Return",
"the",
"interpolation",
"of",
"two",
"DualQuaternions",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/dual_quaternion.py#L129-L162 |
9,680 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel._save | def _save(self):
"""Save the model to a .csv file
"""
# if not first time saving, copy .csv to a backup
if os.path.isfile(self._full_filename):
shutil.copyfile(self._full_filename, self._full_backup_filename)
# write to csv
with open(self._full_filename, 'w')... | python | def _save(self):
"""Save the model to a .csv file
"""
# if not first time saving, copy .csv to a backup
if os.path.isfile(self._full_filename):
shutil.copyfile(self._full_filename, self._full_backup_filename)
# write to csv
with open(self._full_filename, 'w')... | [
"def",
"_save",
"(",
"self",
")",
":",
"# if not first time saving, copy .csv to a backup",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"_full_filename",
")",
":",
"shutil",
".",
"copyfile",
"(",
"self",
".",
"_full_filename",
",",
"self",
".",
... | Save the model to a .csv file | [
"Save",
"the",
"model",
"to",
"a",
".",
"csv",
"file"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L103-L115 |
9,681 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.insert | def insert(self, data):
"""Insert a row into the .csv file.
Parameters
----------
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Returns
-------
int
The UID for the new row.
Raises
------
... | python | def insert(self, data):
"""Insert a row into the .csv file.
Parameters
----------
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Returns
-------
int
The UID for the new row.
Raises
------
... | [
"def",
"insert",
"(",
"self",
",",
"data",
")",
":",
"row",
"=",
"{",
"key",
":",
"self",
".",
"_default_entry",
"for",
"key",
"in",
"self",
".",
"_headers",
"}",
"row",
"[",
"'_uid'",
"]",
"=",
"self",
".",
"_get_new_uid",
"(",
")",
"for",
"key",
... | Insert a row into the .csv file.
Parameters
----------
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Returns
-------
int
The UID for the new row.
Raises
------
Exception
If the value... | [
"Insert",
"a",
"row",
"into",
"the",
".",
"csv",
"file",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L117-L149 |
9,682 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.update_by_uid | def update_by_uid(self, uid, data):
"""Update a row with the given data.
Parameters
----------
uid : int
The UID of the row to update.
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Raises
------
Excepti... | python | def update_by_uid(self, uid, data):
"""Update a row with the given data.
Parameters
----------
uid : int
The UID of the row to update.
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Raises
------
Excepti... | [
"def",
"update_by_uid",
"(",
"self",
",",
"uid",
",",
"data",
")",
":",
"row",
"=",
"self",
".",
"_table",
"[",
"uid",
"+",
"1",
"]",
"for",
"key",
",",
"val",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"'_uid'",
"or",
"key",... | Update a row with the given data.
Parameters
----------
uid : int
The UID of the row to update.
data : :obj:`dict`
A dictionary mapping keys (header strings) to values.
Raises
------
Exception
If the value for a given header ... | [
"Update",
"a",
"row",
"with",
"the",
"given",
"data",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L151-L178 |
9,683 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.get_col | def get_col(self, col_name, filter = lambda _ : True):
"""Return all values in the column corresponding to col_name that satisfies filter, which is
a function that takes in a value of the column's type and returns True or False
Parameters
----------
col_name : str
Na... | python | def get_col(self, col_name, filter = lambda _ : True):
"""Return all values in the column corresponding to col_name that satisfies filter, which is
a function that takes in a value of the column's type and returns True or False
Parameters
----------
col_name : str
Na... | [
"def",
"get_col",
"(",
"self",
",",
"col_name",
",",
"filter",
"=",
"lambda",
"_",
":",
"True",
")",
":",
"if",
"col_name",
"not",
"in",
"self",
".",
"_headers",
":",
"raise",
"ValueError",
"(",
"\"{} not found! Model has headers: {}\"",
".",
"format",
"(",
... | Return all values in the column corresponding to col_name that satisfies filter, which is
a function that takes in a value of the column's type and returns True or False
Parameters
----------
col_name : str
Name of desired column
filter : function, optional
... | [
"Return",
"all",
"values",
"in",
"the",
"column",
"corresponding",
"to",
"col_name",
"that",
"satisfies",
"filter",
"which",
"is",
"a",
"function",
"that",
"takes",
"in",
"a",
"value",
"of",
"the",
"column",
"s",
"type",
"and",
"returns",
"True",
"or",
"Fa... | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L212-L243 |
9,684 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.get_by_cols | def get_by_cols(self, cols, direction=1):
"""Return the first or last row that satisfies the given col value constraints,
or None if no row contains the given value.
Parameters
----------
cols: :obj:'dict'
Dictionary of col values for a specific row.
directio... | python | def get_by_cols(self, cols, direction=1):
"""Return the first or last row that satisfies the given col value constraints,
or None if no row contains the given value.
Parameters
----------
cols: :obj:'dict'
Dictionary of col values for a specific row.
directio... | [
"def",
"get_by_cols",
"(",
"self",
",",
"cols",
",",
"direction",
"=",
"1",
")",
":",
"if",
"direction",
"==",
"1",
":",
"iterator",
"=",
"range",
"(",
"self",
".",
"num_rows",
")",
"elif",
"direction",
"==",
"-",
"1",
":",
"iterator",
"=",
"range",
... | Return the first or last row that satisfies the given col value constraints,
or None if no row contains the given value.
Parameters
----------
cols: :obj:'dict'
Dictionary of col values for a specific row.
direction: int, optional
Either 1 or -1. 1 means ... | [
"Return",
"the",
"first",
"or",
"last",
"row",
"that",
"satisfies",
"the",
"given",
"col",
"value",
"constraints",
"or",
"None",
"if",
"no",
"row",
"contains",
"the",
"given",
"value",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L245-L282 |
9,685 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.get_rows_by_cols | def get_rows_by_cols(self, matching_dict):
"""Return all rows where the cols match the elements given in the matching_dict
Parameters
----------
matching_dict: :obj:'dict'
Desired dictionary of col values.
Returns
-------
:obj:`list`
A li... | python | def get_rows_by_cols(self, matching_dict):
"""Return all rows where the cols match the elements given in the matching_dict
Parameters
----------
matching_dict: :obj:'dict'
Desired dictionary of col values.
Returns
-------
:obj:`list`
A li... | [
"def",
"get_rows_by_cols",
"(",
"self",
",",
"matching_dict",
")",
":",
"result",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_rows",
")",
":",
"row",
"=",
"self",
".",
"_table",
"[",
"i",
"+",
"1",
"]",
"matching",
"=",
"True",... | Return all rows where the cols match the elements given in the matching_dict
Parameters
----------
matching_dict: :obj:'dict'
Desired dictionary of col values.
Returns
-------
:obj:`list`
A list of rows that satisfy the matching_dict | [
"Return",
"all",
"rows",
"where",
"the",
"cols",
"match",
"the",
"elements",
"given",
"in",
"the",
"matching_dict"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L326-L351 |
9,686 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.next | def next(self):
""" Returns the next row in the CSV, for iteration """
if self._cur_row >= len(self._table):
raise StopIteration
data = self._table[self._cur_row].copy()
self._cur_row += 1
return data | python | def next(self):
""" Returns the next row in the CSV, for iteration """
if self._cur_row >= len(self._table):
raise StopIteration
data = self._table[self._cur_row].copy()
self._cur_row += 1
return data | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cur_row",
">=",
"len",
"(",
"self",
".",
"_table",
")",
":",
"raise",
"StopIteration",
"data",
"=",
"self",
".",
"_table",
"[",
"self",
".",
"_cur_row",
"]",
".",
"copy",
"(",
")",
"self",
... | Returns the next row in the CSV, for iteration | [
"Returns",
"the",
"next",
"row",
"in",
"the",
"CSV",
"for",
"iteration"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L358-L364 |
9,687 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.load | def load(full_filename):
"""Load a .csv file into a CSVModel.
Parameters
----------
full_filename : :obj:`str`
The file path to a .csv file.
Returns
-------
:obj:`CSVModel`
The CSVModel initialized with the data in the given file.
... | python | def load(full_filename):
"""Load a .csv file into a CSVModel.
Parameters
----------
full_filename : :obj:`str`
The file path to a .csv file.
Returns
-------
:obj:`CSVModel`
The CSVModel initialized with the data in the given file.
... | [
"def",
"load",
"(",
"full_filename",
")",
":",
"with",
"open",
"(",
"full_filename",
",",
"'r'",
")",
"as",
"file",
":",
"reader",
"=",
"csv",
".",
"DictReader",
"(",
"file",
")",
"headers",
"=",
"reader",
".",
"fieldnames",
"if",
"'_uid'",
"not",
"in"... | Load a .csv file into a CSVModel.
Parameters
----------
full_filename : :obj:`str`
The file path to a .csv file.
Returns
-------
:obj:`CSVModel`
The CSVModel initialized with the data in the given file.
Raises
------
Exce... | [
"Load",
"a",
".",
"csv",
"file",
"into",
"a",
"CSVModel",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L379-L438 |
9,688 | BerkeleyAutomation/autolab_core | autolab_core/csv_model.py | CSVModel.get_or_create | def get_or_create(full_filename, headers_types=None, default_entry=''):
"""Load a .csv file into a CSVModel if the file exists, or create
a new CSVModel with the given filename if the file does not exist.
Parameters
----------
full_filename : :obj:`str`
The file path... | python | def get_or_create(full_filename, headers_types=None, default_entry=''):
"""Load a .csv file into a CSVModel if the file exists, or create
a new CSVModel with the given filename if the file does not exist.
Parameters
----------
full_filename : :obj:`str`
The file path... | [
"def",
"get_or_create",
"(",
"full_filename",
",",
"headers_types",
"=",
"None",
",",
"default_entry",
"=",
"''",
")",
":",
"# convert dictionaries to list",
"if",
"isinstance",
"(",
"headers_types",
",",
"dict",
")",
":",
"headers_types_list",
"=",
"[",
"(",
"k... | Load a .csv file into a CSVModel if the file exists, or create
a new CSVModel with the given filename if the file does not exist.
Parameters
----------
full_filename : :obj:`str`
The file path to a .csv file.
headers_types : :obj:`list` of :obj:`tuple` of :obj:`str`... | [
"Load",
"a",
".",
"csv",
"file",
"into",
"a",
"CSVModel",
"if",
"the",
"file",
"exists",
"or",
"create",
"a",
"new",
"CSVModel",
"with",
"the",
"given",
"filename",
"if",
"the",
"file",
"does",
"not",
"exist",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/csv_model.py#L441-L472 |
9,689 | BerkeleyAutomation/autolab_core | autolab_core/transformations.py | projection_matrix | def projection_matrix(point, normal, direction=None,
perspective=None, pseudo=False):
"""Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve re... | python | def projection_matrix(point, normal, direction=None,
perspective=None, pseudo=False):
"""Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve re... | [
"def",
"projection_matrix",
"(",
"point",
",",
"normal",
",",
"direction",
"=",
"None",
",",
"perspective",
"=",
"None",
",",
"pseudo",
"=",
"False",
")",
":",
"M",
"=",
"numpy",
".",
"identity",
"(",
"4",
")",
"point",
"=",
"numpy",
".",
"array",
"(... | Return matrix to project onto plane defined by point and normal.
Using either perspective point, projection direction, or none of both.
If pseudo is True, perspective projections will preserve relative depth
such that Perspective = dot(Orthogonal, PseudoPerspective).
>>> P = projection_matrix((0, 0, ... | [
"Return",
"matrix",
"to",
"project",
"onto",
"plane",
"defined",
"by",
"point",
"and",
"normal",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L437-L496 |
9,690 | BerkeleyAutomation/autolab_core | autolab_core/transformations.py | projection_from_matrix | def projection_from_matrix(matrix, pseudo=False):
"""Return projection plane and perspective point from projection matrix.
Return values are same as arguments for projection_matrix function:
point, normal, direction, perspective, and pseudo.
>>> point = numpy.random.random(3) - 0.5
>>> normal = nu... | python | def projection_from_matrix(matrix, pseudo=False):
"""Return projection plane and perspective point from projection matrix.
Return values are same as arguments for projection_matrix function:
point, normal, direction, perspective, and pseudo.
>>> point = numpy.random.random(3) - 0.5
>>> normal = nu... | [
"def",
"projection_from_matrix",
"(",
"matrix",
",",
"pseudo",
"=",
"False",
")",
":",
"M",
"=",
"numpy",
".",
"array",
"(",
"matrix",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"False",
")",
"M33",
"=",
"M",
"[",
":",
"3",
",",
... | Return projection plane and perspective point from projection matrix.
Return values are same as arguments for projection_matrix function:
point, normal, direction, perspective, and pseudo.
>>> point = numpy.random.random(3) - 0.5
>>> normal = numpy.random.random(3) - 0.5
>>> direct = numpy.random.... | [
"Return",
"projection",
"plane",
"and",
"perspective",
"point",
"from",
"projection",
"matrix",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L499-L569 |
9,691 | BerkeleyAutomation/autolab_core | autolab_core/transformations.py | unit_vector | def unit_vector(data, axis=None, out=None):
"""Return ndarray normalized by length, i.e. eucledian norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, ... | python | def unit_vector(data, axis=None, out=None):
"""Return ndarray normalized by length, i.e. eucledian norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, ... | [
"def",
"unit_vector",
"(",
"data",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"if",
"out",
"is",
"None",
":",
"data",
"=",
"numpy",
".",
"array",
"(",
"data",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",... | Return ndarray normalized by length, i.e. eucledian norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, axis=-1)
>>> v2 = v0 / numpy.expand_dims(numpy.... | [
"Return",
"ndarray",
"normalized",
"by",
"length",
"i",
".",
"e",
".",
"eucledian",
"norm",
"along",
"axis",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L1574-L1615 |
9,692 | BerkeleyAutomation/autolab_core | autolab_core/json_serialization.py | json_numpy_obj_hook | def json_numpy_obj_hook(dct):
"""Decodes a previously encoded numpy ndarray with proper shape and dtype.
Parameters
----------
dct : :obj:`dict`
The encoded dictionary.
Returns
-------
:obj:`numpy.ndarray`
The ndarray that `dct` was encoding.
"""
if isinstance(dct, ... | python | def json_numpy_obj_hook(dct):
"""Decodes a previously encoded numpy ndarray with proper shape and dtype.
Parameters
----------
dct : :obj:`dict`
The encoded dictionary.
Returns
-------
:obj:`numpy.ndarray`
The ndarray that `dct` was encoding.
"""
if isinstance(dct, ... | [
"def",
"json_numpy_obj_hook",
"(",
"dct",
")",
":",
"if",
"isinstance",
"(",
"dct",
",",
"dict",
")",
"and",
"'__ndarray__'",
"in",
"dct",
":",
"data",
"=",
"np",
".",
"asarray",
"(",
"dct",
"[",
"'__ndarray__'",
"]",
",",
"dtype",
"=",
"dct",
"[",
"... | Decodes a previously encoded numpy ndarray with proper shape and dtype.
Parameters
----------
dct : :obj:`dict`
The encoded dictionary.
Returns
-------
:obj:`numpy.ndarray`
The ndarray that `dct` was encoding. | [
"Decodes",
"a",
"previously",
"encoded",
"numpy",
"ndarray",
"with",
"proper",
"shape",
"and",
"dtype",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/json_serialization.py#L45-L61 |
9,693 | BerkeleyAutomation/autolab_core | autolab_core/json_serialization.py | dump | def dump(*args, **kwargs):
"""Dump a numpy.ndarray to file stream.
This works exactly like the usual `json.dump()` function,
but it uses our custom serializer.
"""
kwargs.update(dict(cls=NumpyEncoder,
sort_keys=True,
indent=4,
sep... | python | def dump(*args, **kwargs):
"""Dump a numpy.ndarray to file stream.
This works exactly like the usual `json.dump()` function,
but it uses our custom serializer.
"""
kwargs.update(dict(cls=NumpyEncoder,
sort_keys=True,
indent=4,
sep... | [
"def",
"dump",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"dict",
"(",
"cls",
"=",
"NumpyEncoder",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"4",
",",
"separators",
"=",
"(",
"','",
",",
"': '",
")... | Dump a numpy.ndarray to file stream.
This works exactly like the usual `json.dump()` function,
but it uses our custom serializer. | [
"Dump",
"a",
"numpy",
".",
"ndarray",
"to",
"file",
"stream",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/json_serialization.py#L63-L73 |
9,694 | BerkeleyAutomation/autolab_core | autolab_core/json_serialization.py | load | def load(*args, **kwargs):
"""Load an numpy.ndarray from a file stream.
This works exactly like the usual `json.load()` function,
but it uses our custom deserializer.
"""
kwargs.update(dict(object_hook=json_numpy_obj_hook))
return _json.load(*args, **kwargs) | python | def load(*args, **kwargs):
"""Load an numpy.ndarray from a file stream.
This works exactly like the usual `json.load()` function,
but it uses our custom deserializer.
"""
kwargs.update(dict(object_hook=json_numpy_obj_hook))
return _json.load(*args, **kwargs) | [
"def",
"load",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"dict",
"(",
"object_hook",
"=",
"json_numpy_obj_hook",
")",
")",
"return",
"_json",
".",
"load",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Load an numpy.ndarray from a file stream.
This works exactly like the usual `json.load()` function,
but it uses our custom deserializer. | [
"Load",
"an",
"numpy",
".",
"ndarray",
"from",
"a",
"file",
"stream",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/json_serialization.py#L75-L82 |
9,695 | BerkeleyAutomation/autolab_core | autolab_core/json_serialization.py | NumpyEncoder.default | def default(self, obj):
"""Converts an ndarray into a dictionary for efficient serialization.
The dict has three keys:
- dtype : The datatype of the array as a string.
- shape : The shape of the array as a tuple.
- __ndarray__ : The data of the array as a list.
Paramete... | python | def default(self, obj):
"""Converts an ndarray into a dictionary for efficient serialization.
The dict has three keys:
- dtype : The datatype of the array as a string.
- shape : The shape of the array as a tuple.
- __ndarray__ : The data of the array as a list.
Paramete... | [
"def",
"default",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"np",
".",
"ndarray",
")",
":",
"return",
"dict",
"(",
"__ndarray__",
"=",
"obj",
".",
"tolist",
"(",
")",
",",
"dtype",
"=",
"str",
"(",
"obj",
".",
"dtype... | Converts an ndarray into a dictionary for efficient serialization.
The dict has three keys:
- dtype : The datatype of the array as a string.
- shape : The shape of the array as a tuple.
- __ndarray__ : The data of the array as a list.
Parameters
----------
obj :... | [
"Converts",
"an",
"ndarray",
"into",
"a",
"dictionary",
"for",
"efficient",
"serialization",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/json_serialization.py#L15-L43 |
9,696 | BerkeleyAutomation/autolab_core | autolab_core/random_variables.py | RandomVariable._preallocate_samples | def _preallocate_samples(self):
"""Preallocate samples for faster adaptive sampling.
"""
self.prealloc_samples_ = []
for i in range(self.num_prealloc_samples_):
self.prealloc_samples_.append(self.sample()) | python | def _preallocate_samples(self):
"""Preallocate samples for faster adaptive sampling.
"""
self.prealloc_samples_ = []
for i in range(self.num_prealloc_samples_):
self.prealloc_samples_.append(self.sample()) | [
"def",
"_preallocate_samples",
"(",
"self",
")",
":",
"self",
".",
"prealloc_samples_",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_prealloc_samples_",
")",
":",
"self",
".",
"prealloc_samples_",
".",
"append",
"(",
"self",
".",
"sampl... | Preallocate samples for faster adaptive sampling. | [
"Preallocate",
"samples",
"for",
"faster",
"adaptive",
"sampling",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/random_variables.py#L30-L35 |
9,697 | BerkeleyAutomation/autolab_core | autolab_core/random_variables.py | RandomVariable.rvs | def rvs(self, size=1, iteration=1):
"""Sample the random variable, using the preallocated samples if
possible.
Parameters
----------
size : int
The number of samples to generate.
iteration : int
The location in the preallocated sample array to st... | python | def rvs(self, size=1, iteration=1):
"""Sample the random variable, using the preallocated samples if
possible.
Parameters
----------
size : int
The number of samples to generate.
iteration : int
The location in the preallocated sample array to st... | [
"def",
"rvs",
"(",
"self",
",",
"size",
"=",
"1",
",",
"iteration",
"=",
"1",
")",
":",
"if",
"self",
".",
"num_prealloc_samples_",
">",
"0",
":",
"samples",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"size",
")",
":",
"samples",
".",
"append... | Sample the random variable, using the preallocated samples if
possible.
Parameters
----------
size : int
The number of samples to generate.
iteration : int
The location in the preallocated sample array to start sampling
from.
Returns... | [
"Sample",
"the",
"random",
"variable",
"using",
"the",
"preallocated",
"samples",
"if",
"possible",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/random_variables.py#L54-L81 |
9,698 | BerkeleyAutomation/autolab_core | autolab_core/random_variables.py | IsotropicGaussianRigidTransformRandomVariable.sample | def sample(self, size=1):
""" Sample rigid transform random variables.
Parameters
----------
size : int
number of sample to take
Returns
-------
:obj:`list` of :obj:`RigidTransform`
sampled rigid transformations
"""
... | python | def sample(self, size=1):
""" Sample rigid transform random variables.
Parameters
----------
size : int
number of sample to take
Returns
-------
:obj:`list` of :obj:`RigidTransform`
sampled rigid transformations
"""
... | [
"def",
"sample",
"(",
"self",
",",
"size",
"=",
"1",
")",
":",
"samples",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"size",
")",
":",
"# sample random pose",
"xi",
"=",
"self",
".",
"_r_xi_rv",
".",
"rvs",
"(",
"size",
"=",
"1",
")",
"S_xi",... | Sample rigid transform random variables.
Parameters
----------
size : int
number of sample to take
Returns
-------
:obj:`list` of :obj:`RigidTransform`
sampled rigid transformations | [
"Sample",
"rigid",
"transform",
"random",
"variables",
"."
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/random_variables.py#L221-L249 |
9,699 | BerkeleyAutomation/autolab_core | autolab_core/data_stream_recorder.py | DataStreamRecorder._flush | def _flush(self):
""" Returns a list of all current data """
if self._recording:
raise Exception("Cannot flush data queue while recording!")
if self._saving_cache:
logging.warn("Flush when using cache means unsaved data will be lost and not returned!")
self._c... | python | def _flush(self):
""" Returns a list of all current data """
if self._recording:
raise Exception("Cannot flush data queue while recording!")
if self._saving_cache:
logging.warn("Flush when using cache means unsaved data will be lost and not returned!")
self._c... | [
"def",
"_flush",
"(",
"self",
")",
":",
"if",
"self",
".",
"_recording",
":",
"raise",
"Exception",
"(",
"\"Cannot flush data queue while recording!\"",
")",
"if",
"self",
".",
"_saving_cache",
":",
"logging",
".",
"warn",
"(",
"\"Flush when using cache means unsave... | Returns a list of all current data | [
"Returns",
"a",
"list",
"of",
"all",
"current",
"data"
] | 8f3813f6401972868cc5e3981ba1b4382d4418d5 | https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/data_stream_recorder.py#L193-L202 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.