IDL Tutorials: Day 1 - PowerPoint PPT Presentation

About This Presentation
Title:

IDL Tutorials: Day 1

Description:

Interactive Data Language- for easy manipulation of large data sets ... IDL help, var = IDL HELP, Var. but IDL journal, 'text_file' Journal, 'Text_File' ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 12
Provided by: solarPhys
Category:
Tags: idl | day | tutorials | var

less

Transcript and Presenter's Notes

Title: IDL Tutorials: Day 1


1
IDL Tutorials Day 1
  • Michael Hahn
  • (hahn_at_solar.physics.montana.edu)

2
What is IDL
  • Interactive Data Language- for easy manipulation
    of large data sets
  • Many useful functions already in large library
  • Used by
  • - Nasa
  • - Lockheed-Martin
  • - Medical Imaging
  • http//www.rsinc.com/
  • http//idlastro.gsfc.nasa.gov/homepage.html
  • http//www.astro.washington.edu/deutsch/idl/htmlhe
    lp/index.html
  • http//www.ugastro.berkeley.edu/tutorials/tutorial
    s.html
  • http//www.lmsal.com/solarsoft

3
General Strategies
  • Know the problem before you start programming
  • Search to see if a similar problem has already
    been solved
  • -IDL help menu (gt?)
  • - xdoc (sswidl)
  • Dont Memorize
  • Use the help Screen
  • Keep notes on your work
  • Write programs in steps
  • Learn by doing

4
Using sswidl(de) and Help
  • SSW solar software, useful for solar physicists
  • Calling sswidl or sswidlde calls IDL with
    specified paths
  • - paths with useful programs for solar physics
    work
  • To manually set paths talk to _______________
  • Calling sswidlde calls a developer
  • - graphical interface
  • - real time information about your code
  • Any text editor can be used
  • - nedit, emacs, pico, vi
  • gt? Calls up help index for information on
    procedures
  • Help, variable, for properties of variable
    or status

5
Journal Procedure
  • Records everything you enter into a textfile
  • Syntax
  • IDLgt journal, text_file opens the file
    starts record
  • IDLgt command line statements
  • IDLgt journal closes the file
  • IDL is not case sensitive but Unix is
  • IDLgt help, var IDLgt HELP, Var
  • but IDLgt journal, text_file ? Journal,
    Text_File
  • Open journal file with any text editor
  • nedit text_file

6
Basic Variable Types
  • Strings
  • - Text
  • - Must be contained within or
  • - cannot perform numerical operations
  • Integers
  • - only range from 32,768 to 32,767
  • Longword Integers
  • - long() for 32 bit integers
  • - long64() for 62 bit integers
  • Float
  • - floating point number with 32 bit word length
  • Double
  • - a floating point number with 64 bit word
    length

7
Assigning a Variable a Value
  • Variable_name value
  • - will automatically select a variable type
  • variable_name function_name(argument)
  • Variable_namestring(value)
  • Variable_name long(value)
  • Variable_name fix(value) (for integers)
  • Variable_name double(value)

8
Naming Variables
  • Assign readable variable names that make sense
  • Variable names must start with a letter
  • - NO 6agamma OK a6gamma
  • Variables should not have the same name as IDL
    functions
  • - NO plot6.0
  • Variable names may not have spaces in them
  • - NO A 65 OK A_65
  • Some characters are illegal or have special
    meanings
  • - NO a_at_5, a.b5 (used for structures), A5,
    A5

9
Arrays
  • Variables, of any type, that contain multiple
    values
  • Array Indexing IDL arrays start at index zero
  • - e.g. A1,2,3,4 print, A0 1 print,
    A1 2
  • Multiple ways to create arrays
  • intarr(), fltarr(), dblarr(), strarr()
  • indgen(), findgen(), dindgen()
  • - Look up the above in the IDL help (e.g. gt?
    Intarr)
  • Array operations, see the help menu or experiment

10
Structures
  • Structures are variables that contain multiple
    variables
  • (scalars, arrays, or other structures)
  • Each variable contained within a structure is
    called a tag
  • Syntax structstruct_type, tag_name1
    tag_value1,
  • e.g.
  • Starsstar_name, Namealpha centauri a,
  • spec_typeg2 V, coords14 38.0, -60
    44,
  • Distancedouble(1.31)
  • Starsreplicate(stars,3)
  • stars.namealpha centauri a, alpha centauri
    b,
  • alpha centauri c
  • Print, stars.name
  • Print, stars0.name
  • Note you dont need to name a structure type

11
Miscellaneous
  • gt? Gives you the help menu
  • gt starts a comment line and is ignored by IDL
  • - often helpful to comment copiously
  • tells IDL to treat the next line as if it is
    part of the current
  • line
  • IDL is case and space insensitive. Unix is not!
  • Most math operators work just the way youd think
    they do
  • x53-16
  • print, x
Write a Comment
User Comments (0)
About PowerShow.com