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

Home » Public Forums » archive » Re: Strange WHERE issue?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Strange WHERE issue? [message #76290 is a reply to message #76289] Thu, 26 May 2011 19:01 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
polystethylene writes:

>
> Wonder if anybody can help me with this...
>
> Essentially I'm just varying a parameter (1st column) and testing chi
> squared (2nd column), and I want to find chi squared minimum + 1 in
> order find my 1 sigma error bars...
>
> I have the following code:
>
> c = WHERE(chisqarr_ph[1,*] EQ MIN(chisqarr_ph[1,*]))
>
>
> d = WHERE(chisqarr_ph[1,*] LE (chisqarr_ph[1,c]+1))
>
>
>
> I have a problem with the line d = WHERE(chisqarr_ph[1,*] LE
> (chisqarr_ph[1,c]+1)), which returns -1.

This is one of the classic Where gotchas:

http://www.idlcoyote.com/misc_tips/noidea.html

You are only comparing the *first* value in your
array, because the value on the right of the Boolean
expression is a vector of one element.

And, you should be VERY careful using these WHERE
expressions with floating values. You will not get
the results you expect at least some of the time.
See, for example, this article:

http://www.idlcoyote.com/math_tips/razoredge.html

You might want to have a look at the program Floats_Equal
in the Coyote Library:

http://www.idlcoyote.com/programs/floats_equal.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Question about cgplot output to file
Next Topic: Automatic Binsize Calculations

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

Current Time: Fri Oct 10 06:01:49 PDT 2025

Total time taken to generate the page: 0.55968 seconds