Subchapters:
|
The structuresAs 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.) There are 33 stars matching the condition. Now print their magnitudes [take care of the ()'s place]: IDL>
print,(catalog.mag)[index] The same result could be obtained with: IDL> print,catalog[index].mag |
IDL courses C. Morisset © 2004 IA/UNAM V 2.2 |