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

Home » Public Forums » archive » Re: transforming an array where some values can't
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: transforming an array where some values can't [message #10896] Mon, 09 February 1998 00:00 Go to previous message
Evilio del Rio is currently offline  Evilio del Rio
Messages: 17
Registered: December 1997
Junior Member
On 6 Feb 1998, Joel D. Offenberg wrote:

> bowler@eisner.decus.org writes:
>
>> I'm trying to write a function that will transform an arbitrary array by taking
>> hte natural log of every element in the array.
>
>> What I have is
>
>> function xform, input
>> temp = alog(input) ; I realize I could combine these 2 statements
>> return, temp ; but it makes debugging easier
>> end
>
>> Unfortunately, I can't guarentee that there won't be some elements that are
>> zero and thus invalid arguments to alog. what's the "most efficient" way to
>> take the alog of any element that's greater than 0 and set the value of ony
>> that are less than or equal to 0 to some small value (1e-7 for example)?
>
IDL softly handles any math exception (IEEE standard) so you don't need to
worry about the small/negative values for alog() :

IDL> print,alog(0.0)
-inf
IDL> print,alog(-1.0)
nan0x2000000

You just need to handle special case with the function FINITE(). However,
many of the standard plot/calculation routines can treat naN values as
missing data, try for example:

IDL> plot,alog(randomn(seed,100))


Cheers,

____________________________________________________________ ________
Evilio Jose del Rio Silvan Institut de Ciencies del Mar
E-mail: edelrio@icm.csic.es URL: http://www.ieec.fcr.es/~evilio/
"Anywhere you choose,/ Anyway, you're gonna lose"- Mike Oldfield
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Summary: failed call_external under Windows NT
Next Topic: Re: Surface normals with shade_volume

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

Current Time: Wed Oct 08 19:04:06 PDT 2025

Total time taken to generate the page: 0.00450 seconds