[SciPy-user] numpy indexing with arrays

Jeremy Sanders jeremy@jeremysanders....
Wed Dec 10 06:26:01 CST 2008


Hi - I've been trying to think of a way of doing this in numpy. Is it
possible without an explicit loop?

I have an array of values

vals = [1.1, 2.2, 3.3...]

I also have a 2D array of indices into this vals array:

img = [[1,2,3],
       [2,3,4],
       ..]

Can I make another image with values from vals as indexed by the indicies in
img? i.e.,

img = [[1.1, 2.2, 3.3],
       [2.2, 3.3, 4.4],
       ...]

Thanks

Jeremy




More information about the SciPy-user mailing list