A helper function that takes in a named data field and returns the pose of that
        object in the base frame.
761402
def pose_in_base_from_name(self, name):
        

        pos_in_world = self.sim.data.get_body_xpos(name)
        rot_in_world = self.sim.data.get_body_xmat(name).reshape((3, 3))
        pose_in_world = T.make_pose(pos_in_world, rot_in_world)

        base_pos_in_world = self.sim.data.get_body_xpos("base")
        base_rot_in_world = self.sim.data.get_body_xmat("base").reshape((3, 3))
        base_pose_in_world = T.make_pose(base_pos_in_world, base_rot_in_world)
        world_pose_in_base = T.pose_inv(base_pose_in_world)

        pose_in_base = T.pose_in_A_to_pose_in_B(pose_in_world, world_pose_in_base)
        return pose_in_base
55767
def camera_position(self, pose=None):
        '''
        
        '''
        if pose is None:
            pose = self.pose()
        t, r = pose
        return -np.matrix(cv2.Rodrigues(r)[0]).T * np.matrix(t)
641773
def _grab_raw_image(self):
        
        m = self.ale.getScreenRGB()
        return m.reshape((self.height, self.width, 3))
205060
def get_wcs(self, data_x, data_y):
        
        img = self.fitsimage.get_image()
        ra, dec = img.pixtoradec(data_x, data_y)
        return ra, dec
467562
def getinnerframes(tb, context=1):
    """"""
    framelist = []
    while tb:
        framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
        tb = tb.tb_next
    return framelist
344797
def get_original_field_value(self, name):
        
        name = self.get_real_name(name)

        try:
            value = self.__original_data__[name]
        except KeyError:
            return None

        try:
            return value.export_original_data()
        except AttributeError:
            return value
1134790
def get(self, name, defval=None):
        '''
        
        '''
        for frame in reversed(self.frames):
            valu = frame.get(name, s_common.novalu)
            if valu != s_common.novalu:
                return valu

        task = self.ctors.get(name)
        if task is not None:
            func, args, kwargs = task
            item = func(*args, **kwargs)
            self.frames[-1][name] = item
            return item

        return defval
1160351
def data_objet_class(data_mode='value', time_mode='framewise'):
    
    classes_table = {('value', 'global'): GlobalValueObject,
                     ('value', 'event'): EventValueObject,
                     ('value', 'segment'): SegmentValueObject,
                     ('value', 'framewise'): FrameValueObject,
                     ('label', 'global'): GlobalLabelObject,
                     ('label', 'event'): EventLabelObject,
                     ('label', 'segment'): SegmentLabelObject,
                     ('label', 'framewise'): FrameLabelObject}

    try:
        return classes_table[(data_mode, time_mode)]
    except KeyError as e:
        raise ValueError('Wrong arguments')
1291565
def get_function_name_from_frame(frame):
    # type: (Any) -> str
    

    def bases_to_mro(cls, bases):
        # type: (type, List[type]) -> List[type]
        """
        Convert __bases__ to __mro__
        """
        mro = [cls]
        for base in bases:
            if base not in mro:
                mro.append(base)
            sub_bases = getattr(base, '__bases__', None)
            if sub_bases:
                sub_bases = [sb for sb in sub_bases if sb not in mro and sb not in bases]
                if sub_bases:
                    mro.extend(bases_to_mro(base, sub_bases))
        return mro

    code = frame.f_code
    # This ought to be aggressively cached with the code object as key.
    funcname = code.co_name
    if code.co_varnames:
        varname = code.co_varnames[0]
        if varname == 'self':
            inst = frame.f_locals.get(varname)
            if inst is not None:
                try:
                    mro = inst.__class__.__mro__
                except AttributeError:
                    mro = None
                    try:
                        bases = inst.__class__.__bases__
                    except AttributeError:
                        bases = None
                    else:
                        mro = bases_to_mro(inst.__class__, bases)
                if mro:
                    for cls in mro:
                        bare_method = cls.__dict__.get(funcname)
                        if bare_method and getattr(bare_method, '__code__', None) is code:
                            return '%s.%s' % (cls.__name__, funcname)
    return funcname
634590
def _fields_to_object(descriptor, fields):
    ''
    # pylint: disable=protected-access
    obj = descriptor._concrete_class()

    for name, value in fields:
        if isinstance(value, tuple):
            subtype = descriptor.fields_by_name[name].message_type
            value = _fields_to_object(subtype, value)
        _assign_to_field(obj, name, value)

    return obj
579403
def _peg_pose_in_hole_frame(self):
        
        # World frame
        peg_pos_in_world = self.sim.data.get_body_xpos("cylinder")
        peg_rot_in_world = self.sim.data.get_body_xmat("cylinder").reshape((3, 3))
        peg_pose_in_world = T.make_pose(peg_pos_in_world, peg_rot_in_world)

        # World frame
        hole_pos_in_world = self.sim.data.get_body_xpos("hole")
        hole_rot_in_world = self.sim.data.get_body_xmat("hole").reshape((3, 3))
        hole_pose_in_world = T.make_pose(hole_pos_in_world, hole_rot_in_world)

        world_pose_in_hole = T.pose_inv(hole_pose_in_world)

        peg_pose_in_hole = T.pose_in_A_to_pose_in_B(
            peg_pose_in_world, world_pose_in_hole
        )
        return peg_pose_in_hole
1326528
def getdata(self):
        
        if self.bounding_box:
            return self.image.crop(self.bounding_box).getdata()
1015514
function _getCelFrameDecoder(celName, frameData, frameNum) {
    var frameSize = frameData.length;

    switch (celName) {
    case 'l1': case 'l2': case 'l3': case 'l4': case 'town':
        // Some regular (type 1) CEL images just happen to have a frame size of
		// exactly 0x220, 0x320 or 0x400. Therefore the isType* functions are
		// required to figure out the appropriate decoding function.
        switch (frameSize) {
        case 0x400:
            if (isType0(celName, frameNum)) {
                return DecodeFrameType0;
            }
            break;
        case 0x220:
            if (isType2or4(frameData)) {
                return DecodeFrameType2;
            } else if (isType3or5(frameData)) {
                return DecodeFrameType3;
            }
            break;
        case 0x320:
            if (isType2or4(frameData)) {
                return DecodeFrameType4;
            } else if (isType3or5(frameData)) {
                return DecodeFrameType5;
            }
        }
    }

    return DecodeFrameType1;
}
767049
def from_ros_pose_msg(pose_msg,
                          from_frame='unassigned',
                          to_frame='world'):
        
        quaternion = np.array([pose_msg.orientation.w,
                               pose_msg.orientation.x,
                               pose_msg.orientation.y,
                               pose_msg.orientation.z])
        position = np.array([pose_msg.position.x,
                             pose_msg.position.y,
                             pose_msg.position.z])
        pose = RigidTransform(rotation=quaternion,
                              translation=position,
                              from_frame=from_frame,
                              to_frame=to_frame)
        return pose
128376
def get_object_position(self, object_name, relative_to_object=None):
        
        h = self.get_object_handle(object_name)
        relative_handle = (-1 if relative_to_object is None
                           else self.get_object_handle(relative_to_object))

        return self.call_remote_api('simxGetObjectPosition',
                                    h, relative_handle,
                                    streaming=True)
1231927
def get_image(dataset):
    """"""
    dim, nrow, ncol = dataset.shape
    uint8_dataset = dataset.astype('uint8')
    if not (uint8_dataset == dataset).all():
        message = (
            "\nYour image was cast to a `uint8` (`<img>.astype(uint8)`), "
            "but some information was lost.\nPlease check your gif and "
            "convert to uint8 beforehand if the gif looks wrong."
        )
        warnings.warn(message)
    image = [[
            struct.pack(
                'BBB',
                uint8_dataset[0, i, j],
                uint8_dataset[1, i, j],
                uint8_dataset[2, i, j]
            )
            for j in range(ncol)]
        for i in range(nrow)]
    return image
345583
def getSkeletalBoneData(self, action, eTransformSpace, eMotionRange, unTransformArrayCount):
        """"""

        fn = self.function_table.getSkeletalBoneData
        pTransformArray = VRBoneTransform_t()
        result = fn(action, eTransformSpace, eMotionRange, byref(pTransformArray), unTransformArrayCount)
        return result, pTransformArray