Anyway, I spent all morning struggling trying to do very simple input and output from this stupid stupid language.
I learned a few things, and since I hardly ever code in IDL, I am sure I'll forget unless I write them down right now. So here we go:
1) Tag names
You can get the tag names from a structure like this:
tname = tag_names(struct)
2) Merging structures
You can merge two structures as follows:
str3 = create_struct(str1,str2,NAME='str3')
3) writecol bug
For some reason when I try to use writecol to write out data, if there are more that 6 columns, and I don't specify the format, it puts a return carriage in the middle of the data. This goes away if you specify the format:
thisfile = './qsosMergedInfo.dat'
writecol,thisfile, qsos.ra, qsos.dec, qsos.z, qsos.zwarning, $
qsos.flux_clip_mean[0],qsos.flux_clip_mean[1], qsos.flux_clip_mean[2], $
qsos.flux_clip_mean[3], qsos.flux_clip_mean[4], fmt='(f,f,f,f,f,f,f,f,f)'
Just wanted to say thanks - I'd encountered point 3 and was wondering how to get around - and you've solved it for me :)
ReplyDeletePhysics PhD Student in the UK.
It's a very fortran-like syntax. Unlike IDL, fortran is pretty well designed for it's intended purpose. The worst part is that it's precisely when you need to get some serious work done that the license server usually crashes. I expect (hope) that IDL will die off soon.
ReplyDelete