IDL Tutorial: Day 2 Angela Des Jardins Goals: 1) Introduce functions and procedures 2) Describe writing the simplest kind.

Slides:



Advertisements
Similar presentations
Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
Advertisements

MultiLoop III - Tutorial 1 Running an existing model.
COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
MATLAB’s extensive, device-independent plotting capabilities are one of its most powerful features. They make it very easy to plot any data at any time.
IDL Tutorials: Day 4 Goal: Learn some programming techniques: Relational operators, conditional statements, boolean operators, loops Angela Des Jardins.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
Introduction to Matlab By: Dr. Maher O. EL-Ghossain.
IDL Tutorials : Day 3 Angela Des Jardins Goals: 1) Learn to display images 2) Understand the basics of procedures and.
1 Introduction to MatLab MatLab stands for Matrix Laboratory. As the name suggests most of the programming operations have as input or output a matrix.
A Visual Introduction to PC SAS. Start SAS by double-clicking on the SAS icon...
Access Tutorial 3 Maintaining and Querying a Database
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
Programming For Nuclear Engineers Lecture 12 MATLAB (3) 1.
IDL Tutorial: Day 2 Michael Hahn
IDL Tutorials: Day 1 Michael Hahn
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
GNU/Qt Octave Rohin Kumar Y, Dept. of Physics & Astro Physics, University of Delhi.
1 CS 106 Computing Fundamentals II Chapter 17 “Introduction To VBA” Herbert G. Mayer, PSU CS status 6/30/2013 Initial content copied verbatim from CS 106.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
Data Analysis Using SPSS
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
CIM6400 CTNW (04/05) 1 CIM6400 CTNW Lesson 6 – More on Windows 2000.
Lecture 1 Saima Gul. What is a Project? A Project is a job that has a beginning and an end (time), a specified outcome ( scope) at a stated level of quality.
Introduction to Programming Workshop 1 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
Learning Objectives What is a spreadsheet and what is the difference between a spreadsheet and a worksheet? Start Excel, open an existing spreadsheet,
® Microsoft Access 2010 Tutorial 1 Creating a Database.
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
COMP 116: Introduction to Scientific Programming Lecture 6: Scripts and publishing, Creating matrices.
MATLAB Tutorial EE 327 Signals and Systems 1. What is MATLAB? MATLAB – Matrix Laboratory The premier number-crunching software Extremely useful for signal.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
IDL Tutorials Day 2 Henry (Trae) Winter
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Angela Des Jardins
Introduction to Programming Workshop 6 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Chapter 5 Editing Text Files. Basic Concept A text editor works on a file buffer that is a memory copy of a disk file The disk file is not updated until.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
ENG College of Engineering Engineering Education Innovation Center 1 More Script Files in MATLAB Script File I/O : Chapter 4 1.Global Variables.
I NTRODUCTION TO A UTO CAD P ART 2 Lab 8. CHAPTER OBJECTIVES Creating New Layers Assigning Colors to Layers Assigning Linetypes Assigning Lineweight Changing.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
Introduction to Matlab
An Introduction to Forms. The Major Steps of a MicroSoft Access Database  Tables  Queries  Forms  Macros  Reports  Modules On our road map, we are.
IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Maria Kazachenko
Catholic University College of Ghana Fiapre-Sunyani INFORMATION TECHNOLOGY I Audrey Asante, Faculty of ICST Graphic User Interface Tutorials and Documentation.
Printing in Python. Printing Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external.
MA/CS 375 Fall 2002 Lecture 2. Motivation for Suffering All This Math and Stuff Try the Actor demo from
PROGRAMMING IN R Introduction to R. In this session I will: Introduce you to the R program and windows Show how to install R Write basic programs in R.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Instructions Get the Jeopardy Template working 1)You will need 25 questions and 25 answers. 2)After carefully considering your presentation content, create.
2003 HYPACK MAX Training Seminar1 Sample ADCP 112 – Computing Flow Quantities in ADCP Profile The ADCP Profile program displays color- coded flow data.
IDL Tutorials Day 1 Henry (Trae) Winter Room 235
Structured Computer Programming EE 201 Introduction to MATLAB 7 for Engineers بسم الله الرحمن الرحيم King Abdulaziz University College of Engineering Dept.
Getting Started With Python Brendan Routledge
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Chapter 5: Enhancing Your Output with ODS
Appendix B MathScript Basics
Using a set-up file to read ASCII data into SPSS
Shell Script Assignment 1.
8 6 MySQL Special Topics A Guide to MySQL.
Presentation transcript:

IDL Tutorial: Day 2 Angela Des Jardins Goals: 1) Introduce functions and procedures 2) Describe writing the simplest kind of programs 3) Explain saving and restoring

Functions and Procedures  Two basic types of programs  Functions: result=function_name(parameter, Keyword=Set, …) result=function_name(parameter, Keyword=Set, …) Examples: size, n_elements, sin, cos, reverse, where - Functions can be placed anywhere you can put a value  Procedures: procedure_name, param1, param2, Keyword=Set… Examples: help, print, open, printf, plot, set_plot, device, save - Procedures do stuff, but don’t need to return a value  Exact syntax for particular Procedures or Functions can be found using the help menu, xdoc, or the doc_library procedure

Commonly Used Procedures  print: for printing stuff to screen: IDL>print, sin(x)  plot: plot variables to the current graphics device (usually screen): IDL>plot, x, y,[title=‘blah’,…keywords]  set_plot: tells idl where to send plots to. Screen (Xdisplay) is default - IDL>set_plot,”x” ;sends output to the x display - IDL>set_plot, “ps”; sends the output to a postscript file with default name idl.ps. Read ps files with ghostview unix_prompt> gv idl.ps  device: changes properties of the device currently enabled by set_plot. See help menu.

Save and Restore  Programs are saved by saving the text file you write them in  Save, the procedure, allows you to save variables to a file Example: IDL>save, variable1, variable1, file=‘file.sav’  Restore allows you to restore saved variables to a session Example: restore, ‘file.sav’

Commonly Used Functions  Many math operators are functions IDL> y=sin(x) IDL> y=cos(x) IDL>y=exp(x) IDL> y=sin(x) IDL> y=cos(x) IDL>y=exp(x)  Where allows you to pick out the index of an array that meets some criterion > index=where(new_array eq 15) (more on boolean operators later)  Replicate makes copies of variables, arrays, structures, etc... > stars=replicate(stars,15)  dialog_pickfile allows you to graphically pick out file names > file_name=dialog_pickfile()

Macros (Scripts)  Simplest form of Program In the editor window write commands just like you would at command prompt  At the end type END so IDL knows when program is over  Save the program with a unique name (i.e. save the text file)  At the command prompt type either: >.run program_name >.rnew program_name Shortcoming: no loops allowed in macros.

“Homework”  Make a macro in which you plot, on a good scale, with labels, y=e x. Also, have it print to the screen, “You did it right!” Make a post script copy of your plot.  Make a file using emacs (or your favorite editor) which contains a row for each student in this class and a column for each of the following: distance (in miles) of the student’s home from Bozeman, year in college, favorite color (in Angstroms), number of books read in the last year, number of trails hiked in the last year, and number of foods disliked. Use ascii_template and read_ascii to make a structure containing your numbers. Using the plot procedure, find out if there are any correlations among yourselves!