comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Arrays: strange feature ?!
items: Re: Arrays: strange feature ?!

Arrays: strange feature ?!
type: item
description: Hi. More I use IDL, more I found strange features. The one I want to talk about is the way you create multidimensional arrays. Look the following IDL commands sequence: IDL> print, [[1, 2], [3, 4]] 1 2 3 4 IDL> a = [1, 2] IDL> b = [3, 4] IDL> print, [a, b] 1 2 3 4 Why the same notation has two meanings? Why for the first print the [something, something_else] notation creates an array of arrays, and for the second one the same notation concatenates the arrays? I can't find the logic behind this. In fact I stopped on this because I want to create an array of images using something like that: [image1, image2, image3]. What is the way to do this without creating a new temporary variable array? Or is there a way to create easily a list of anything. I want to build a procedure that takes a list of images and displays them, something like that: myDisplayProcedure, myImagesList, parameter1, parameter2 where myImagesList is something like that: {image1, image2, image3} or anything else that can be create on the command line. I hope I am clear enough. Any comments? Any suggestions? Nicolas. -- Tï¿½l. : 00 (33) 5 62 88 11 16 Fax : 00 (33) 5 62 88 11 12 Nicolas.Decoster@Noveltis.fr Noveltis Parc Technologique du Canal 2, avenue de l'Europe 31520 Ramonville Saint Agne - France
creator: Nicolas Decoster
date: 2000-05-03T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: In article <3910324B.CDDD96FB@pet.mpin-koeln.mpg.de>, Alex Schuster <alex@pet.mpin-koeln.mpg.de> wrote: > You can create the array like this: > > image = [ [image1], [image2], [image3] ] Not quite. In fact, the notation is remarkably flexible. IDL> i1 = bytarr(10,20) IDL> i2 = i1 IDL> i3 = i1 IDL> t = [i1,i2,i3] IDL> help,t T BYTE = Array[30, 20] IDL> t = [[i1],[i2],[i3]] IDL> help,t T BYTE = Array[10, 60] IDL> t = [[[i1]],[[i2]],[[i3]]] IDL> help,t T BYTE = Array[10, 20, 3] IDL> t2 = [t,t] IDL> help,t2 T2 BYTE = Array[20, 20, 3] IDL> t2 = [[t],[t]] IDL> help,t2 T2 BYTE = Array[10, 40, 3] IDL> t2 = [[[t]],[[t]]] IDL> help,t2 T2 BYTE = Array[10, 20, 6] IDL> t2 = [[[[t]]],[[[t]]]] t2 = [[[[t]]],[[[t]]]] ^ % Only eight levels of variable concatenation are allowed. IDL> As you can see, there is a limit. For three or fewer dimensions, the rule seems to be that if the number of outermost brackets in a row is 1, the arrays are concatenated in X; if 2, they are concatenated in Y; and if 3, they are concatenated in Z. Consider this further example: IDL> x = indgen(10) IDL> help, [[[x]],[[x]],[[x]]] <Expression> INT = Array[10, 1, 3] YMMV, but I like it, myself. Bob Hill -- Robert S. Hill Raytheon ITSS Code 681, NASA/GSFC, Greenbelt, MD 20771 Sent via Deja.com http://www.deja.com/ Before you buy.
creator: rshill
date: 2000-05-03T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Nicolas Decoster wrote: > In fact I stopped on this because I want to create an array of images > using something like that: [image1, image2, image3]. What is the way to > do this without creating a new temporary variable array? Or is there a > way to create easily a list of anything. You can create the array like this: image = [ [image1], [image2], [image3] ] Or: image = REFORM( [ image1, image2, image3 ], N_ELEMENTS( image1 ), 3 ) Alex -- Alex Schuster Wonko@weird.cologne.de PGP Key available alex@pet.mpin-koeln.mpg.de
creator: Alex Schuster
date: 2000-05-03T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: On Wed, 3 May 2000, Nicolas Decoster wrote: > More I use IDL, more I found strange features. me too. > The one I want to talk > about is the way you create multidimensional arrays. Look the following > IDL commands sequence: > > IDL> print, [[1, 2], [3, 4]] > 1 2 > 3 4 > IDL> a = [1, 2] > IDL> b = [3, 4] > IDL> print, [a, b] > 1 2 3 4 > > Why the same notation has two meanings? IDL is clearly a language grown by piling up things with no previous design. Its syntax is crazy and some characteristics are very annoying. It is very nice for quick and dirty programming, but reallya mess for large scale projects. l.f. ------------------------------------------------------------ -------------- -- ) Luca Fini Tel: +39 055 2752 307 ___ |\ Osservatorio Astrofisico di Arcetri Fax: +39 055 2752 292 / | | |-_ L.go E.Fermi, 5 +----------------------------------------- (___|___//___) 50125 Firenze / WWW: http://www.arcetri.astro.it/~lfini (_) (_) Italia / e-mail: lfini@arcetri.astro.it -----------------------------+------------------------------ -------------- In a world without fences - who needs GATES?
creator: Luca Fini
date: 2000-05-04T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Luca Fini (lfini@arcetri.astro.it) writes: > IDL is clearly a language grown by piling up things with no previous > design. Its syntax is crazy and some characteristics are very annoying. Some of us find in IDL the same subtle intelligence that pervades the Universe. If it seems crazy to us, it is because we haven't evolved our consciousness enough to perceive the underlying plan. Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: davidf
date: 2000-05-09T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Nicolas Decoster (Nicolas.Decoster@Noveltis.fr) writes: > It seems that IDL likes the one-notation-two-actions thing. I must say > that such a thing is confusing me. I hope I will not loose too much time > in trying to understand all the IDL's "strange feature". You are focused on the wrong thing. Instead of worrying about "losing too much time", you should see this as an opportunity to learn something no one else is going to be able to figure out, thereby making it possible for you to charge big bucks for your specialized knowledge. :-) Cheers, David P.S. Let's just say IDL makes it real easy for someone to get into the consulting business if they have that entrepreneurial state of mind. -- David Fanning, Ph.D. Fanning Software Consulting Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: davidf
date: 2000-05-11T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Benno Puetz wrote: > > marc wrote: > >> But another more funny 'feature' is this: >> >> IDL> print,'abc' >> abc >> IDL> print,"abc" >> abc >> IDL> print,'777' >> 777 >> IDL> print,"777" >> >> print,"777" >> ^ >> % Syntax error. >> >> Cheers, >> :-) marc > > It's a real feature Let me connect these words to the subject: "It's a real _strange_ feature" These "strange feature" is much more confusing with the following lines: IDL> print, "877" 877 IDL> print, "777" print, "777" ^ % Syntax error. It seems that IDL likes the one-notation-two-actions thing. I must say that such a thing is confusing me. I hope I will not loose too much time in trying to understand all the IDL's "strange feature". Later. Nicolas. -- Tï¿½l. : 00 (33) 5 62 88 11 16 Fax : 00 (33) 5 62 88 11 12 Nicolas.Decoster@Noveltis.fr Noveltis Parc Technologique du Canal 2, avenue de l'Europe 31520 Ramonville Saint Agne - France
creator: Nicolas Decoster
date: 2000-05-11T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: marc wrote: > But another more funny 'feature' is this: > > IDL> print,'abc' > abc > IDL> print,"abc" > abc > IDL> print,'777' > 777 > IDL> print,"777" > > print,"777" > ^ > % Syntax error. > > Cheers, > :-) marc It's a real feature IDL> print,"777 511 (check the online help for 'octal') -- Benno Puetz Kernspintomographie Max-Planck-Institut f. Psychiatrie Tel.: +49-89-30622-413 Kraepelinstr. 10 Fax : +49-89-30622-520 80804 Muenchen, Germany
creator: Benno Puetz
date: 2000-05-11T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: David Fanning wrote: > > Luca Fini (lfini@arcetri.astro.it) writes: > >> IDL is clearly a language grown by piling up things with no previous >> design. Its syntax is crazy and some characteristics are very annoying. > > Some of us find in IDL the same subtle intelligence > that pervades the Universe. If it seems crazy to us, > it is because we haven't evolved our consciousness > enough to perceive the underlying plan. > I agree, but the universe perhaps has to be this way, while a programming language *could* be for sure more clearly structured that IDL. Even this array stuff Nicolas complains about isn't a bug but a feature (i.e. the syntax of IDL) like Alex pointed out. But another more funny 'feature' is this: IDL> print,'abc' abc IDL> print,"abc" abc IDL> print,'777' 777 IDL> print,"777" print,"777" ^ % Syntax error. Cheers, :-) marc
creator: marc schellens[1]
date: 2000-05-11T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: I wrote the other day: > Some of us find in IDL the same subtle intelligence > that pervades the Universe. If it seems crazy to us, > it is because we haven't evolved our consciousness > enough to perceive the underlying plan. And I can't believe the number of unsolicited e-mails I got from the skeptics. You guys need to do a little reading to open your minds. Here is a good web page to get you in the proper mood for understanding the journey... http://www.thegreatillusion.com/ Cheers, David P.S. Speaking of strange features, I ran into a little one that set me back for a couple of minutes in an IDL course I was teaching last week. I was trying something new (normally my spontaneous flights of fancy are well rehearsed, but this one wasn't, although I really didn't expect any problems with it), which was my first mistake. I decided to write a widget program where we could click on an image and print the image value back in a CW_Field widget. (Normally, I disdain CW_Field widgets because the text field doesn't look editable on PC platforms, but this time that was exactly the effect I was going for.) In any case, when we tried to put the image value into the CW_Field widget: Widget_Control, info.fieldID, Set_Value=imageValue nothing would show up on the display! (No, I didn't have the Modal keyword set, Dave.) This was very strange. I've only written programs like this about a million times, and the value *always* shows up where it is suppose to. What in the world? Bug in IDL 5.3.1? Corrupted installation? Coyote out of his teepee and loose in Milwaukee? No, it turned out that the image value was an integer value (which is what we had told CW_Field to expect), but somehow in doing the conversion from integer to string to get the value in the the text widget, the integer was getting converted to blank characters. I haven't had time to investigate the details of this. (And after I thought about it I understood why it might happen with bytes, but I still don't know why it…
creator: davidf
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Nicolas Decoster (Nicolas.Decoster@Noveltis.fr) writes: > Just to be sure you understood my suggestion: the tip I'm talking about > is the entrepenarial one, not the array-subscript one. But, of course, I > guess this tip can't appear on a site which is part of the... marketing. Well, there is marketing, and then there is marketing. Let's just say we all have to make a living somehow. :-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: davidf
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: David Fanning wrote: > > Nicolas Decoster (Nicolas.Decoster@Noveltis.fr) writes: > >> Well, in fact I am in consulting business. And I was before I had to >> meet IDL. IDL come to me as a tool to do my consulting business. I guess >> the people I work for do not mind I know well the quote-double >> quote-octal thing of IDL. They do not ever mind I use IDL or not. They >> want me to correctly analyse and treat their data. It is my business to >> do it not too slowly. But you are right, perhaps I can convince them IDL >> _is_ the ultimate tool to treat their data, and they absolutly need idl >> scripts and applications to handle their data efficiently at home and to >> exploit my results, and IDL is very powerful but require quite complex >> programming but I know the holy words (i.e. the "quote-double quote" >> thing) to built such complex-bu-powerful-applications... hum... Then ? >> $$$ Kling ! $$$ Money !!! >> >> Yeaaah ! > > Now you've got the idea. It's all a matter of marketing. :-) > >> Thanks for the tip, David. I suggest you replace the tip of the year on >> your site by this one. :-) > > Yeah, I have been looking for something new. I haven't been > asked a color question in ages. I'm writing the color section > for the 2nd Edition of the book now, but maybe I should do us > all a favor and just delete this section and save room > for more array subscribing features. :-) Just to be sure you understood my suggestion: the tip I'm talking about is the entrepenarial one, not the array-subscript one. But, of course, I guess this tip can't appear on a site which is part of the... marketing. Later. Nicolas. -- Tï¿½l. : 00 (33) 5 62 88 11 16 Fax : 00 (33) 5 62 88 11 12 Nicolas.Decoster@Noveltis.fr Noveltis Parc Technologique du Canal 2, avenue de l'Europe 31520 Ramonville Saint Agne - France
creator: Nicolas Decoster
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Ah, yes. Which is why progammers get Christmas and Halloween mixed up since oct31=dec25 (Christmas falls on December 25th and Halloween on October 31) Dave. In article <391A76A6.8C74B2B0@mpipsykl.mpg.de>, Benno Puetz <puetz@mpipsykl.mpg.de> writes: > marc wrote: > >> But another more funny 'feature' is this: >> >> IDL> print,'abc' >> abc >> IDL> print,"abc" >> abc >> IDL> print,'777' >> 777 >> IDL> print,"777" >> >> print,"777" >> ^ >> % Syntax error. >> >> Cheers, >> :-) marc > > It's a real feature > > IDL> print,"777 > 511 > > (check the online help for 'octal') > > -- > Benno Puetz > Kernspintomographie > Max-Planck-Institut f. Psychiatrie Tel.: +49-89-30622-413 > Kraepelinstr. 10 Fax : +49-89-30622-520 > 80804 Muenchen, Germany > > >
creator: dmarshall
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Nicolas Decoster (Nicolas.Decoster@Noveltis.fr) writes: > Well, in fact I am in consulting business. And I was before I had to > meet IDL. IDL come to me as a tool to do my consulting business. I guess > the people I work for do not mind I know well the quote-double > quote-octal thing of IDL. They do not ever mind I use IDL or not. They > want me to correctly analyse and treat their data. It is my business to > do it not too slowly. But you are right, perhaps I can convince them IDL > _is_ the ultimate tool to treat their data, and they absolutly need idl > scripts and applications to handle their data efficiently at home and to > exploit my results, and IDL is very powerful but require quite complex > programming but I know the holy words (i.e. the "quote-double quote" > thing) to built such complex-bu-powerful-applications... hum... Then ? > $$$ Kling ! $$$ Money !!! > > Yeaaah ! Now you've got the idea. It's all a matter of marketing. :-) > Thanks for the tip, David. I suggest you replace the tip of the year on > your site by this one. :-) Yeah, I have been looking for something new. I haven't been asked a color question in ages. I'm writing the color section for the 2nd Edition of the book now, but maybe I should do us all a favor and just delete this section and save room for more array subscribing features. :-) Cheers, David -- David Fanning, Ph.D. Fanning Software Consulting Phone: 970-221-0438 E-Mail: davidf@dfanning.com Coyote's Guide to IDL Programming: http://www.dfanning.com/ Toll-Free IDL Book Orders: 1-888-461-0155
creator: davidf
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: David Fanning wrote: > > Nicolas Decoster (Nicolas.Decoster@Noveltis.fr) writes: > >> It seems that IDL likes the one-notation-two-actions thing. I must say >> that such a thing is confusing me. I hope I will not loose too much time >> in trying to understand all the IDL's "strange feature". > > You are focused on the wrong thing. Instead of > worrying about "losing too much time", you should > see this as an opportunity to learn something no one > else is going to be able to figure out, thereby making > it possible for you to charge big bucks for your > specialized knowledge. :-) > > Cheers, > > David > > P.S. Let's just say IDL makes it real easy for someone > to get into the consulting business if they have that > entrepreneurial state of mind. > Well, in fact I am in consulting business. And I was before I had to meet IDL. IDL come to me as a tool to do my consulting business. I guess the people I work for do not mind I know well the quote-double quote-octal thing of IDL. They do not ever mind I use IDL or not. They want me to correctly analyse and treat their data. It is my business to do it not too slowly. But you are right, perhaps I can convince them IDL _is_ the ultimate tool to treat their data, and they absolutly need idl scripts and applications to handle their data efficiently at home and to exploit my results, and IDL is very powerful but require quite complex programming but I know the holy words (i.e. the "quote-double quote" thing) to built such complex-bu-powerful-applications... hum... Then ? $$$ Kling ! $$$ Money !!! Yeaaah ! Thanks for the tip, David. I suggest you replace the tip of the year on your site by this one. :-) Cheers, Nicolas. -- Tï¿½l. : 00 (33) 5 62 88 11 16 Fax : 00 (33) 5 62 88 11 12 Nicolas.Decoster@Noveltis.fr Noveltis Parc Technologique du Canal 2, avenue de l'Europe 31520 Ramonville Saint Agne - France
creator: Nicolas Decoster
date: 2000-05-12T07:00:00-00:00

Re: Arrays: strange feature ?!
type: item
description: Benno Puetz wrote: > > marc wrote: > >> But another more funny 'feature' is this: >> >> IDL> print,'abc' >> abc >> IDL> print,"abc" >> abc >> IDL> print,'777' >> 777 >> IDL> print,"777" >> >> print,"777" >> ^ >> % Syntax error. >> >> Cheers, >> :-) marc > > It's a real feature > > IDL> print,"777 > 511 > > (check the online help for 'octal') I know, I know... nevertheless found it funny one more thing: IDL> print,'70 70 IDL> print,"70 56 (strings don't need trailing delimiters) :-) marc
creator: marc schellens[1]
date: 2000-05-12T07:00:00-00:00