J
Johannes Bauer
Hi group,
I'm confused, kind of. The application I'm writing currently reads data
from a FITS file and should display it on a gtk window. So far I have:
[...]
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
pb_pixels = pb.get_pixels_array()
print(type(fits_pixels))
print(type(pb_pixels))
which gives
<type 'numpy.ndarray'>
<type 'array'>
So now I want to copy the fits_pixels -> pb_pixels. Doing
pb_pixels = fits_pixels
works and is insanely fast, however the picture looks all screwed-up
(looks like a RGB picture of unititialized memory, huge chunks of 0s
interleaved with lots of white noise).
Doing the loop:
for x in range(width):
for y in range(height):
pb_pixels[y, x] = fits_pixels[y, x]
works as expected, but is horribly slow (around 3 seconds for a 640x480
picture).
So now I've been trying to somehow convert the array in a fast manner,
but just couldn't do it. What exactly is "array" anyways? I know
"array.array", but that's something completely different, right? Does
anyone have hints on how to go do this?
Kind regards,
Johannes
I'm confused, kind of. The application I'm writing currently reads data
from a FITS file and should display it on a gtk window. So far I have:
[...]
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
pb_pixels = pb.get_pixels_array()
print(type(fits_pixels))
print(type(pb_pixels))
which gives
<type 'numpy.ndarray'>
<type 'array'>
So now I want to copy the fits_pixels -> pb_pixels. Doing
pb_pixels = fits_pixels
works and is insanely fast, however the picture looks all screwed-up
(looks like a RGB picture of unititialized memory, huge chunks of 0s
interleaved with lots of white noise).
Doing the loop:
for x in range(width):
for y in range(height):
pb_pixels[y, x] = fits_pixels[y, x]
works as expected, but is horribly slow (around 3 seconds for a 640x480
picture).
So now I've been trying to somehow convert the array in a fast manner,
but just couldn't do it. What exactly is "array" anyways? I know
"array.array", but that's something completely different, right? Does
anyone have hints on how to go do this?
Kind regards,
Johannes