Google Groups Home
Help | Sign in
Most Common IDL Programming Errors
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 50 - Collapse all   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
David Fanning  
View profile
 More options Apr 8, 8:13 pm
Newsgroups: comp.lang.idl-pvwave
From: David Fanning <n...@dfanning.com>
Date: Tue, 8 Apr 2008 18:13:17 -0600
Local: Tues, Apr 8 2008 8:13 pm
Subject: Most Common IDL Programming Errors
Folks,

I realize you don't much like to play games (I'm thinking
back to the "Yo mama's so ..." thread), but you have no
idea how hard it is to come up with new topics for my IDL
Tips page every week. (Especially so because I try to
understand what I write and make available, which
pretty much rules out 4/5 of what I read on this newsgroup.)

Anyway, I was sitting here wondering why we don't have any
beer in the house again, and it occurred to me that I should
have a page listing the 10 or 15 most common IDL programming
errors with their solutions. But I can only think of three.

Here are the three errors I most commonly see in IDL programs.

1. IDL programs are named incorrectly. The last program
   module in the file should have the same name as the file.
   Utility modules in the file should start with the name
   of the "command" (or last) module to make clear their
   purpose.

2. KEYWORD_SET is used to check whether a keyword is
   "used" or "defined". This function should only be
   used with binary keywords. (I plan to avoid all
   nuance with this list, and just go with black and
   white pronouncements.)

3. People draw graphics willy-nilly in widget programs
   without having the faintest idea which window their
   graphics might show up in.

What would be on your list? Of course, typos are assumed. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vince Hradil  
View profile
 More options Apr 8, 8:27 pm
Newsgroups: comp.lang.idl-pvwave
From: Vince Hradil <hrad...@yahoo.com>
Date: Tue, 8 Apr 2008 17:27:28 -0700 (PDT)
Local: Tues, Apr 8 2008 8:27 pm
Subject: Re: Most Common IDL Programming Errors
On Apr 8, 7:13 pm, David Fanning <n...@dfanning.com> wrote:

How about:
-indexing for-loops with (short) integers.
-using indeces from where without checking count > 0

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Galloy  
View profile
 More options Apr 8, 8:35 pm
Newsgroups: comp.lang.idl-pvwave
From: Michael Galloy <mgal...@gmail.com>
Date: Tue, 08 Apr 2008 18:35:53 -0600
Local: Tues, Apr 8 2008 8:35 pm
Subject: Re: Most Common IDL Programming Errors

Here are a few (in no particular order, despite the numbers):

1. Thinking you are using a color table in direct graphics, but are
actually using decomposed color (shades of red problem).

2. Not setting up color in PS output correctly.

3. Confusion with direct graphics output in landscape mode in PS.

4. Not scaling object graphics into a coordinate system correctly.

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vince Hradil  
View profile
 More options Apr 8, 8:40 pm
Newsgroups: comp.lang.idl-pvwave
From: Vince Hradil <hrad...@yahoo.com>
Date: Tue, 8 Apr 2008 17:40:01 -0700 (PDT)
Local: Tues, Apr 8 2008 8:40 pm
Subject: Re: Most Common IDL Programming Errors
On Apr 8, 7:27 pm, Vince Hradil <hrad...@yahoo.com> wrote:

-not setting /data in call to xyouts

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Mason  
View profile
 More options Apr 8, 9:31 pm
Newsgroups: comp.lang.idl-pvwave
From: "Peter Mason" <peter.ma...@deleteme.csiro.au>
Date: Wed, 09 Apr 2008 01:31:05 GMT
Local: Tues, Apr 8 2008 9:31 pm
Subject: Re: Most Common IDL Programming Errors
David Fanning wrote:

<...>
Anyway, I was sitting here wondering why we don't have any
beer in the house again, and it occurred to me that I should
have a page listing the 10 or 15 most common IDL programming
errors with their solutions. But I can only think of three.
<...>

Some others...

Forgetting about a "catch" statement that lies buried somewhere, hiding
other bugs or making a total mystery of execution problems.

Forgetting to use "reform" - stumbling on an unwanted array dimension of 1
that's left after pulling out an array subset.   (Actually I don't know if
this one's still there.   I'm a bit behind the times maybe.)

Getting "rows" mixed up with "columns" (whatever they are) when using IDL
calls that involve matrices.

Cheers
Peter


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Cool  
View profile
 More options Apr 8, 10:06 pm
Newsgroups: comp.lang.idl-pvwave
From: Andrew Cool <andrew.c...@dsto.defence.gov.au>
Date: Tue, 8 Apr 2008 19:06:32 -0700 (PDT)
Local: Tues, Apr 8 2008 10:06 pm
Subject: Re: Most Common IDL Programming Errors
On Apr 9, 9:13 am, David Fanning <n...@dfanning.com> wrote:

1. Indexing FOR loops with a float
2. Reading undefined variables from a file.
3. Lack of comments in some other cretin's legacy code.

Andrew


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Fanning  
View profile
 More options Apr 8, 10:27 pm
Newsgroups: comp.lang.idl-pvwave
From: David Fanning <n...@dfanning.com>
Date: Tue, 8 Apr 2008 20:27:18 -0600
Local: Tues, Apr 8 2008 10:27 pm
Subject: Re: Most Common IDL Programming Errors

Andrew Cool writes:
> 1. Indexing FOR loops with a float

I think you missed the word "common", Andrew. :-)

I don't even know what this problem is. Can you elaborate?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Fanning  
View profile
 More options Apr 8, 10:27 pm
Newsgroups: comp.lang.idl-pvwave
From: David Fanning <n...@dfanning.com>
Date: Tue, 8 Apr 2008 20:27:18 -0600
Local: Tues, Apr 8 2008 10:27 pm
Subject: Re: Most Common IDL Programming Errors

Peter Mason writes:
> Getting "rows" mixed up with "columns" (whatever they are) when using IDL
> calls that involve matrices.

Oh, my gosh! I've been working on an EOF (Empirical
Orthogonal Functions) problem the past 3-4 days, and
I'll bet I spent half my time trying to wrap my mind
around this! "OK, does the LA_SVD routine think like
IDL or like matrix algebra? When it says the first
mode EOF is in the column of the output is that in
a linear algebra sense or an IDL sense?" One more day
of it and I'll be ready to buy Matlab. (Heck, all the
examples are in Matlab code.)

Even now, when I am *sure* I know what I'm doing,
I have momentary doubts. Why don't you write us
a primer, Peter? :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Spon  
View profile
 More options Apr 9, 3:06 am
Newsgroups: comp.lang.idl-pvwave
From: Spon <christoph.b...@gmail.com>
Date: Wed, 9 Apr 2008 00:06:38 -0700 (PDT)
Local: Wed, Apr 9 2008 3:06 am
Subject: Re: Most Common IDL Programming Errors
On Apr 9, 3:27 am, David Fanning <n...@dfanning.com> wrote:

Judging by the fact that we've got 11 IDL licences in the building,
probably 5-15 users in any given week (including at least one *Real*
computer scientist - with a PhD and everything) and I'm the only one
who ever seems to use REBIN, REFORM, REVERSE... even READ_BINARY
instead of OPENR / FSTAT / READU, I'd say some more major errors are:

- Not knowing where to find the useful built-in functions in the sea
of helpfiles
- Coding up your own function when there's a perfectly useful inbuilt
command that'll do what you want, and can even do it without three
nested FOR loops ;-)
- Writing code that solves one specific problem (particularly using
integers that don't change for this dataset but may well do so for the
next one, rendering the function useless without major re-working,
when a simple call to SIZE would have made it SOOO much more flexible)

So in short, I'd love to see an article entitled something like: "I've
only got time to read a dozen helpfiles - which ones should I read?"
This could contain the names of the commands and a brief one-line
summary of what each one does. Of course, deciding which helpfiles to
pick is liable to cause some, uh... heated debate ;-)

FWIW, I'd definitely throw in: SIZE, REFORM, REBIN, TRANSPOSE, WHERE,
BYTSCL ... and then maybe ARRAY_INDICES; also TV, PLOT, OPLOT & TVSCL
to show the wealth of keywords they accept.

I realise that I'm coming at this from a biophysics-lab-in-academia
angle, which may be completely different to other people.

Regards,
Chris


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maarten  
View profile
 More options Apr 9, 4:01 am
Newsgroups: comp.lang.idl-pvwave
From: Maarten <maarten.sn...@knmi.nl>
Date: Wed, 9 Apr 2008 01:01:20 -0700 (PDT)
Local: Wed, Apr 9 2008 4:01 am
Subject: Re: Most Common IDL Programming Errors
On Apr 9, 12:13 am, David Fanning <n...@dfanning.com> wrote:

> Here are the three errors I most commonly see in IDL programs.

[snip]

> What would be on your list? Of course, typos are assumed. :-)

How about any code that does not use
    compile_opt defint32, strictarr, strictarrsubs
Yes, the first two can be combined with idl2, which gives you an idea
how long overdue it is to make this the default. I prefer this way,
because it does give you some idea of what changes. You can put this
in your startup script, and avoid an awful amount of surprises.

The other errors I observe in IDL code are mostly part of the syntax
itself :p

Maarten


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kenneth P. Bowman  
View profile
 More options Apr 8, 10:48 pm
Newsgroups: comp.lang.idl-pvwave
From: "Kenneth P. Bowman" <k-bow...@null.edu>
Date: Tue, 08 Apr 2008 21:48:44 -0500
Local: Tues, Apr 8 2008 10:48 pm
Subject: Re: Most Common IDL Programming Errors
In article <MPG.2265d7059ac3a84198a...@news.frii.com>,
 David Fanning <n...@dfanning.com> wrote:

David, I have some EOF code that is only a few lines long if you want it
(using LA_EIGENQL).

Ken


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.