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

Home » Public Forums » archive » more bugs in envi !!!
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
more bugs in envi !!! [message #35725] Fri, 11 July 2003 05:41 Go to next message
gauravjn123 is currently offline  gauravjn123
Messages: 7
Registered: July 2003
Junior Member
Hi folks!
Sorry to trouble u again....but envi seems to be just going above my
head...there is another problem that i am facing:
Please go through the 2 functions:

1.function example,b1
help,b1
end
2.function example,b1,b2
help,b1
end

Now could anyone tell me why these 2 codes are producing different
final answers??? I just cant find any reason for it.

One more problem :

'b1' is a positive array and 'avgb1' is a positive number but when i
use the formula : result=b1*100/avgb1
print, result
, the answer that i get is a negative array.

Whereas if i use the formula : result=b1/avgb1
print, result * 100
, then i get a positive array


I hope to hear the answers to these questions soon. Thnxx
Byee
Gaurav
Re: more bugs in envi !!! [message #35796 is a reply to message #35725] Tue, 15 July 2003 17:17 Go to previous messageGo to next message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
Could you post the COMPLETE stuff?
I mean the calling procedure or function?
Try to delete everything which is irrelevant.
I hardly assume, that the mistake lies somewhere there.
Maybe another subroutine changes some of its arguments?
Regards,
marc

Gaurav wrote:
> Hi!
> Okay...i shall give u the outputs also. Here are the functions:
>
> 1.;Stored in file trash.pro
> function ex,b1
> print,' This is the function ex,b1'
> print,size(b1)
> help,b1
> end
> 2.;Stored in file trash2.pro
> function ex2,b1,b2
> print,'This is the function ex2,b1,b2'
> print,size(b1)
> help,b1
> end
> The outputs of these functions are :
>
> ENVI>
> % Compiled module: TRASH.
>
> ENVI>
> % Compiled module: TRASH2.
>
> ENVI>
> This is the function ex,b1
> 2 5 5 4
> 25
> B1 FLOAT = Array[5, 5]
> This is the function ex,b1
> 2 5 5 4
> 25
> B1 FLOAT = Array[5, 5]
> This is the function ex,b1
> 2 5 5 2
> 25
> B1 INT = Array[5, 5]
> This is the function ex,b1
> 2 568 653 2
> 370904
> B1 INT = Array[568, 653]
>
> ENVI>
> This is the function ex2,b1,b2
> 2 5 5 4
> 25
> B1 FLOAT = Array[5, 5]
> This is the function ex2,b1,b2
> 2 5 5 4
> 25
> B1 FLOAT = Array[5, 5]
> This is the function ex2,b1,b2
> 2 5 5 2
> 25
> B1 INT = Array[5, 5]
> This is the function ex2,b1,b2
> 2 568 326 2
> 185168
> B1 INT = Array[568, 326]
> This is the function ex2,b1,b2
> 2 568 327 2
> 185736
> B1 INT = Array[568, 327]
>
> ENVI>
>
> Hope this helps you in finding out the answer to my question.
>
> Gaurav Jain
>
>
>
> Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F12DAB7.607@hotmail.com>...
>
>> Would be helpful if you post WHAT they output also.
>> And then of course the context from which you call them...
>> (Two functions with the same name cannot live in one (IDL-) program)
>>
>> Gaurav wrote:
>>
>>> Hi all!
>>> Thanx for the help...well u both were right...i was under the wrong
>>> impression that i had defined it as a long integer...but i hadn't. But
>>> i still cant find out why these 2 functions are producing different
>>> outputs :
>>> Please go through the 2 functions:
>>>
>>>
>>>> >1.function example,b1
>>>> > help,b1
>>>> > end
>>>> >2.function example,b1,b2
>>>> > help,b1
>>>> > end
>>>> >
>>>> > Now could anyone tell me why these 2 codes are producing different
>>>> >final answers??? I just cant find any reason for it.
>>>>
>>>
>>> Gaurav Jain
>>> ENST-Bretagne
>>>
>>>
>>> Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F115ED4.6040200@hotmail.com>...
>>>
>>>
>>>> >Hi folks!
>>>> > Sorry to trouble u again....but envi seems to be just going above my
>>>> >head...there is another problem that i am facing:
>>>> >Please go through the 2 functions:
>>>> >
>>>> >1.function example,b1
>>>> > help,b1
>>>> > end
>>>> >2.function example,b1,b2
>>>> > help,b1
>>>> > end
>>>> >
>>>> > Now could anyone tell me why these 2 codes are producing different
>>>> >final answers??? I just cant find any reason for it.
>>>> >
>>>> >One more problem :
>>>> >
>>>> >'b1' is a positive array and 'avgb1' is a positive number but when i
>>>> >use the formula : result=b1*100/avgb1
>>>> > print, result
>>>> >, the answer that i get is a negative array.
>>>> >
>>>> > Whereas if i use the formula : result=b1/avgb1
>>>> > print, result * 100
>>>> >, then i get a positive array
>>>> >
>>>>
>>>> Even without knowing ENVI, the second problem isn't a bug in ENVI.
>>>>
>>>> A integer occupies (in IDL) 16-bit, and therfore covers a range form
>>>> -32768 to
>>>> 32767
>>>>
>>>> anything larger (or smaller) cannot be represented and therefore you
>>>> observe an 'overflow', resulting in a negative number.
>>>> IDL evalutates your expressinon from left to right, the
>>>> overflow occurs after the multiplication with 100.
>>>> In the second case the division is done first and thus the value seems
>>>> to be small enough not to overflow in the later multiplication.
>>>>
>>>> The solution is to convert your b1 array to LONG.
>>>> But did you notice that you do an integer division?
>>>> 1/2 equals 0.
>>>> Maybe you want to use FLOAT or DOUBLE.
>>>>
>>>> hdh,
>>>> marc
>>>
Re: more bugs in envi !!! [message #35798 is a reply to message #35725] Wed, 16 July 2003 00:33 Go to previous messageGo to next message
gauravjn123 is currently offline  gauravjn123
Messages: 7
Registered: July 2003
Junior Member
Hi!
Okay...i shall give u the outputs also. Here are the functions:

1.;Stored in file trash.pro
function ex,b1
print,' This is the function ex,b1'
print,size(b1)
help,b1
end
2.;Stored in file trash2.pro
function ex2,b1,b2
print,'This is the function ex2,b1,b2'
print,size(b1)
help,b1
end
The outputs of these functions are :

ENVI>
% Compiled module: TRASH.

ENVI>
% Compiled module: TRASH2.

ENVI>
This is the function ex,b1
2 5 5 4
25
B1 FLOAT = Array[5, 5]
This is the function ex,b1
2 5 5 4
25
B1 FLOAT = Array[5, 5]
This is the function ex,b1
2 5 5 2
25
B1 INT = Array[5, 5]
This is the function ex,b1
2 568 653 2
370904
B1 INT = Array[568, 653]

ENVI>
This is the function ex2,b1,b2
2 5 5 4
25
B1 FLOAT = Array[5, 5]
This is the function ex2,b1,b2
2 5 5 4
25
B1 FLOAT = Array[5, 5]
This is the function ex2,b1,b2
2 5 5 2
25
B1 INT = Array[5, 5]
This is the function ex2,b1,b2
2 568 326 2
185168
B1 INT = Array[568, 326]
This is the function ex2,b1,b2
2 568 327 2
185736
B1 INT = Array[568, 327]

ENVI>

Hope this helps you in finding out the answer to my question.

Gaurav Jain



Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F12DAB7.607@hotmail.com>...
> Would be helpful if you post WHAT they output also.
> And then of course the context from which you call them...
> (Two functions with the same name cannot live in one (IDL-) program)
>
> Gaurav wrote:
>> Hi all!
>> Thanx for the help...well u both were right...i was under the wrong
>> impression that i had defined it as a long integer...but i hadn't. But
>> i still cant find out why these 2 functions are producing different
>> outputs :
>> Please go through the 2 functions:
>>
>>>> 1.function example,b1
>>>> help,b1
>>>> end
>>>> 2.function example,b1,b2
>>>> help,b1
>>>> end
>>>>
>>>> Now could anyone tell me why these 2 codes are producing different
>>>> final answers??? I just cant find any reason for it.
>>>
>>
>> Gaurav Jain
>> ENST-Bretagne
>>
>>
>> Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F115ED4.6040200@hotmail.com>...
>>
>>>> Hi folks!
>>>> Sorry to trouble u again....but envi seems to be just going above my
>>>> head...there is another problem that i am facing:
>>>> Please go through the 2 functions:
>>>>
>>>> 1.function example,b1
>>>> help,b1
>>>> end
>>>> 2.function example,b1,b2
>>>> help,b1
>>>> end
>>>>
>>>> Now could anyone tell me why these 2 codes are producing different
>>>> final answers??? I just cant find any reason for it.
>>>>
>>>> One more problem :
>>>>
>>>> 'b1' is a positive array and 'avgb1' is a positive number but when i
>>>> use the formula : result=b1*100/avgb1
>>>> print, result
>>>> , the answer that i get is a negative array.
>>>>
>>>> Whereas if i use the formula : result=b1/avgb1
>>>> print, result * 100
>>>> , then i get a positive array
>>>>
>>>
>>> Even without knowing ENVI, the second problem isn't a bug in ENVI.
>>>
>>> A integer occupies (in IDL) 16-bit, and therfore covers a range form
>>> -32768 to
>>> 32767
>>>
>>> anything larger (or smaller) cannot be represented and therefore you
>>> observe an 'overflow', resulting in a negative number.
>>> IDL evalutates your expressinon from left to right, the
>>> overflow occurs after the multiplication with 100.
>>> In the second case the division is done first and thus the value seems
>>> to be small enough not to overflow in the later multiplication.
>>>
>>> The solution is to convert your b1 array to LONG.
>>> But did you notice that you do an integer division?
>>> 1/2 equals 0.
>>> Maybe you want to use FLOAT or DOUBLE.
>>>
>>> hdh,
>>> marc
>>
Re: more bugs in envi !!! [message #35808 is a reply to message #35725] Mon, 14 July 2003 09:30 Go to previous messageGo to next message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
Would be helpful if you post WHAT they output also.
And then of course the context from which you call them...
(Two functions with the same name cannot live in one (IDL-) program)

Gaurav wrote:
> Hi all!
> Thanx for the help...well u both were right...i was under the wrong
> impression that i had defined it as a long integer...but i hadn't. But
> i still cant find out why these 2 functions are producing different
> outputs :
> Please go through the 2 functions:
>
>>> 1.function example,b1
>>> help,b1
>>> end
>>> 2.function example,b1,b2
>>> help,b1
>>> end
>>>
>>> Now could anyone tell me why these 2 codes are producing different
>>> final answers??? I just cant find any reason for it.
>>
>
> Gaurav Jain
> ENST-Bretagne
>
>
> Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F115ED4.6040200@hotmail.com>...
>
>>> Hi folks!
>>> Sorry to trouble u again....but envi seems to be just going above my
>>> head...there is another problem that i am facing:
>>> Please go through the 2 functions:
>>>
>>> 1.function example,b1
>>> help,b1
>>> end
>>> 2.function example,b1,b2
>>> help,b1
>>> end
>>>
>>> Now could anyone tell me why these 2 codes are producing different
>>> final answers??? I just cant find any reason for it.
>>>
>>> One more problem :
>>>
>>> 'b1' is a positive array and 'avgb1' is a positive number but when i
>>> use the formula : result=b1*100/avgb1
>>> print, result
>>> , the answer that i get is a negative array.
>>>
>>> Whereas if i use the formula : result=b1/avgb1
>>> print, result * 100
>>> , then i get a positive array
>>>
>>
>> Even without knowing ENVI, the second problem isn't a bug in ENVI.
>>
>> A integer occupies (in IDL) 16-bit, and therfore covers a range form
>> -32768 to
>> 32767
>>
>> anything larger (or smaller) cannot be represented and therefore you
>> observe an 'overflow', resulting in a negative number.
>> IDL evalutates your expressinon from left to right, the
>> overflow occurs after the multiplication with 100.
>> In the second case the division is done first and thus the value seems
>> to be small enough not to overflow in the later multiplication.
>>
>> The solution is to convert your b1 array to LONG.
>> But did you notice that you do an integer division?
>> 1/2 equals 0.
>> Maybe you want to use FLOAT or DOUBLE.
>>
>> hdh,
>> marc
>
Re: more bugs in envi !!! [message #35811 is a reply to message #35725] Mon, 14 July 2003 13:07 Go to previous messageGo to next message
gauravjn123 is currently offline  gauravjn123
Messages: 7
Registered: July 2003
Junior Member
Hi all!
Thanx for the help...well u both were right...i was under the wrong
impression that i had defined it as a long integer...but i hadn't. But
i still cant find out why these 2 functions are producing different
outputs :
Please go through the 2 functions:
>>
>> 1.function example,b1
>> help,b1
>> end
>> 2.function example,b1,b2
>> help,b1
>> end
>>
>> Now could anyone tell me why these 2 codes are producing different
>> final answers??? I just cant find any reason for it.

Gaurav Jain
ENST-Bretagne


Marc Schellens <m_schellens@hotmail.com> wrote in message news:<3F115ED4.6040200@hotmail.com>...
>> Hi folks!
>> Sorry to trouble u again....but envi seems to be just going above my
>> head...there is another problem that i am facing:
>> Please go through the 2 functions:
>>
>> 1.function example,b1
>> help,b1
>> end
>> 2.function example,b1,b2
>> help,b1
>> end
>>
>> Now could anyone tell me why these 2 codes are producing different
>> final answers??? I just cant find any reason for it.
>>
>> One more problem :
>>
>> 'b1' is a positive array and 'avgb1' is a positive number but when i
>> use the formula : result=b1*100/avgb1
>> print, result
>> , the answer that i get is a negative array.
>>
>> Whereas if i use the formula : result=b1/avgb1
>> print, result * 100
>> , then i get a positive array
>>
>
> Even without knowing ENVI, the second problem isn't a bug in ENVI.
>
> A integer occupies (in IDL) 16-bit, and therfore covers a range form
> -32768 to
> 32767
>
> anything larger (or smaller) cannot be represented and therefore you
> observe an 'overflow', resulting in a negative number.
> IDL evalutates your expressinon from left to right, the
> overflow occurs after the multiplication with 100.
> In the second case the division is done first and thus the value seems
> to be small enough not to overflow in the later multiplication.
>
> The solution is to convert your b1 array to LONG.
> But did you notice that you do an integer division?
> 1/2 equals 0.
> Maybe you want to use FLOAT or DOUBLE.
>
> hdh,
> marc
Re: more bugs in envi !!! [message #35817 is a reply to message #35725] Sun, 13 July 2003 06:29 Go to previous messageGo to next message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
> Hi folks!
> Sorry to trouble u again....but envi seems to be just going above my
> head...there is another problem that i am facing:
> Please go through the 2 functions:
>
> 1.function example,b1
> help,b1
> end
> 2.function example,b1,b2
> help,b1
> end
>
> Now could anyone tell me why these 2 codes are producing different
> final answers??? I just cant find any reason for it.
>
> One more problem :
>
> 'b1' is a positive array and 'avgb1' is a positive number but when i
> use the formula : result=b1*100/avgb1
> print, result
> , the answer that i get is a negative array.
>
> Whereas if i use the formula : result=b1/avgb1
> print, result * 100
> , then i get a positive array
>

Even without knowing ENVI, the second problem isn't a bug in ENVI.

A integer occupies (in IDL) 16-bit, and therfore covers a range form
-32768 to
32767

anything larger (or smaller) cannot be represented and therefore you
observe an 'overflow', resulting in a negative number.
IDL evalutates your expressinon from left to right, the
overflow occurs after the multiplication with 100.
In the second case the division is done first and thus the value seems
to be small enough not to overflow in the later multiplication.

The solution is to convert your b1 array to LONG.
But did you notice that you do an integer division?
1/2 equals 0.
Maybe you want to use FLOAT or DOUBLE.

hdh,
marc
Re: more bugs in envi !!! [message #35968 is a reply to message #35725] Fri, 25 July 2003 02:45 Go to previous message
David Lopez Pons is currently offline  David Lopez Pons
Messages: 8
Registered: July 2003
Junior Member
Answer to your second problem:
I thik that yours is an overflow problem. The resultof the operation
b1*100 it's to big for an interger (integer, I supose) and returns the
negative value.
Maybe the operation 'b1/avgb1*100' (all together, in the same line)
works fine.
Another solution is to force the float operation with a dot: 'b1*100./avgb1'

DLo.

Gaurav wrote:

> Hi folks!
> Sorry to trouble u again....but envi seems to be just going above my
> head...there is another problem that i am facing:
> Please go through the 2 functions:
>
> 1.function example,b1
> help,b1
> end
> 2.function example,b1,b2
> help,b1
> end
>
> Now could anyone tell me why these 2 codes are producing different
> final answers??? I just cant find any reason for it.
>
> One more problem :
>
> 'b1' is a positive array and 'avgb1' is a positive number but when i
> use the formula : result=b1*100/avgb1
> print, result
> , the answer that i get is a negative array.
>
> Whereas if i use the formula : result=b1/avgb1
> print, result * 100
> , then i get a positive array
>
>
> I hope to hear the answers to these questions soon. Thnxx
> Byee
> Gaurav
>
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Making a 2D Array from 3 columns
Next Topic: Re: IDL 6.0 is released!

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

Current Time: Wed Oct 08 11:32:36 PDT 2025

Total time taken to generate the page: 0.00602 seconds