[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem array subscripting



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
image)

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

array[[0,1],[0,1],*]


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
downloading
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!