Tuesday, July 15, 2008

And it goes ... and it keeps going ...

First of all, reply to Beatriz Mingo, that posted a question in an old post here and reminded me that I forgot to post the answer to a problem I had a month ago.

The problem was saving an IDL structure in a FITS table and not being able to read anything but the first line (see here).

I found out that the problem was how IDL was seeing this structure, if it was an array of arrays or several arrays brought together. Anyway, if you create the structure in the usual way, as the reference guide tells you too, you'll have this problem.

The solution I found and according to some IDL experts is the "correct" one (I actually found it a bit of a "dirty trick") was that one:

You create a structure with one element and zero values with create_struct().

outtab=create_struct('x', 0, 'y', 0, 'value', 0.0, 'y_t_full', 0.0, 'y_t', 0.0, 'lambda', 0.0, 'x_r', 0.0)

Replicate it to the size of your vectors.

outtab=replicate(outtab,nel)

Then you fill them up.

outtab.x=x
outtab.y=yout
outtab.value=val
outtab.y_t_full=yfull
outtab.y_t=yn
outtab.lambda=wl
outtab.x_r=xx

And at the end you save it.

mwrfits, outtab, outtabname, /create

That worked for me, now can read the tables.

Today was a trip to Garching day. Coding and reading in the train, this code is getting more complicated that I expected. I learned C, many years ago, but this is requiring more than I can handle nowadays. Either I'll learn more, or I'll crack! Too much time programing in IDL, when you get to low level languages you freak out "where is the WHERE function, where is the MIN function ...".

In Garching we had the visit of Claudia Mendes de Oliveira, my former Ph.D. supervisor, was a nice lunch, we had to discuss some issues about our Gemini and VLT programs for this semester, among other things.

Also some work on the clusters, that's what I'm into now ... had to skip my bike ride on this sunny afternoon (15 days without riding) because that's urgent. Also had to come home early to buy food :-)

Work keeps going ... post ends.

Labels: , , ,

2 Comments:

At 1:21 PM, Blogger Elbereth said...

After some tweaking for my particular case it worked perfectly!
Thank you veru very much!!!!!
And best wishes :)

 
At 1:48 PM, Blogger Cris Da Rocha said...

Good that it works for you also.

Good luck!

 

Post a Comment

<< Home