NRAO Home  >  Green Bank  |  Wiki Topic:    GB > Software > IDLDataIOTutorial
   Changes | Index | Contents | Search | Statistics | Go

IDL Data I/O Tutorial

Overview

This tutorial is useful for any user who wishes to bypass the GUIDE layer, which emulates IDL, and use the underlying data I/O classes. This layer is not designed for ease of use, but for programming efficiency. Those users who want an easier way to import their data into IDL should use the GUIDE layer. These examples will show you how to import data into IDL using the base data I/O classes, search and browse through the data, create spectra and continua objects, and plot those objects.

A Precondition for importing your data into IDL is that you have one or more GBT SDFITS files that you wish to use.

Starting IDL

Launch IDL by typing gbtidl at the unix prompt. A external plotter window will be launched, and you will see the following on the console you launched it from:

IDL Version 6.1, Solaris (sunos sparc m64). (c) 2004, Research Systems, Inc.
Installation number: 15269-1.
Licensed for use by: National Radio Astronomy Observatory

Starting GBTIDL

Display Device  : X
Visual Class    : TrueColor
Visual Depth    : 24-Bit
Color Table Size: 256
Number of Colors: 16777216
Decomposed Color: 0

GBTIDL -> 

To begin, you must first know whether you will be working with continuum or spectral line data. For the first example, we will load spectral line data into an IDL data structure which complies with the GBT Science Data Model.

Importing Spectral Line Data

Step 1: Create an Empty I/O Object

The first thing that you need to do is create the empty I/O object that will store your data. Note that since we know we are working with spectral line, we will create an 'io_sdfits_line' object.

io = obj_new('io_sdfits_line')

Step 2: Define SDFITS File to Load

f = '/users/pmargani/sandbox_trunk/gbtidl/tests/data/TREG_040815.acs.raw.scan60.fits'

Step 3: Double Check That File Exists (Optional)

If you wish to confirm that your file has been loaded correctly, you can type the following command:

help, file_info(f), /str

This will give you the contents of IDL's FILE_INFO data structure. You will be echoed the full path to the file, and some information about that file. In the example below, you will note that the file exists, and is readable and writable (these fields have a value of 1). It is not an executable, is not a directory, and is not a symbolic link (these fields have a value of 0).

GBTIDL -> help, file_info(f), /str
** Structure FILE_INFO, 21 tags, length=72, data length=67:
   NAME            STRING    '/users/pmargani/sandbox_trunk/gbtidl/tests/data/TREG_040815.acs.raw.scan60.f'...
   EXISTS          BYTE         1
   READ            BYTE         1
   WRITE           BYTE         1
   EXECUTE         BYTE         0
   REGULAR         BYTE         1
   DIRECTORY       BYTE         0
   BLOCK_SPECIAL   BYTE         0
   CHARACTER_SPECIAL
                   BYTE         0
   NAMED_PIPE      BYTE         0
   SETUID          BYTE         0
   SETGID          BYTE         0
   SOCKET          BYTE         0
   STICKY_BIT      BYTE         0
   SYMLINK         BYTE         0
   DANGLING_SYMLINK
                   BYTE         0
   MODE            LONG               436
   ATIME           LONG64                1100275462
   CTIME           LONG64                1099668795
   MTIME           LONG64                1096305320
   SIZE            LONG64                    823680

Step 4: Associate Your File to the Empty I/O Object

The next step is to link your empty I/O object to the file that you would like to use to populate the io object you have defined. The simplest way to do this (there are many ways to use the same io object) is by typing the following command:

io->set_file, f

You will see the following, indicating that this step worked:

GBTIDL -> io->set_file, f
MRDFITS: Binary table.  43 columns by  1 rows.
index file created.

This step always creates a new IDL Index File which will allow you to browse through your data without first loading it into IDL. If you already have an index file created for this particular data set, you can instead use the io->add_file, f method: the index file will be validated and the program will ensure that it is in sync with the real data. From this point forward, you will be able to use the io object to search, select and plot your data.

Browsing/Searching through Your Data

Working With Your Data

Plotting Your Data

-- NicoleRadziwill - 18 Nov 2004

Topic IDLDataIOTutorial . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More }
Revision r1.2 - 01 Dec 2004 - 13:05 GMT - PaulMarganian Content copyright © 1999-2007 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.