Back Home Up Next

Subchapters:

The structures

As you can see, the value of a tag is accessible by the name of the structure, followed by the name of the tag, with a point between. You can also access this value by the order number of the tag. Here ra is the secong tag of the structure aaa, it will be accessed by (index begin with 0):

      IDL> print,aaa.(1)

Now if you have a collection of 10000 stars to deal with, first create an array of structure etoile by:

      IDL> catalog = replicate({etoile},10000)

Once you have read your catalog , you can easily work on all the stars. Transform all the ra from hours to degrees:

      IDL> catalog.ra = catalog.ra/24.*360

Extract part of it with the where function. For example you want to extract all the magnitudes of stars with 30<ra<40 and -10<dec<10, just do:

      IDL> index = where(catalog.ra gt 30. and catalog.ra lt 40. and catalog.dec gt -10.  and catalog.dec lt 10.)
      IDL> help,index
            INDEX           LONG      = Array[33]

There are 33 stars matching the condition. Now print their magnitudes [take care of the ()'s place]:

      IDL> print,(catalog.mag)[index]
                  12.0550      14.0625      15.5662      19.2620      11.9780      16.3496
                  18.9050      13.7615      18.7179      14.4189      13.6803      10.7609
                  12.7919      19.0316      11.1760      10.7217      11.0713      12.6282
                  12.5160      12.7219      13.2756      13.4670      19.0979      18.4268
                  16.5390      18.0351      18.9934      13.4255      16.5552      13.7306
                  15.9834      11.8232      14.3605

The same result could be obtained with:

      IDL> print,catalog[index].mag

 

IDL courses C. Morisset 2004 IA/UNAM V 2.2

Back Home Up Next