Exemple #1
0
	def stack_frames(cls, arrays):
		arrays = list(arrays) #could be a generator
		assert(all(isinstance(a, InternalArray) for a in arrays))
		c = arrays[0].converter
		has_fw = arrays[0].has_frameweights
		assert(all(c == a.converter for a in arrays))
		assert(all(has_fw == a.has_frameweights for a in arrays))
		new_array = np.row_stack([a.array for a in arrays])
		if(has_fw):
			new_frameweights = np.concatenate([a.frameweights for a in arrays])
			return(InternalArray(c, new_array, new_frameweights))
		return(InternalArray(c, new_array))
Exemple #2
0
 def stack_frames(cls, arrays):
     arrays = list(arrays)  #could be a generator
     assert (all(isinstance(a, InternalArray) for a in arrays))
     c = arrays[0].converter
     has_fw = arrays[0].has_frameweights
     assert (all(c == a.converter for a in arrays))
     assert (all(has_fw == a.has_frameweights for a in arrays))
     new_array = np.row_stack([a.array for a in arrays])
     if (has_fw):
         new_frameweights = np.concatenate([a.frameweights for a in arrays])
         return (InternalArray(c, new_array, new_frameweights))
     return (InternalArray(c, new_array))
Exemple #3
0
 def getframes(self, frame_indices):
     """ Expects a list of frame-indices. Returns an new InternalArray containing only those frames."""
     assert (all([isinstance(i, int) for i in frame_indices]))
     if (self.has_frameweights):
         return (InternalArray(self.converter, self.array[frame_indices, :],
                               self.frameweights[frame_indices]))
     return (InternalArray(self.converter, self.array[frame_indices, :]))
Exemple #4
0
 def delframes(self, frame_indices):
     """ Expects a list of frame-indices. Returns an new InternalArray without those frames."""
     assert (all([isinstance(i, int) for i in frame_indices]))
     if (self.has_frameweights):
         return (InternalArray(
             self.converter, np.delete(self.array, frame_indices, 0),
             np.delete(self.frameweights, frame_indices, 0)))
     return (InternalArray(self.converter,
                           np.delete(self.array, frame_indices, 0)))
Exemple #5
0
	def getframes(self, frame_indices):
		""" Expects a list of frame-indices. Returns an new InternalArray containing only those frames."""
		assert(all([isinstance(i, int) for i in frame_indices]))
		if(self.has_frameweights):
			return(InternalArray(self.converter, self.array[frame_indices, :], self.frameweights[frame_indices,:]))
		return(InternalArray(self.converter, self.array[frame_indices, :]))
Exemple #6
0
	def delframes(self,frame_indices):
		""" Expects a list of frame-indices. Returns an new InternalArray without those frames."""
		assert(all([isinstance(i, int) for i in frame_indices]))
		if(self.has_frameweights):
			return(InternalArray(self.converter, np.delete(self.array,frame_indices,0), np.delete(self.frameweights,frame_indices,0)))
		return(InternalArray(self.converter, np.delete(self.array,frame_indices,0)))