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

Home » Public Forums » archive » Re: operator fails?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: operator fails? [message #72598] Thu, 23 September 2010 06:51
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> Thank you. Sigh...

You will be grateful that it only bites you three times
before you learn to step around it. :-)

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: operator fails? [message #72599 is a reply to message #72598] Thu, 23 September 2010 06:41 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Sep 23, 9:28 am, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Sep 23, 10:20 am, Gray <grayliketheco...@gmail.com> wrote:
>
>
>
>
>
>> On Sep 22, 8:13 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>>> On Sep 22, 4:59 pm, David Fanning <n...@dfanning.com> wrote:
>
>>>> Gray writes:
>>>> > Can anyone explain this?
>
>>>> > IDL> nsrc = n_elements(srcy)
>>>> > IDL> s = size(img,/dim)
>>>> > IDL> bs = rebin([-10,10],2,nsrc,/sample)
>>>> > IDL> yb = 0. > rebin(transpose(srcy),2,nsrc,/sample)+bs < s[1]-1
>>>> > IDL> print, n_elements(where(yb lt 0))
>>>> >            5
>
>>>> > How does yb ever become less than 0?  Isn't the > operator in this
>>>> > usage supposed to prevent this??  Thanks.
>
>>>> This is one of the classic gotchas. You are going
>>>> to need some parentheses in that long line. Do you
>>>> see it? :-)
>
>>>> 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.")
>
>>> Oh.  Oh, oh, oh.  Grrrrrr..... >:O
>
>> IDL> yb = 0 > (rebin(transpose(srcy),2,nsrc,/sample)+bs) < s[1]-1
>> IDL> print, where(yb[0,*] le 0)
>>            6           7          18          23          29
>
>> Even with the parentheses it still doesn't work.
>
> Did you not want it to be
>
> yb = 0 > (rebin(transpose(srcy),2,nsrc,/sample)+bs) < (s[1]-1)
>
> ?

Thank you. Sigh...
Re: operator fails? [message #72600 is a reply to message #72599] Thu, 23 September 2010 06:28 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Sep 23, 10:20 am, Gray <grayliketheco...@gmail.com> wrote:
> On Sep 22, 8:13 pm, Gray <grayliketheco...@gmail.com> wrote:
>
>
>
>
>
>> On Sep 22, 4:59 pm, David Fanning <n...@dfanning.com> wrote:
>
>>> Gray writes:
>>>> Can anyone explain this?
>
>>>> IDL> nsrc = n_elements(srcy)
>>>> IDL> s = size(img,/dim)
>>>> IDL> bs = rebin([-10,10],2,nsrc,/sample)
>>>> IDL> yb = 0. > rebin(transpose(srcy),2,nsrc,/sample)+bs < s[1]-1
>>>> IDL> print, n_elements(where(yb lt 0))
>>>>            5
>
>>>> How does yb ever become less than 0?  Isn't the > operator in this
>>>> usage supposed to prevent this??  Thanks.
>
>>> This is one of the classic gotchas. You are going
>>> to need some parentheses in that long line. Do you
>>> see it? :-)
>
>>> 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.")
>
>> Oh.  Oh, oh, oh.  Grrrrrr..... >:O
>
> IDL> yb = 0 > (rebin(transpose(srcy),2,nsrc,/sample)+bs) < s[1]-1
> IDL> print, where(yb[0,*] le 0)
>            6           7          18          23          29
>
> Even with the parentheses it still doesn't work.

Did you not want it to be

yb = 0 > (rebin(transpose(srcy),2,nsrc,/sample)+bs) < (s[1]-1)

?
Re: operator fails? [message #72601 is a reply to message #72600] Thu, 23 September 2010 06:20 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Sep 22, 8:13 pm, Gray <grayliketheco...@gmail.com> wrote:
> On Sep 22, 4:59 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>
>
>> Gray writes:
>>> Can anyone explain this?
>
>>> IDL> nsrc = n_elements(srcy)
>>> IDL> s = size(img,/dim)
>>> IDL> bs = rebin([-10,10],2,nsrc,/sample)
>>> IDL> yb = 0. > rebin(transpose(srcy),2,nsrc,/sample)+bs < s[1]-1
>>> IDL> print, n_elements(where(yb lt 0))
>>>            5
>
>>> How does yb ever become less than 0?  Isn't the > operator in this
>>> usage supposed to prevent this??  Thanks.
>
>> This is one of the classic gotchas. You are going
>> to need some parentheses in that long line. Do you
>> see it? :-)
>
>> 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.")
>
> Oh.  Oh, oh, oh.  Grrrrrr..... >:O

IDL> yb = 0 > (rebin(transpose(srcy),2,nsrc,/sample)+bs) < s[1]-1
IDL> print, where(yb[0,*] le 0)
6 7 18 23 29

Even with the parentheses it still doesn't work.
Re: operator fails? [message #72608 is a reply to message #72601] Wed, 22 September 2010 17:13 Go to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Sep 22, 4:59 pm, David Fanning <n...@dfanning.com> wrote:
> Gray writes:
>> Can anyone explain this?
>
>> IDL> nsrc = n_elements(srcy)
>> IDL> s = size(img,/dim)
>> IDL> bs = rebin([-10,10],2,nsrc,/sample)
>> IDL> yb = 0. > rebin(transpose(srcy),2,nsrc,/sample)+bs < s[1]-1
>> IDL> print, n_elements(where(yb lt 0))
>>            5
>
>> How does yb ever become less than 0?  Isn't the > operator in this
>> usage supposed to prevent this??  Thanks.
>
> This is one of the classic gotchas. You are going
> to need some parentheses in that long line. Do you
> see it? :-)
>
> 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.")

Oh. Oh, oh, oh. Grrrrrr..... >:O
Re: operator fails? [message #72614 is a reply to message #72608] Wed, 22 September 2010 13:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gray writes:

> Can anyone explain this?
>
> IDL> nsrc = n_elements(srcy)
> IDL> s = size(img,/dim)
> IDL> bs = rebin([-10,10],2,nsrc,/sample)
> IDL> yb = 0. > rebin(transpose(srcy),2,nsrc,/sample)+bs < s[1]-1
> IDL> print, n_elements(where(yb lt 0))
> 5
>
> How does yb ever become less than 0? Isn't the > operator in this
> usage supposed to prevent this?? Thanks.

This is one of the classic gotchas. You are going
to need some parentheses in that long line. Do you
see it? :-)

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: isotropic keyword for surface?
Next Topic: NG Colorbar scaling

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

Current Time: Wed Oct 08 19:39:13 PDT 2025

Total time taken to generate the page: 0.00723 seconds