npy library

Plugin for reading and writing NumPy binary files (.npy and .npz).

Classes

ByteTransformer
Transforms a stream to emit chunks of the specified bufferSize. If bufferSize is not provided, the stream will be emitted as chunks of default size.
NdArray<T>
NpyDType
NpyHeader<T>
NpyHeaderSection
NpyParser<T>
NpyVersion
The version of the numpy file. It is composed of a major and minor version. Supported major version are currently 1, 2 and 3. Supported minor version are currently 0.
NpzFile
The NpzFile class represents a zip file containing one or more .NPY files. It provides methods for loading, saving, and manipulating the contents of the .NPZ file.

Enums

NpyEndian
The endianness of the NPY file. It is represented by a single character. Single-byte data types are always NpyEndian.none.
NpyType
The supported data types of the NPY file. A data type is represented by one or multiple single-character representations. If more than one representation exists, the first one is used for saving. This package aims to gradually increase support for more data types.

Constants

magicString → const String
Marks the beginning of an NPY file.
newLineOffset → const int
The header section is terminated with a single byte that is a newline character.
supportedInputTypes → const Set<Type>
The supported input types for the NdArray class.

Functions

flattenCOrder<T>(List list) List<T>
flattenFortranOrder<T>(List list, {required List<int> shape}) List<T>
getPaddingSize(int size) int
Returns the number of padding bytes needed to make the given size a multiple of 64.
littleEndian16ToInt(List<int> bytes) int
Converts the given bytes to a 16-bit unsigned integer in little-endian byte order.
littleEndian32ToInt(List<int> bytes) int
Converts the given bytes to a 32-bit unsigned integer in little-endian byte order.
parseByteData<T>(List<int> bytes, NpyDType dtype) List<T>
Parse byte data according to the dtype and return a one-dimensional, flattened List of values.
reshape<T>(List<T> oneDimensionalList, List<int> shape, {bool fortranOrder = false}) List
Reshape a one-dimensional List according to the given shape and order (C or Fortran).
save(String path, List list, {NpyDType? dtype, NpyEndian? endian, bool? fortranOrder}) Future<void>
Convenience function to save a List to the given path in NPY format. Alternatively use NdArray.save.