[Numpy-discussion] numpy save files from C

Robert Kern robert.kern@gmail....
Thu Feb 26 17:14:57 CST 2009


On Thu, Feb 26, 2009 at 17:05, John Hunter <jdh2358@gmail.com> wrote:
> A colleague of mine has a bunch of numpy arrays saved with np.save and
> he now wants to access them directly in C, with or w/o the numpy C API
> doesn't matter.  Does anyone have any sample code lying around which
> he can borrow from?  The array is a structured array with an otherwise
> plain vanilla dtype (ints and floats).
>
> I've referred him to the npy-format NEP document, as well as the
> format.py implementation, so he can roll his own if need be, but if
> someone has a head start code example that would be great.

If anyone does, it would probably be me, but I don't. If you already
know the dtype beforehand, reading the header offset and skipping to
the data is probably the easiest.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list