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

Home » Public Forums » archive » Generalisation of the use of lists in the IDL language
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Generalisation of the use of lists in the IDL language [message #88602] Fri, 16 May 2014 08:09 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Folks,

I really appreciate the recent efforts from IDL to become more modern
(should I say "python-like"?) which made programming and data-exploring
much more fun. Lists, ordered-hashes and dictionaries (which made hashes
obsolete from my point of view) have replaced arrays, pointers and
structures in much of my recent code.

However, in addition to the performance problems raised by Tom
Grydeland, I also noticed that while my Input&Analysis workflow was made
more "elegant" thanks to the new features, it became a bit more tedious
when I arrived to the "output" (i.e. plotting or writing). Unlike NumPy,
where "everything is a list", IDL built-in routines still require arrays
as parameters.

I'll make an example:

IDL> data = list(indgen(10), /EXTRACT)
IDL> print, data[2:4] ; behaves like an array (almost)
2
3
4
IDL> data[2:4] = data[4:6] ; also like an array
IDL> data[2:4] = data[2:4]^2 ; this won't work
% Unable to convert variable to type object reference.
% Execution halted at: $MAIN$

IDL> p = plot(data[2:4]) ; this won't work either
% PLOT: REFORM: New subscripts must not change the number elements in
<OBJREF Array[1]>.
% Execution halted at: $MAIN$

IDL> p = plot(data[2:4]->toArray()) ; the ->toArray() is necessary

Mathematical operations on lists are not possible. I guess this wont
change because the "+" operator is already overloaded and "adds" the
elements to the list.

However, I was wondering if it would be theoretically possible that the
built-in routines like mean(), plot() etc. also accept lists as
arguments. I guess that the syntax would allow it, but at what costs?

I've already programmed several wrappers for IDL routines which made my
life easier (e.g. wrappers for read_csv and write_csv now accepting
dictionaries) and I know that others did (histogram returning lists from
Paulo: http://www.ppenteado.net/idl/histogram_pp-code.html )

Any thoughts about this, or is asking for more integration of lists an
impossible idea?

Fabien
[Message index]
 
Read Message
Read Message
Previous Topic: Re: IDL help in alternate browser
Next Topic: Another version of "The sky is falling" problem ??

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

Current Time: Wed Oct 08 19:14:08 PDT 2025

Total time taken to generate the page: 0.00535 seconds