|
From: Eric E. <ems...@ob...> - 2004-12-21 15:35:10
|
just to answer your question:
>You still haven't answered my question if you typically want grayscale
>or colormapped images ....
>
>
I am using colourmaps.
Usually a 256 levels is usually more than enough! Here is what I did when
I transformed the midas lut and itt files (3 columns RGB in ascii files
see below)
into local python lut (pglut for ppgplot lut).
I am now thinking of using another suggestion (from Arnd) on top of what
you said.
If the image is very large then I only load the central region in imshow
(so I extract the central part, ''central'' meaning center with respect to
some predefined center, by default the centre of the image). Then if I want
to see the full image in the window I scale it (factor N)
by only plotting 1 out of N pixels.... This should reproduce what Midas
did I think
(not so sure, but Midas has a timed display of < 0.2 sec there in fact
whatever
the scale is / size of the window)
One note from a local neird: it seems that the normalisation (colour.py)
in the matplotlib 0.65 version
is doing a divide by (vmax - vmin) and this was timed to be quite long
(see previous mails...). But a numarray division should be instantaneous
even
for such a big image so there is something wrong there. Maytbe first
do : dv = vmax - vmin and divide by dv? (maybe this is not the reason,
using ''divide" and '/' may be different too?)
Eric
"""######################################
# MIDAS-LIKE LUT and ITT
######################################"""
class MidasLut:
def __init__(self):
self.LUT_PATH = '/soft/python/pcral/plotutils/midaslut/'
self.R = arange(256)/255.
self.G = arange(256)/255.
self.B = arange(256)/255.
self.L = arange(256)/255.
def lut(self,name):
sname = str(name)
sname = self.LUT_PATH+sname+".lasc"
if os.path.isfile(sname):
f = open(sname)
list = f.readlines()
for i in range(256):
self.R[i] = float(list[i].split()[0])
self.G[i] = float(list[i].split()[1])
self.B[i] = float(list[i].split()[2])
f.close
else :
print 'ERROR: Lut file', name,'does not exist'
def itt(name):
sname = str(name)
sname = LUT_PATH+sname+".iasc"
if os.path.isfile(sname):
f = open(sname)
list = f.readlines()
for i in range(256):
L[i] = float(list[i].split()[0])
f.close
else :
print 'ERROR: ITT file', name,'does not exist'
pglut = MidasLut()
--
===============================================================
Observatoire de Lyon ems...@ob...
9 av. Charles-Andre tel: +33 4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86
France http://www-obs.univ-lyon1.fr/eric.emsellem
===============================================================
|