array of structure changed from 5.4 to 5.5? [message #29561] |
Wed, 27 February 2002 00:54  |
starobs99
Messages: 1 Registered: February 2002
|
Junior Member |
|
|
Hello,
The behaviour of arrays of structure changed from IDL5.4 to IDL5.5? I
run the same edulcorated code on the two version (see below), and have
different results. And the worst is that I really don't see how to
perform the last operation of the code with the new behaviour... Any
idea?
Thanks a lot.
-----------------------IDL5.4------------------------------- ------
print,!version
;{ alpha OSF unix Compaq Tru64 5.5 Aug 28 2001 64 64}
s1={str1,t1:0.}
s2=replicate({num:0.,s1:{str1}},10)
s3=replicate(s1,10)
help,s2.s1,s3
;<Expression> STRUCT = -> STR1 Array[1, 10]
;S3 STRUCT = -> STR1 Array[10]
s2.s1=s3
;% Conflicting data structures: structure tag,S3.
-----------------------IDl5.5------------------------------- ------
print,!version
;{ x86 linux unix 5.4 Sep 25 2000 32 32}
s1={str1,t1:0.}
s2=replicate({num:0.,s1:{str1}},10)
s3=replicate(s1,10)
help,s2.s1,s3
;<Expression> STRUCT = -> STR1 Array[10]
;S3 STRUCT = -> STR1 Array[10]
s2.s1=s3
; No Problems!!!
------------------------------------------------------------ -------
|
|
|
Re: array of structure changed from 5.4 to 5.5? [message #29607 is a reply to message #29561] |
Tue, 05 March 2002 08:40  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
starobs99@yahoo.com (starobs99) writes:
> Hello,
>
> The behaviour of arrays of structure changed from IDL5.4 to IDL5.5? I
> run the same edulcorated code on the two version (see below), and have
> different results. And the worst is that I really don't see how to
> perform the last operation of the code with the new behaviour... Any
> idea?
> Thanks a lot.
Greetings!
Yes, this is a change in the behavior of arrays of structures in IDL
from version 5.4 to version 5.5. I discussed this a little in the
following article:
http://groups.google.com/groups?selm=onr8q0kqt6.fsf%40cow.ph ysics.wisc.edu
The short answer is that this is a "semi-good" thing. The previous
behavior was (potentially) totally incorrect, because it was possible
for arrays to magically change into scalars, so this new version is an
improvement.
RSI may have "overdone" it a little with the behavior of structures of
structures within arrays (!), but at least everything is
self-consistent. [ The problem comes because every structure, even a
"scalar" structure, is treated like an array of structures. ]
I also encountered virtually the same crash that you did. The simple
answer is to reform the array before assigning. A little ugly I
admit, but it works,
s2.s1 = reform(s3,1,n_elements(s3))
Craig
> -----------------------IDL5.4------------------------------- ------
> print,!version
> ;{ alpha OSF unix Compaq Tru64 5.5 Aug 28 2001 64 64}
> s1={str1,t1:0.}
> s2=replicate({num:0.,s1:{str1}},10)
> s3=replicate(s1,10)
> help,s2.s1,s3
> ;<Expression> STRUCT = -> STR1 Array[1, 10]
> ;S3 STRUCT = -> STR1 Array[10]
> s2.s1=s3
> ;% Conflicting data structures: structure tag,S3.
> -----------------------IDl5.5------------------------------- ------
> print,!version
> ;{ x86 linux unix 5.4 Sep 25 2000 32 32}
> s1={str1,t1:0.}
> s2=replicate({num:0.,s1:{str1}},10)
> s3=replicate(s1,10)
> help,s2.s1,s3
> ;<Expression> STRUCT = -> STR1 Array[10]
> ;S3 STRUCT = -> STR1 Array[10]
> s2.s1=s3
> ; No Problems!!!
> ------------------------------------------------------------ -------
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|