NPY¶
IO interface to numpy arrays.
-
class
Source
(array=None, shape=None, dtype=None, order=None, name=None)[source]¶ Bases:
ClearMap.IO.Source.Source
Numpy array source.
-
as_virtual
()[source]¶ Return virtual source without array data to pass in parallel processing.
Returns
- sourceSource class
The source class without array data.
-
property
array
¶ The underlying data array.
Returns
- arrayarray
The underlying data array of this source.
-
property
dtype
¶ The data type of the source.
Returns
- dtypedtype
The data type of the source.
-
property
element_strides
¶ The strides of the array elements.
Returns
- stridestuple
Strides of the array elements.
Note
The strides of the elements module itemsize instead of bytes.
-
property
name
¶ The name of this source.
Returns
- namestr
Name of this source.
-
property
offset
¶ The offset of the memory map in the file.
Returns
- offsetint
Offset of the memeory map in the file.
-
property
order
¶ The order of how the data is stored in the source.
Returns
- orderstr
Returns ‘C’ for C contigous and ‘F’ for fortran contigous, None otherwise.
-
property
shape
¶ The shape of the source.
Returns
- shapetuple
The shape of the source.
-
-
create
(shape=None, dtype=None, order=None, array=None, as_source=True, **kwargs)[source]¶ Create a numpy array.
Arguments
- shapetuple or None
The shape of the memory map to create.
- dtypedtype
The data type of the memory map.
- order‘C’, ‘F’, or None
The contiguous order of the memmap.
- arrayarray, Source or None
Optional source with data to fill the numpy array with.
- as_sourcebool
If True, return as Source class.
Returns
- arraynp.array
The numpy array.
Note
By default numpy arrays are initialized as fortran contiguous if order is None.