lentil.helper.slice_offset#
- lentil.helper.slice_offset(slice, shape)[source]#
- Compute the offset of the center of a 2D slice relative to the center of a larger array. - It is assumed the center of the larger containing array with shape (m,n) is at: - r = m - np.floor(m/2) c = n - np.floor(n/2) - Parameters:
- slice ((2,) array_like) – 2D slice. Entries must be - sliceobjects or- Ellipsis.
- shape ((2,) array_like) – Shape of containing array the slice is taken from. 
 
- Returns:
- offset – Offset ordered according to - indexing.
- Return type:
- tuple or None 
 - See also