[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem array subscripting
- Subject: Re: Problem array subscripting
- From: GRI <dibeas(at)etsit.upm.es>
- Date: Wed, 18 Aug 1999 22:22:59 +0200
- Newsgroups: comp.lang.idl-pvwave
- Organization: RedIRIS.
- References: <37B7FF76.F5062466@etsit.upm.es>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:16175
I think I did not explain myself very well the first time... I'll try again
What I want to do is to be able to get the evolution along time of some
pixels of a given image series. For instance, I want to see what values
pixel at the origin (x=0, y=0) takes as time goes by.
Suppose I define:
array= INDGEN(2,2,5) ; dimensions (x,y,t)
I want to extract vectors along the time dimensions, i.e. of length 5,
at any given combination of x and y.
For instance, I may need the vector at x=0, y=0 (from t=0 to t=4), and also
another vector at x=1, y=1 (I obtain the x and y coordinates from a masking
This vectors would be, in this case [0,4,8,12,16] and [3,7,11,15,19].
When using a combination of two vectors to index ARRAY like
what IDL does is combine each value in the first vector with all
elements in the second vector ([0,0], [0,1], [1,0], [1,1]), and all
values in the third dimension, as indicated by the asterisk, and so
I get (in this case) the original array.
In a general case this would be ok if I wanted to profile the array along
the time dimension at a regular grid ( [0,0], [10,0], [20,0], [0,10],
[10,10], [20,10] ...)
The only method I haved proved it works like I want is the 'ugly' one
proposed by Craig Markwardt. I have also seen it is really faster than
using a for loop when the number of vectors to extract is hight. Looks
like the use of the /OVERWRITE keyword makes it work very fast, since as
IDL's help says it only changes the data descriptor, not the data itself.
The other two methods give me the same results as indexing the time series
directly with [[0,1],[0,1],*].
I haven't been able to download Martin Schultz's arrex function (might be a
problem with my browser, the tools library is there, but instead of
it my Netscape opens it like if it were text, which is not).
Thanks everybody for your help.
P.S.: I hope I have explained this time, but as I read this again it looks
a lot like my original post... well, at least this time I have included
the little example!