sidpy/hdf/reg_ref.py
def create_region_reference(h5_main, ref_inds):
    """
    Create a region reference in the destination dataset using an iterable of
    pairs of indices representing the start and end points of a hyperslab block

    Parameters
    ----------
    h5_main : HDF5 dataset
        dataset the region will be created in
    ref_inds : Iterable
        index pairs, [start indices, final indices] for each block in the
        hyperslab

    Returns
    -------
    new_ref : HDF5 Region reference
        reference in `h5_main` for the blocks of points defined by `ref_inds`

    """
    if not isinstance(h5_main, h5py.Dataset):
        raise TypeError('h5_main should be a h5py.Dataset object')
    if not isinstance(ref_inds, Iterable):
        raise TypeError('ref_inds should be a list or tuple')

    h5_space = h5_main.id.get_space()
    h5_space.select_none()

    for start, stop in ref_inds:
        block = stop - start + 1
        h5_space.select_hyperslab(tuple(start), (1, 1),
                                  block=tuple(block), op=1)

    if not h5_space.select_valid():
        warn('Could not create new region reference.')
        return None
    new_ref = h5py.h5r.create(h5_main.id, b'.', h5py.h5r.DATASET_REGION,
                              space=h5_space)

    return new_ref

    Create a region reference in the destination dataset using an iterable of
    pairs of indices representing the start and end points of a hyperslab block

    Parameters
    ----------
    h5_main : HDF5 dataset
        dataset the region will be created in
    ref_inds : Iterable
        index pairs, [start indices, final indices] for each block in the
        hyperslab

    Returns
    -------
    new_ref : HDF5 Region reference
        reference in `h5_main` for the blocks of points defined by `ref_inds`

    
Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block

Parameters

h5_main : HDF5 dataset
dataset the region will be created in
ref_inds : Iterable
index pairs, [start indices, final indices] for each block in the
hyperslab

Returns

new_ref : HDF5 Region reference
reference in `h5_main` for the blocks of points defined by `ref_inds`
Create a region reference in the destination dataset using an iterable of pairs of indices representing the start and end points of a hyperslab block Parameters h5_main : HDF5 dataset dataset the region will be created in ref_inds : Iterable index pairs [ start indices final indices ] for each block in the hyperslab Returns new_ref : HDF5 Region reference reference in ` h5_main ` for the blocks of points defined by ` ref_inds `
def create_region_reference(h5_main, ref_inds):
    if not isinstance(h5_main, h5py.Dataset):
        raise TypeError('h5_main should be a h5py.Dataset object')
    if not isinstance(ref_inds, Iterable):
        raise TypeError('ref_inds should be a list or tuple')
    h5_space = h5_main.id.get_space()
    h5_space.select_none()
    for start, stop in ref_inds:
        block = stop - start + 1
        h5_space.select_hyperslab(tuple(start), (1, 1),
                                  block=tuple(block), op=1)
    if not h5_space.select_valid():
        warn('Could not create new region reference.')
        return None
    new_ref = h5py.h5r.create(h5_main.id, b'.', h5py.h5r.DATASET_REGION,
                              space=h5_space)
    return new_ref
def create_region_reference ( h5_main , ref_inds ) : if not isinstance ( h5_main , h5py . Dataset ) : raise TypeError ( 'h5_main should be a h5py.Dataset object' ) if not isinstance ( ref_inds , Iterable ) : raise TypeError ( 'ref_inds should be a list or tuple' ) h5_space = h5_main . id . get_space ( ) h5_space . select_none ( ) for start , stop in ref_inds : block = stop - start + 1 h5_space . select_hyperslab ( tuple ( start ) , ( 1 , 1 ) , block = tuple ( block ) , op = 1 ) if not h5_space . select_valid ( ) : warn ( 'Could not create new region reference.' ) return None new_ref = h5py . h5r . create ( h5_main . id , b'.' , h5py . h5r . DATASET_REGION , space = h5_space ) return new_ref
Create a region reference in the destination dataset using an iterable of
pairs of indices representing the start and end points of a hyperslab block
Create a region reference in the destination dataset using an iterable of pairs of indices representing the start and end points of a hyperslab block
"""
    Create a region reference in the destination dataset using an iterable of
    pairs of indices representing the start and end points of a hyperslab block

    Parameters
    ----------
    h5_main : HDF5 dataset
        dataset the region will be created in
    ref_inds : Iterable
        index pairs, [start indices, final indices] for each block in the
        hyperslab

    Returns
    -------
    new_ref : HDF5 Region reference
        reference in `h5_main` for the blocks of points defined by `ref_inds`

    """
h5_main
ref_inds