[AstroPy] Moving Ahead with Raw Image Conversion
Tue Apr 14 13:32:31 CDT 2009
Wayne Watson wrote:
> Well, one more question about manipulation.
> rawim_numpy = numpy.fromfile('sent_internal.raw', dtype='uint8')
> was a good device for producing this from a file:
> array([1, 1, 1, ..., 1, 1, 1], dtype=uint8)
> a numpy array. In my program, I'm getting* the image in a string 307200
> "characters" long. Is there a device (fromstring?) that would do this in
> one fell swoop to get a numpy array?
> * as here: img_string=self.current_image.tostring()
Why not check for your self?
>>> import numpy
Help on built-in function fromstring in module numpy.core.multiarray:
fromstring(string, dtype=float, count=-1, sep='')
Return a new 1d array initialized from raw binary or text data in
More information about the AstroPy