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

Home » Public Forums » archive » saving pointers in structures to FITS files?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
saving pointers in structures to FITS files? [message #65097] Tue, 10 February 2009 15:30 Go to next message
Christopher Thom is currently offline  Christopher Thom
Messages: 66
Registered: October 2006
Member
Hi all,

I have some code that uses to a structure to store a bunch of information.
In the structure, I need to hold an array whose size will be defined (and
modified) at run-time. I figured the easiest way was just to hold a
pointer in the structure, and populate the heap variable at runtime.

However...I'd like for the structure to be persistent between idl
sessions, and I'd like the on-disk file to be fairly portable between
collaborators/idl versions. I've tried all manifestations of FITS routines
for dumping this, but mwrfits seems to just convert the data to a regular
array, and I lose the ability to modify the length of the array when i
read it back in.

Does anyone have suggestions for drop-in replacements for the FITS binary
tables? I've had problems with save files across idl versions before. Are
there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
that I should be specifying? Or do I just have to suck it up and use a
save file?

cheers
chris
Re: saving pointers in structures to FITS files? [message #65287 is a reply to message #65097] Wed, 25 February 2009 05:16 Go to previous messageGo to next message
andersld is currently offline  andersld
Messages: 4
Registered: February 2009
Junior Member
Hi,
I'm not sure I understand your problem entirely, but maybe objects are
the solution. You can create an object whose "self" structure
contains all the information you wish to store, including the data
pointer. Then you can write methods to do whatever you need, i.e.
read in FITS tables, save to disk, or you can have this done
automatically when the object is initialized. You can share the FITS
file and the object code with collaborators.

If you haven't worked with objects before, here is some information to
get started: http://beauty.nascom.nasa.gov/~zarro/idl/objects/objects.htm l

-Loren
Re: saving pointers in structures to FITS files? [message #65296 is a reply to message #65097] Tue, 24 February 2009 14:47 Go to previous messageGo to next message
Christopher Thom is currently offline  Christopher Thom
Messages: 66
Registered: October 2006
Member
Hi Reimar,

Thanks for your tips. I'll look into netCDF...and in the meantime, I just
defaulted to using .sav files. But maybe a quick wrapper to my FITS reader
would do the trick. Will have to think about it some more...

cheers
chris


Quoth Reimar Bauer:

> Christopher Thom schrieb:
>> Hi all,
>>
>> I have some code that uses to a structure to store a bunch of information.
>> In the structure, I need to hold an array whose size will be defined (and
>> modified) at run-time. I figured the easiest way was just to hold a
>> pointer in the structure, and populate the heap variable at runtime.
>>
>> However...I'd like for the structure to be persistent between idl
>> sessions, and I'd like the on-disk file to be fairly portable between
>> collaborators/idl versions. I've tried all manifestations of FITS routines
>> for dumping this, but mwrfits seems to just convert the data to a regular
>> array, and I lose the ability to modify the length of the array when i
>> read it back in.
>>
>> Does anyone have suggestions for drop-in replacements for the FITS binary
>> tables? I've had problems with save files across idl versions before. Are
>> there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
>> that I should be specifying? Or do I just have to suck it up and use a
>> save file?
>>
>> cheers
>> chris
>
> Hi Christoper
>
> no one has answered because you have to look for one who has run in the
> same trouble so he can understood your problem.
>
> I have no idea what FITS is.
>
> But I can tell that you won't have problems with save files if you just
> save your own variables and not everything.
>
> If the problem is that the pointer is replaced by it's content why don't
> you recreate the pointer again?
>
> you can do this by
> http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/struct2ptr_struct_dbase.pro.html
> http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _work/rb_lib/struct2ptr_struct.pro
>
> struct={A:1,b:FINDGEN(10)}
>
> HELP,struct,/str
> ** Structure <1052378>, 2 tags, length=44, refs=1:
> A INT 1
> B FLOAT Array[10]
> result=struct2ptr_struct(struct)
> HELP,result,/str
> ** Structure <10551e8>, 2 tags, length=8, refs=1:
> A POINTER
> B POINTER
>
> Also you could save your data in an hdf SD or netCDF file. Those files
> can be read by various programs/languagees so one can choose how to
> operate with that data. It is always good to keep the dependencies low.
>
>
> cheers
> Reimar
>
>
>
>
Re: saving pointers in structures to FITS files? [message #65304 is a reply to message #65097] Tue, 24 February 2009 04:01 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Christopher Thom schrieb:
> Hi all,
>
> I have some code that uses to a structure to store a bunch of information.
> In the structure, I need to hold an array whose size will be defined (and
> modified) at run-time. I figured the easiest way was just to hold a
> pointer in the structure, and populate the heap variable at runtime.
>
> However...I'd like for the structure to be persistent between idl
> sessions, and I'd like the on-disk file to be fairly portable between
> collaborators/idl versions. I've tried all manifestations of FITS routines
> for dumping this, but mwrfits seems to just convert the data to a regular
> array, and I lose the ability to modify the length of the array when i
> read it back in.
>
> Does anyone have suggestions for drop-in replacements for the FITS binary
> tables? I've had problems with save files across idl versions before. Are
> there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
> that I should be specifying? Or do I just have to suck it up and use a
> save file?
>
> cheers
> chris

Hi Christoper

no one has answered because you have to look for one who has run in the
same trouble so he can understood your problem.

I have no idea what FITS is.

But I can tell that you won't have problems with save files if you just
save your own variables and not everything.

If the problem is that the pointer is replaced by it's content why don't
you recreate the pointer again?

you can do this by
http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dbase/struct2ptr_struct_dbase.pro.html
http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _work/rb_lib/struct2ptr_struct.pro

struct={A:1,b:FINDGEN(10)}

HELP,struct,/str
** Structure <1052378>, 2 tags, length=44, refs=1:
A INT 1
B FLOAT Array[10]
result=struct2ptr_struct(struct)
HELP,result,/str
** Structure <10551e8>, 2 tags, length=8, refs=1:
A POINTER
B POINTER

Also you could save your data in an hdf SD or netCDF file. Those files
can be read by various programs/languagees so one can choose how to
operate with that data. It is always good to keep the dependencies low.


cheers
Reimar
Re: saving pointers in structures to FITS files? [message #65359 is a reply to message #65097] Thu, 26 February 2009 05:17 Go to previous message
David Gell is currently offline  David Gell
Messages: 29
Registered: January 2009
Junior Member
On Feb 26, 7:15 am, David Gell <david.g...@swri.org> wrote:
> On Feb 10, 5:30 pm, Christopher Thom <ct...@oddjob.uchicago.edu>
> wrote:
>
>
>
>> Hi all,
>
>> I have some code that uses to a structure to store a bunch of information.
>> In the structure, I need to hold an array whose size will be defined (and
>> modified) at run-time. I figured the easiest way was just to hold a
>> pointer in the structure, and populate the heap variable at runtime.
>
>> However...I'd like for the structure to be persistent between idl
>> sessions, and I'd like the on-disk file to be fairly portable between
>> collaborators/idl versions. I've tried all manifestations of FITS routines
>> for dumping this, but mwrfits seems to just convert the data to a regular
>> array, and I lose the ability to modify the length of the array when i
>> read it back in.
>
>> Does anyone have suggestions for drop-in replacements for the FITS binary
>> tables? I've had problems with save files across idl versions before. Are
>> there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
>> that I should be specifying? Or do I just have to suck it up and use a
>> save file?
>
>> cheers
>> chris
>
> Have you checked the GSFC IDL Astronomy User's Library. It contains a
> large selection of routines to handle FITS files.

I should have added the URL: http://idlastro.gsfc.nasa.gov/contents.html
Re: saving pointers in structures to FITS files? [message #65360 is a reply to message #65097] Thu, 26 February 2009 05:15 Go to previous message
David Gell is currently offline  David Gell
Messages: 29
Registered: January 2009
Junior Member
On Feb 10, 5:30 pm, Christopher Thom <ct...@oddjob.uchicago.edu>
wrote:
> Hi all,
>
> I have some code that uses to a structure to store a bunch of information.
> In the structure, I need to hold an array whose size will be defined (and
> modified) at run-time. I figured the easiest way was just to hold a
> pointer in the structure, and populate the heap variable at runtime.
>
> However...I'd like for the structure to be persistent between idl
> sessions, and I'd like the on-disk file to be fairly portable between
> collaborators/idl versions. I've tried all manifestations of FITS routines
> for dumping this, but mwrfits seems to just convert the data to a regular
> array, and I lose the ability to modify the length of the array when i
> read it back in.
>
> Does anyone have suggestions for drop-in replacements for the FITS binary
> tables? I've had problems with save files across idl versions before. Are
> there better alternatives? Or is there a magic keyword to mwrfits/mrdfits
> that I should be specifying? Or do I just have to suck it up and use a
> save file?
>
> cheers
> chris

Have you checked the GSFC IDL Astronomy User's Library. It contains a
large selection of routines to handle FITS files.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Why did IDL just start crashing
Next Topic: IDL on openSUSE

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

Current Time: Wed Oct 08 19:20:17 PDT 2025

Total time taken to generate the page: 0.00704 seconds