def trimone(x, front=0, back=0, axis=0):
 shape = np.array(x.shape)
 shape[axis] -= (front + back)
 shapearr = np.array(x.shape)
 startind = np.zeros(x.ndim)
 startind[axis] = front
 endind = (startind + shape)
 myslice = [slice(startind[k], endind[k]) for k in range(len(endind))]
 return x[tuple(myslice)]

def trimone ( x , front = 0 , back = 0 , axis = 0 ) : shape = np . array ( x . shape ) shape [ axis ] -= ( front + back ) shapearr = np . array ( x . shape ) startind = np . zeros ( x . ndim ) startind [ axis ] = front endind = ( startind + shape ) myslice = [ slice ( startind [ k ] , endind [ k ] ) for k in range ( len ( endind ) ) ] return x [ tuple ( myslice ) ]
trim number of array elements along one axis examples .