rex.resource.ResourceDataset
- class ResourceDataset(ds, scale_attr='scale_factor', add_attr='add_offset', unscale=True)[source]
Bases:
object
h5py.Dataset wrapper for Resource .h5 files
- Parameters:
ds (h5py.dataset) – Open .h5 dataset instance to extract data from
scale_attr (str | list | optional) – Name of scale factor attribute, by default ‘scale_factor’. Can also be a prioritized list of scale factor names.
add_attr (str | list | optional) – Name of add offset attribute, by default ‘add_offset’. Can also be a prioritized list of add offset names.
unscale (bool, optional) – Flag to unscale dataset data, by default True
Methods
extract
(ds, ds_slice[, scale_attr, ...])Extract data from Resource Dataset
Attributes
Dataset add offset
Dataset chunk size
Open Dataset instance
Dataset dtype
Dataset scale factor
Dataset shape
Dataset size
- property ds
Open Dataset instance
- Returns:
h5py(d).Dataset
- property shape
Dataset shape
- Returns:
tuple
- property size
Dataset size
- Returns:
int
- property dtype
Dataset dtype
- Returns:
str | numpy.dtype
- property chunks
Dataset chunk size
- Returns:
tuple
- property scale_factor
Dataset scale factor
- Returns:
float
- property adder
Dataset add offset
- Returns:
float
- classmethod extract(ds, ds_slice, scale_attr='scale_factor', add_attr='add_offset', unscale=True)[source]
Extract data from Resource Dataset
- Parameters:
ds (h5py.dataset) – Open .h5 dataset instance to extract data from
ds_slice (tuple) – Tuple of (int, slice, list, ndarray) of what to extract from ds, each arg is for a sequential axis
scale_attr (str, optional) – Name of scale factor attribute, by default ‘scale_factor’
add_attr (str, optional) – Name of add offset attribute, by default ‘add_offset’
unscale (bool, optional) – Flag to unscale dataset data, by default True