Documentation ¶
Index ¶
- type NpyReader
- func (rdr *NpyReader) GetComplex128() ([]complex128, error)
- func (rdr *NpyReader) GetComplex64() ([]complex64, error)
- func (rdr *NpyReader) GetFloat32() ([]float32, error)
- func (rdr *NpyReader) GetFloat64() ([]float64, error)
- func (rdr *NpyReader) GetInt16() ([]int16, error)
- func (rdr *NpyReader) GetInt32() ([]int32, error)
- func (rdr *NpyReader) GetInt64() ([]int64, error)
- func (rdr *NpyReader) GetInt8() ([]int8, error)
- func (rdr *NpyReader) GetUint16() ([]uint16, error)
- func (rdr *NpyReader) GetUint32() ([]uint32, error)
- func (rdr *NpyReader) GetUint64() ([]uint64, error)
- func (rdr *NpyReader) GetUint8() ([]uint8, error)
- type NpyWriter
- func (wtr *NpyWriter) WriteComplex128(data []complex128) error
- func (wtr *NpyWriter) WriteComplex64(data []complex64) error
- func (wtr *NpyWriter) WriteFloat32(data []float32) error
- func (wtr *NpyWriter) WriteFloat64(data []float64) error
- func (wtr *NpyWriter) WriteInt16(data []int16) error
- func (wtr *NpyWriter) WriteInt32(data []int32) error
- func (wtr *NpyWriter) WriteInt64(data []int64) error
- func (wtr *NpyWriter) WriteInt8(data []int8) error
- func (wtr *NpyWriter) WriteUint16(data []uint16) error
- func (wtr *NpyWriter) WriteUint32(data []uint32) error
- func (wtr *NpyWriter) WriteUint64(data []uint64) error
- func (wtr *NpyWriter) WriteUint8(data []uint8) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NpyReader ¶
type NpyReader struct { // The numpy data type of the array Dtype string // The endianness of the binary data Endian binary.ByteOrder // The version number of the file format Version int // The shape of the array as specified in the file. Shape []int // If true, the data are flattened in column-major order, // otherwise they are flattened in row-major order. ColumnMajor bool // contains filtered or unexported fields }
NpyReader can read data from a Numpy binary array into a Go slice.
func NewFileReader ¶
NewFileReader returns a NpyReader that can be used to obtain array data from the given named file. Call one of the GetXXX methods to obtain the data as a Go slice.
func NewReader ¶
NewReader returns a NpyReader that can be used to obtain array data as a Go slice. The Go slice has a type matching the dtype in the Numpy file. Call one of the GetXX methods to obtain the slice.
func (*NpyReader) GetComplex128 ¶
func (rdr *NpyReader) GetComplex128() ([]complex128, error)
GetComplex128 returns the array data as a slice of complex128 values.
func (*NpyReader) GetComplex64 ¶
GetComplex64 returns the array data as a slice of complex64 values.
func (*NpyReader) GetFloat32 ¶
GetFloat32 returns the array data as a slice of float32 values.
func (*NpyReader) GetFloat64 ¶
GetFloat64 returns the array data as a slice of float64 values.
type NpyWriter ¶
type NpyWriter struct { // Defaults to little endian, but can be set to // binary.BigEndian before writing data Endian binary.ByteOrder // Defaults to nx1, where n is the length of data. Can be set // to any shape with any number of dimensions. The shape is // not checked for compatibility with the data. Shape []int // Defaults to false (row major order), can be set to true // (column major order) before writing the data. ColumnMajor bool // Defaults to 1, can be set to 2 before writing the data. Version int // contains filtered or unexported fields }
NpyWriter can write data from a Go slice to a Numpy binary array.
func NewFileWriter ¶
NewFileWriter returns a NpyWriter that can be used to write data to a Numpy binary format file. After creation, call one of the WriteXX methods to write array data to the file. The file is automatically closed at the end of that call. Only one array can be written to a file.
func NewWriter ¶
func NewWriter(w io.WriteCloser) (*NpyWriter, error)
NewWriter returns a NpyWriter that can be used to write data to an io.WriteCloser, using the Numpy binary format. After creation, call one of the WriteXXX methods to write array data to the writer. The file is automatically closed at the end of that call. Only one slice can be written to the writer.
func (*NpyWriter) WriteComplex128 ¶
func (wtr *NpyWriter) WriteComplex128(data []complex128) error
WriteComplex128 writes a slice of complex128 values in npy format.
func (*NpyWriter) WriteComplex64 ¶
WriteComplex64 writes a slice of complex64 values in npy format.
func (*NpyWriter) WriteFloat32 ¶
WriteFloat32 writes a slice of float32 values in npy format.
func (*NpyWriter) WriteFloat64 ¶
WriteFloat64 writes a slice of float64 values in npy format.
func (*NpyWriter) WriteInt16 ¶
WriteInt16 writes a slice of int16 values in npy format.
func (*NpyWriter) WriteInt32 ¶
WriteInt32 writes a slice of int32 values in npy format.
func (*NpyWriter) WriteInt64 ¶
WriteInt64 writes a slice of int64 values in npy format.
func (*NpyWriter) WriteUint16 ¶
WriteUint16 writes a slice of uint16 values in npy format.
func (*NpyWriter) WriteUint32 ¶
WriteUint32 writes a slice of uint32 values in npy format.
func (*NpyWriter) WriteUint64 ¶
WriteUint64 writes a slice of uint64 values in npy format.
func (*NpyWriter) WriteUint8 ¶
WriteUint8 writes a slice of uint8 values in npy format.