Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| en:praktikum:gdl [2014/12/13 16:57] – typo msteinke | en:praktikum:gdl [2016/06/16 01:31] (current) – rhainich | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| Now enter the GDL program code line by line and the interpreter executes it right away. | Now enter the GDL program code line by line and the interpreter executes it right away. | ||
| - | However, it's more conveniant | + | However, it's more convenient |
| .compile myprog.pro | .compile myprog.pro | ||
| - | Depending on the name given to the program | + | The first line of the program code gives the (internal GDL) name of the program |
| pro prog1 | pro prog1 | ||
| - | the compiling | + | After compiling the program " |
| prog1 | prog1 | ||
| in GDL. | in GDL. | ||
| - | |||
| ====== Syntax ====== | ====== Syntax ====== | ||
| Line 26: | Line 25: | ||
| and even | and even | ||
| PrInT, "Hello World!" | PrInT, "Hello World!" | ||
| - | return the same output. However, for strings and filenames | + | return the same output. However, for strings and file names it's different, as usual. |
| ==== Basics==== | ==== Basics==== | ||
| - | | Calling the interpreter: | + | ^ |
| - | | Starting GDL help: | ? | + | | Calling the interpreter: |
| - | | | | + | | Starting GDL help: | |
| - | | Show all variables: | + | | Show all variables: |
| - | | Compile a script: | .compile myprogram.pro | + | | Compile a script: | |
| - | | Execute the script in gdl: | myprogram | + | | Execute the script in gdl: | |
| - | | Leave gdl: | + | | Leave gdl: |
| - | | First line of a script: | + | | First line of a script: |
| - | | Last line of a script (end of the program): | end | | + | | Last line of a script (end of the program): | |
| (Note: Replace " | (Note: Replace " | ||
| + | |||
| ==== FITS files ==== | ==== FITS files ==== | ||
| - | Read the content of a fits file into the variable | + | Read the content of a fits file into the variable |
| image1 = readfits(' | image1 = readfits(' | ||
| If the image is not in the current directory, give the full (or relative) path (i.e. ' | If the image is not in the current directory, give the full (or relative) path (i.e. ' | ||
| - | Depending on the internal computer architecture, | + | Depending on the internal computer architecture, |
| byteorder, image1 | byteorder, image1 | ||
| Line 53: | Line 53: | ||
| writefits, ' | writefits, ' | ||
| - | Note: All FITS commands require the (freely distributed) AstroLib for GDL/IDL (which is installed for the praktikum account). | + | Note: All FITS commands require the (freely distributed) |
| ==== Input/ | ==== Input/ | ||
| Line 61: | Line 61: | ||
| print, "Hello ", namevar | print, "Hello ", namevar | ||
| | | ||
| - | Any number of values/ | + | Any number of values/ |
| Write into a file: | Write into a file: | ||
| Line 69: | Line 69: | ||
| close, handle | close, handle | ||
| - | //handle// needs to be an arbitrary but unique integer value. | + | //handle// needs to be an arbitrary but unique integer value. |
| openw, | openw, | ||
| Line 76: | Line 76: | ||
| free_lun, | free_lun, | ||
| - | GDL will assign a handle | + | In this case GDL will automatically |
| ==== Variables and arrays ==== | ==== Variables and arrays ==== | ||
| - | Indexed | + | Index variables start with the index 0. Thus, an array with the indices 0, |
| - | Dimensioning | + | Dimensioning |
| variablename = intarr(MMAX+1, | variablename = intarr(MMAX+1, | ||
| - | If the variable shall contain larger numbers | + | In some cases lager values are required |
| variablename = lonarr(MMAX+1, | variablename = lonarr(MMAX+1, | ||
| variablename = lon64arr(MMAX+1, | variablename = lon64arr(MMAX+1, | ||
| Line 100: | Line 100: | ||
| The number of entries in an array (e.g. // | The number of entries in an array (e.g. // | ||
| size(variablename,/ | size(variablename,/ | ||
| - | which returns an array itself (data type, size etc.). To obtain the number, extract the first value (index 0!) of that array: | + | which returns an array itself (with data type, size, etc.). To obtain the number |
| number = (size(variablename,/ | number = (size(variablename,/ | ||
| Line 117: | Line 117: | ||
| endif | endif | ||
| - | See the help of GDL (type "?" | + | Additional information can be accessed via the help of GDL (type "?" |