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

Home » Public Forums » archive » Strange behaviour of Uniq static method
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Strange behaviour of Uniq static method [message #93386] Wed, 29 June 2016 02:14 Go to previous message
Johan Gustafsson is currently offline  Johan Gustafsson
Messages: 3
Registered: June 2016
Junior Member
This is my first post here, so hello everybody.

I've encountered a strange behaviour of the static method Uniq (not the old Uniq function, more about that later). To give a short example:

IDL> x = [FltArr(5), -FltArr(5), RandomN(seed, 5)]
IDL> Print, x.Uniq()
-1.73792 -1.55209 -0.0861842 0.000000 -0.000000 0.000000 -0.000000 0.000000 -0.000000 0.000000 0.0552376 0.835585

The problem is the repeated zeros in array with supposed unique elements. It seems like the Uniq method treats 0. and -0. as two different values, which I believe is a bit unlogical. Also, according to the help page x.Uniq() should be equivalent to x[Uniq(x, Sort(x))], but

IDL> Print,x[Uniq(x, Sort(x))]
-1.73792 -1.55209 -0.0861842 0.000000 0.0552376 0.835585

which is the result I would expect.

I don't know if I really have a question, but it would be nice if someone could confirm that x.Uniq() in the example indeed does not give the expected output. Is this a known bug?

I use IDL 8.5.1 under Windows 10

/Johan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to print the mpfitfun output to a file?
Next Topic: Laggy plotting

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

Current Time: Wed Oct 08 13:57:00 PDT 2025

Total time taken to generate the page: 0.14961 seconds