def _offset_from_spaces(dom, ran):
    """Return index offset corresponding to given spaces."""
    affected = np.not_equal(dom.shape, ran.shape)
    diff_l = np.abs(ran.grid.min() - dom.grid.min())
    offset_float = diff_l / dom.cell_sides
    offset = np.around(offset_float).astype(int)
    for i in range(dom.ndim):
        if affected[i] and not np.isclose(offset[i], offset_float[i]):
            raise ValueError('in axis {}: range is shifted relative to domain '
                             'by a non-multiple {} of cell_sides'
                             ''.format(i, offset_float[i] - offset[i]))
    offset[~affected] = 0
    return tuple(offset)
def _offset_from_spaces ( dom , ran ) : affected = np . not_equal ( dom . shape , ran . shape ) diff_l = np . abs ( ran . grid . min ( ) - dom . grid . min ( ) ) offset_float = diff_l / dom . cell_sides offset = np . around ( offset_float ) . astype ( int ) for i in range ( dom . ndim ) : if affected [ i ] and not np . isclose ( offset [ i ] , offset_float [ i ] ) : raise ValueError ( 'in axis {}: range is shifted relative to domain ' 'by a non-multiple {} of cell_sides' '' . format ( i , offset_float [ i ] - offset [ i ] ) ) offset [ ~ affected ] = 0 return tuple ( offset )
Return index offset corresponding to given spaces.