Memory-maping of NPY files
ElemCo.MNPY
— ModuleA simplified version of NPZ.jl for mmaping npy files
NPY file format is described in https://github.com/numpy/numpy/blob/v1.7.0/numpy/lib/format.py
Exported functions
ElemCo.MNPY.mnpymmap
— Methodmnpymmap(filename::AbstractString)
Mmap a variable from filename
. The input needs to be an npy
file.
Zero-dimensional arrays are stripped while being read in, and the values that they contain are returned. This is a notable difference from numpy, where numerical values are written out and read back in as zero-dimensional arrays.
Examples
julia> using NPZ
julia> npzwrite("temp.npy", ones(3))
julia> mnpymmap("temp.npy") # Mmaps the variable
3-element Vector{Float64}:
1.0
1.0
1.0
Internal functions
ElemCo.MNPY.readheader
— Methodreadheader(filename)
Return a header corresponding to the variable contained in filename
. The header contains information about the eltype
and size
of the array that may be extracted using the corresponding accessor functions.