class nmrglue.fileio.fileiobase.data_nd(order)[source]

Base class for building objects which emulate ndarray objects without loading data into memory. These object have the following properties:

  • slicing operations return ndarray objects
  • can iterate over with expected results
  • transpose and swapaxes functions create a new data_nd object with the new axes ordering
  • has ndim, shape, and dtype attributes.


Classes which are use this class as a base should define the following methods:

__init__ which must set up the object and defines at minimum:

self.fshape : tuple
Shape of the data on disk, the shape when order = (0, 1, 2, ..)
self.order : tuple
Ordering of the axes
self.dtype : dtype
Dtype of the emulated ndarray
self.__setdimandshape__ should be called if self.dim and self.shape
are not set up __init__.
__fgetitem__ which takes a well formatted tuple of slices and returns a
ndarray object with the selected data
__fcopy__(self, order) which created a copy of the object with the new


swapaxes(axis1, axis2) Return object with axis1 and axis2 interchanged.
transpose(*axes) Return object with axes transposed.

Previous topic


Next topic


This Page