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

Home » Public Forums » archive » FINITE function
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: FINITE function [message #90050 is a reply to message #90049] Wed, 21 January 2015 04:14 Go to previous messageGo to previous message
andeh is currently offline  andeh
Messages: 23
Registered: April 2011
Junior Member
On Wednesday, 21 January 2015 12:00:29 UTC, g.na...@gmail.com wrote:
> Hi I used the FINITE() function as suggested to find out whether there are nans or infinity numbers in my array. The problem is that I cannot understand the output of that function. I set the keyword SIGN = 1 but I got -1 inthe outcome.
>
> Below is a part of the code:
>
> DataArray ; contains the 3D data
>
> for i = 0, 199 do begin
> for j = 0, 199 do begin
> Barray = DataArray[*,i,j] - Array[i,j]
> print, where(finite(Barray), /INFINITY, SIGN=1))
> endfor
> endfor
>
> I got the -1 value thousands of times maybe and I am not even able to figure out in which place of that array there are infinity or nans (if there are any)
>
> Can anyone help with this?



Your test is only looking for positive infinity so all finite numbers, negative infinities, and NaNs will not be flagged. e.g.

IDL> PRINT, FINITE( 1.0, /INFINITY, SIGN=1), WHERE(FINITE( 1.0, /INFINITY, SIGN=1))

IDL> PRINT, FINITE( !VALUES.F_NAN , /INFINITY, SIGN=1), WHERE(FINITE( !VALUES.F_NAN , /INFINITY, SIGN=1))
0 -1

IDL> PRINT, FINITE( -!VALUES.F_NAN , /INFINITY, SIGN=1), WHERE(FINITE( -!VALUES.F_NAN , /INFINITY, SIGN=1))
0 -1

IDL> PRINT, FINITE( 1.0 / 0.0 , /INFINITY, SIGN=1), WHERE(FINITE( 1.0 / 0.0, /INFINITY, SIGN=1))
1 0

IDL> PRINT, FINITE( -1.0 / 0.0 , /INFINITY, SIGN=1), WHERE(FINITE( -1.0 / 0.0, /INFINITY, SIGN=1))
0 -1



You are getting -1 values from WHERE(). This means that there are no matching elements in FINITE(Barray).


To search for all non-finite numbers, make your search
WHERE( ~FINITE(Barray) )
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FIGLIO DI PUTTANA, MANDANTE DI OMICIDI: PAOLO BARRAI DI CRIMINALI WMO, BSI ITALIA SRL, BLOG "MERDATO" LIBERO! MINACCIA DI MORTE CHI LO FOTOGRAFA E SE "COSTUI" INSISTE, L'OMICIDA PAOLO BARRAI FA UCCIDERE O "SUICIDARE" DAVVERO!
Next Topic: map function for astronomy

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

Current Time: Fri Oct 10 01:50:22 PDT 2025

Total time taken to generate the page: 1.67937 seconds