[SciPy-user] step in arrays

bryan cole scipy-user@scipy.net
03 Feb 2003 12:07:43 +0000


how about:

...
b.shape=(2168,5004)
c = b[0:2168:8,0:5004:8] #this should subsample b every 8th point
xplt.imagesc(c)
...

Bryan

On Mon, 2003-02-03 at 12:02, Agustin Lobo wrote:
> Hi! 
> I would need a little help on this:
> 
> I want to read a set of images
> (raw bin data, unsigned int*8) and
> display them using xply.imagesc just
> to mae sure there have been no errors at downloding
> them.
> 
> For each file, I'm doing the following:
> 
> f =open("NDVI_GIMMS_8KM.8107","r")
> a=f.read()
> b = array(a,typecode=UnsignedInt8)
> b.shape = (2168,5004)
> xplt.imagesc(b)
> 
> The problem is that, as the array "b" is very large,
> the display takes too long. Therefore, I'm trying
> to subsample b. I've tried with take(), but no luck.
> The question is, how could I select every i.e. 10th row
> and col from matrix b?
> 
> Also, any other comment on improving what I want to do
> is welcome! (perhaps I can subsample at reading).
> 
> Thanks
> 
> Agus
> 
> 
> Dr. Agustin Lobo
> Instituto de Ciencias de la Tierra (CSIC)
> Lluis Sole Sabaris s/n
> 08028 Barcelona SPAIN
> tel 34 93409 5410
> fax 34 93411 0012
> alobo@ija.csic.es
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
-- 
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382