msl.io.dataset module
A Dataset is essentially a numpy.ndarray with Metadata.
- class msl.io.dataset.Dataset(name, parent, read_only, shape=(0, ), dtype=<class 'float'>, buffer=None, offset=0, strides=None, order=None, data=None, **metadata)[source]
Bases:
VertexA
Datasetis essentially anumpy.ndarraywithMetadata.Do not instantiate directly. Create a new
Datasetusingcreate_dataset().- Parameters:
read_only (
bool) – Whether theDatasetis to be accessed in read-only mode.shape – See
numpy.ndarraydtype – See
numpy.ndarraybuffer – See
numpy.ndarrayoffset – See
numpy.ndarraystrides – See
numpy.ndarrayorder – See
numpy.ndarraydata – If not
Nonethen it must be either anumpy.ndarrayor an array-like object which will be passed tonumpy.asarray(), as well as dtype and order, to be used as the underlying data.**metadata – All other key-value pairs will be used as
Metadatafor thisDataset.
- property data
The data of the
Dataset.Note
You do not have to call this attribute to get access to the
numpy.ndarray. You can directly call thenumpy.ndarrayattribute from theDatasetobject.For example,
>>> dset <Dataset '/my_data' shape=(4, 3) dtype='<f8' (0 metadata)> >>> dset.data array([[ 0., 1., 2.], [ 3., 4., 5.], [ 6., 7., 8.], [ 9., 10., 11.]]) >>> dset.size 12 >>> dset.tolist() [[0.0, 1.0, 2.0], [3.0, 4.0, 5.0], [6.0, 7.0, 8.0], [9.0, 10.0, 11.0]] >>> dset.mean(axis=0) array([4.5, 5.5, 6.5]) >>> dset[::2] array([[0., 1., 2.], [6., 7., 8.]])
- Type:
- property read_only
Whether this
Datasetis in read-only mode.This is equivalent to setting the
WRITEABLEproperty innumpy.ndarray.setflags().- Type: