|
Re: strange behaviour of bar_plot [message #53180 is a reply to message #53143] |
Fri, 23 March 2007 07:57  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
paulartcoelho@gmail.com writes:
> Anyway i left the !EXCEPT=2 command in
> the beginning of my code, "just in case"... for the further
> procedures. :)
This is probably not such a great idea, unless you intend
to get a Ph.D. in writing esoteric code to check for floating
underflow problems:
http://www.dfanning.com/math_tips/underflow.html
This is a *global* variable, which means it will affect
ALL of your programs. I'd set it back to the default and
leave it there unless you need it specifically. :-)
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.")
|
|
|
Re: strange behaviour of bar_plot [message #53182 is a reply to message #53180] |
Fri, 23 March 2007 03:29  |
paulartcoelho
Messages: 30 Registered: March 2007
|
Member |
|
|
Thank you David.
Now it's running smoothly, with the colors array properly defined I
don't see the warning anymore. Anyway i left the !EXCEPT=2 command in
the beginning of my code, "just in case"... for the further
procedures. :)
Cheers
Paula
|
|
|
Re: strange behaviour of bar_plot [message #53183 is a reply to message #53182] |
Thu, 22 March 2007 09:09  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
paulartcoelho@gmail.com writes:
> first time posting. i'm running IDL on Linux and i have a strange
> behavior of bar_plot procedure. first time in a session it runs ok.
> second time, colours are changed (i don't set any colour in
> particular)
If you don't set any colors in particular, then you
can't be surprised when they change. :-)
Inside your program try loading some colors and using
those color indices as your colors. There are various
ways to do this (see the COLOR TIPS section in the IDL Tips
section of my web page for lots of examples), but
suppose you want 15 colors (you are drawing 15 bars).
You might do something like this:
LOADCT, 33, NCOLORS=15, BOTTOM=1
colorIndices = Indgen(15)+1
Then, when you call your BAR_PLOT:
BAR_PLOT, data, Colors=colorIndices
> and although the graph is plotted i end up with a message
> '% Program caused arithmetic error: Floating illegal operand'. Only
> restarting IDL make it back to normal behavior (.reset isn't enough).
This is typically a warning and may or may not be something to
worry about. You should find out. Set !EXCEPT=2 and run your
program again. This time it will stop with an error. Read the
error message to find out what line in your program is causing
the error and do the usual debugging thing to find out what in
the world is going on there!? Likely suspects are a value that
is getting very near zero, a value that *is* zero, etc. A couple
of PRINT statements might help. Usually you are making some assumptions
about your data that simply aren't true. This is a good time--
well before the presentation to your boss--to learn about that, too.
> i'd like to mention that i'm an IDL beginner as well.
That's alright. We are *all* beginners here. :-)
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.")
|
|
|