comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: indexing 2-d vs. 3-d arrays...ARGH!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43605] Wed, 20 April 2005 14:08
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Henry writes:

>> With respect to the web page, I have no current plans
>> to abandon it, although the domain registration comes
>> up for renewal soon and the PayPal contributions have
>> been, well, less than overwhelming. I'd probably have
>> to conclude there are about 5 people who find the
>> information especially useful. :-)
>
> Done.
>
> -Henry

The fine folks at Habitat for Humanity thank you. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43607 is a reply to message #43605] Wed, 20 April 2005 13:49 Go to previous message
Henry is currently offline  Henry
Messages: 8
Registered: April 2005
Junior Member
> With respect to the web page, I have no current plans
> to abandon it, although the domain registration comes
> up for renewal soon and the PayPal contributions have
> been, well, less than overwhelming. I'd probably have
> to conclude there are about 5 people who find the
> information especially useful. :-)

Done.

-Henry
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43614 is a reply to message #43607] Wed, 20 April 2005 11:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kenneth Bowman writes:

> I'm sure David isn't *really* going away. He only *thinks* he wants
> to go back to college. David is the Michael Jordan of IDL. (Remember
> MJ and baseball?).

You are probably right, but...still, I've pretty much
given up competitive tennis and I *never* thought that
would happen!

I feel like a snake shedding his skin. Who knows
what is possible?

With respect to the web page, I have no current plans
to abandon it, although the domain registration comes
up for renewal soon and the PayPal contributions have
been, well, less than overwhelming. I'd probably have
to conclude there are about 5 people who find the
information especially useful. :-)

Still, I need a forum for all the travel writing I
plan soon. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43615 is a reply to message #43614] Wed, 20 April 2005 10:47 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <1114017881.895662.89690@o13g2000cwo.googlegroups.com>,
"Henry" <henrygroe@yahoo.com> wrote:

> Let me echo JD's request: David, please, whatever you do, don't let
> your web page die. I use it too often, and (more importantly) refer
> people to it too often.

I'm sure David isn't *really* going away. He only *thinks* he wants
to go back to college. David is the Michael Jordan of IDL. (Remember
MJ and baseball?).

Ken
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43616 is a reply to message #43615] Wed, 20 April 2005 10:24 Go to previous message
Henry is currently offline  Henry
Messages: 8
Registered: April 2005
Junior Member
Yep...it was one of those many things I once knew, but then forgot. I
actually went searching through some old code to see if I'd messed it
up elsewhere. I found I'd taken advantage of this in a couple places
and even left gloating comments about what a neat trick it was!! I
claim graduate school ate my brain.

Let me echo JD's request: David, please, whatever you do, don't let
your web page die. I use it too often, and (more importantly) refer
people to it too often.

cheers,
-Henry
Re: indexing 2-d vs. 3-d arrays...ARGH! [message #43636 is a reply to message #43616] Tue, 19 April 2005 16:27 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Tue, 19 Apr 2005 14:39:20 -0700, Henry wrote:

>
> Hey folks,
>
> This one tripped me up today. Wonder how many other places in code
> I've been messed up by it. I (vaguely) understand the logic behind it.
>
> Let's say you want to grab some points out of a 2-d image or a 3-d
> stack of images:
>
> To set the stage, some pretend images and indexes of the points to
> grab:
> arr2 = dindgen(10,10)
> arr3 = dindgen(10,10,5)
> index1 = [2,6]
> index2 = [3,7]
>
> Now,
> help, arr2[index1,index2]
> gives
> <Expression> DOUBLE = Array[2]
> which is what I would expect.
>
> BUT,
> help,arr3[index1, index2, 2]
> gives
> <Expression> DOUBLE = Array[2, 2]
> which is what screwed me up.
>
> IDL demands:
> help,arr3[index1, index2, replicate(2,2)]
> to get:
> <Expression> DOUBLE = Array[2]
>
>
> Get it? Got it? Good.

Why don't you have a read through:

http://dfanning.com/misc_tips/submemory.html

The bottom line? If all indexing arrays match in dimension, as a
special case, IDL "threads the list" and the result has the same size
as each index array. If they don't match, it "inflates the list", by
matching things up one element at a time. So in your middle case, it
sees:

[2,6],[3,7],2

and it says: OK, we're don't have matched index arrays. They must
want 2,6,2; 6,7,2; 6,3,2; 6,7,2. You might argue you really wanted
2,3,2;6,7,2, and would therefore prefer IDL to sub-thread any subset
of the indexing arrays which have matching dimensions. It's not a bad
idea, it just isn't how IDL works.

JD

P.S. David, I hope you don't stop pulling those nuggets from the newgroup
and sticking them on your webpage (or, perish the thought, let your
webpage wither and die).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: deleting a window created with envi_info_wid
Next Topic: why do not the results agree?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:11:59 PDT 2025

Total time taken to generate the page: 0.56307 seconds