IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Angela Des Jardins

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Python Basics: Statements Expressions Loops Strings Functions.
COMP234 Perl Printing Special Quotes File Handling.
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
1 Pendahuluan Pertemuan 5 Matakuliah: H0062/Teori Sistem Tahun: 2006.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Guide To UNIX Using Linux Third Edition
Arrays. A problem with simple variables One variable holds one value –The value may change over time, but at any given time, a variable holds a single.
SPSS Statistical Package for the Social Sciences is a statistical analysis and data management software package. SPSS can take data from almost any type.
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
IDL Tutorials: Day 1 Michael Hahn
Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Introduction to Python
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
Input, Output, and Processing
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Computer Science 101 Introduction to Programming.
Unix Tutorial for FreeSurfer Users. Helpful To Know FreeSurfer Tutorial Wiki:
IDL Tutorials Day 2 Henry (Trae) Winter
Introduction to Programming with RAPTOR
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Digital Image Processing Lecture 6: Introduction to M- function Programming.
Ch13-1 Chap 13 Introduction to Matlab 13.1 Introduction MATLAB : The MATrix LABoratory program Not only is the MATLAB programming language exceptionally.
Digital Image Processing Introduction to M-function Programming.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Maria Kazachenko
Python Let’s get started!.
Structuring Data: Arrays ANSI-C. Representing multiple homogenous data Problem: Input: Desired output:
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to Programming Python Lab 3: Arithmetic 22 January PythonLab3 lecture slides.ppt Ping Brennan
NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS ( NET 222: COMMUNICATIONS AND NETWORKS FUNDAMENTALS (PRACTICAL PART) Tutorial 2 : Matlab - Getting Started.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Scott Marino MSMIS Kean University MSAS5104 Programming with Data Structures and Algorithms Week 1 Scott Marino.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
IDL Tutorials Day 1 Henry (Trae) Winter Room 235
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
An Introduction to Programming in Matlab Emily Blumenthal
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
Fundamentals of Programming I Overview of Programming
Topics Designing a Program Input, Processing, and Output
Python Let’s get started!.
Revision Lecture
Variables, Expressions, and IO
Getting Started with C.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Lecture 2 Introduction to MATLAB
Teaching London Computing
CS 100: Roadmap to Computing
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Functions continued.
Topics Designing a Program Input, Processing, and Output
Class code for pythonroom.com cchsp2cs
Presentation transcript:

IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Angela Des Jardins

What is IDL?  Interactive Data Language (IDL) is a powerful, interactive command language with all of the program control options of a standard programming language.  Many useful functions are available in large library  Used by - Nasa - Lockheed-Martin - Medical Imaging Fields     

Note: In this tutorial, IDL> refers to the IDL prompt. Once in IDL, you type the stuff that comes after this. For example to enter the print command, I’ll have IDL>print,a and you would type in “print,a” at the command line. Also, [brackets] in an IDL description indicate an optional item.

Starting IDL  In a terminal window, once an IDL “path” is setup (.idl_startup), type idl, idlde, sswidl, or sswidlde  sswidl = IDL solar software, useful for solar physicists  Calling sswidl or sswidlde calls IDL with specified paths which have useful programs for solar physics work. You’ll almost always use sswidl or sswidlde.  To manually set the “paths” needed for your work, talk to your research advisor  Calling sswidlde calls a graphical developer, where sswidl simply works in your terminal window  To use an OS command, enter $ prior to it: IDL>$ls Exceptions: pwd, cd,’/disk…’  To exit out of IDL, type IDL>exit

Journal Procedure  Records everything you enter, plus any error or processing messages output by IDL, into a text file  Syntax: IDL> journal,‘text_file’opens the file & starts record IDL> command line statements IDL> journal closes the file  To view, open journal file with any text editor emacs text_file & Journal is also useful for starting a program you want to write, or for creating batch files

General Strategies IDL help menu: IDL>? IDL help menu: IDL>? sswidl (solar) help: IDL>xdoc sswidl (solar) help: IDL>xdoc IDL>help, [variable, /str]For properties of variables and status IDL>help, [variable, /str]For properties of variables and status IDL>which,’program.pro’Tells you which program you’re using IDL>which,’program.pro’Tells you which program you’re using  To modify a program you want to call in IDL, many text editors can be used: nedit, emacs, pico, vi Don’t memorize all commands Don’t memorize all commands Keep notes on your work and use the IDL journal Keep notes on your work and use the IDL journal Write programs in steps Write programs in steps Learn by doing - don’t be afraid to make mistakes Learn by doing - don’t be afraid to make mistakes

Some basic syntax  IDL is not case sensitive but Unix is IDL> help, var (=) IDL> HELP, Var IDL> journal, “text_file” (NOT =) journal, “Text_File”  Use the up arrow key to recall the most recent IDL input lines  Commas are used to separate arguments from one another  Use & to enter more than one command on a line  Use $ at the end of a line that needs to continue  “All” programs end with.pro  ; comments out an IDL line

Basic Variable Types  Strings (Text) - Must be contained within “ “ or ‘ ‘ - Must be contained within “ “ or ‘ ‘ - cannot perform numerical operations - cannot perform numerical operations  Integers - only range from –32,768 to 32,767 - only range from –32,768 to 32,767  Long word Integers - IDL>long(#) for 32 bit integers - IDL>long(#) for 32 bit integers - IDL>long64(#) for 62 bit integers - IDL>long64(#) for 62 bit integers  Float - floating point number with 32 bit word length - floating point number with 32 bit word length - IDL>3./2. Or IDL>float(3)/float(2) - IDL>3./2. Or IDL>float(3)/float(2)  Double - a floating point number with 64 bit word length - a floating point number with 64 bit word length

Assigning a Variable a Value, math  Variable_name = value - will automatically select a variable type - will automatically select a variable type  Variable_name = function_name(argument)  Variable_name = string(value)  Variable_name = long(value)  Variable_name = fix(value) for integers  Variable_name = float(value)  Variable_name = double(value) Math works the way you think it would: IDL>try=5./ IDL>print,try5.7667

Naming Variables  Assign ‘readable’ variable names that make sense  Variable names must start with a letter - NO: 6a=“gamma” OK: a6=“gamma”  Variables should not have the same name as IDL functions (you’ll probably learn this the hard way; ‘switch’ example’)  -NO: plot=6.0  Variable names may not have spaces in them - NO: A 6=5 OK: A_6=5  Some characters are illegal or have special meanings - NO: a.b=5 (used for structures), A+=5, A#=5

Arrays  Variables, of any type, that contain multiple values  Array Indexing: IDL arrays start at index zero IDL>A=[1,2,3,4] IDL>print, A[0]1 IDL>print, A[1]2  Multiple ways to create arrays intarr(), fltarr(), dblarr(), strarr() indgen(), findgen(), dindgen() IDL>b=findgen(4) IDL>print,b[0:2]

Array operations  Simple math operations IDL>D=findgen(3) IDL>D=findgen(3) IDL>A=2*D IDL>A=2*D IDL>print,A IDL>print,A  More complex math Manipulating arrays - multiply an array by another, matrix operations: look in help Manipulating arrays - multiply an array by another, matrix operations: look in help  Useful functions Total(array): computes a sum of all elements Total(array): computes a sum of all elements Min(array): outputs the min value; also Max Min(array): outputs the min value; also Max Minmax(array): outputs the min then max Minmax(array): outputs the min then max N_elements(array): gives total # of elements N_elements(array): gives total # of elements

Structures  Structures are variables that contain multiple variables (scalars, arrays, or other structures) (scalars, arrays, or other structures)  Each variable contained within a structure is called a tag Syntax: struct={[struct_type], tag_name1: tag_value1,…}  IDL> list={frst:findgen(10),scnd:findgen(10)*2,thrd:findgen(10)+1}  IDL> print,list.frst  IDL> print,list.scnd[2]  IDL> help,list,/str FRSTFLOATArray[10] FRSTFLOATArray[10] SCNDFLOATArray[10] SCNDFLOATArray[10] THRDFLOATArray[10] THRDFLOATArray[10]

“Homework” Try these examples (in IDL!) on your own: 1)Print out the answer in double precision of Pi+3*6.2 2)Make an array of 15 floating point numbers that count from 3 to 17. 3) Make a structure with four tags, each tag having 5 values. Print the value of the third element of the second tag. 4)What is the name of the journal file you (should have!) created when practicing the above tasks? 5)What is one question you have about the basics of IDL?