This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: UCF Physics: AST 5765/4762: (Advanced) Astronomical Data Analysis Fall 2008 Lecture Notes: 6. Python Functions, Coding, FITS 1 Summary Pre-Class: Copy handouts Copy handouts, demos, visuals to class Handouts: 2 Check in: 2:00 — 2:05, 5 min • Do you have VNC up, python running, and the lecture demo ready to go? • Who has done the matplotlib tutorial? How much of pydatatut? • Any problems with system? • Questions? • HW3 is out, there is a handout called coding.pdf • Examples/templates in python directory 3 Functions in General: 2:05 — 2:20, 15 min • Computer programs can be very long and complicated • Manage complexity by “boxing away” detail in functions • Difference between “black box” and “glass brick” • A function is a program unit that can be called by name • Also called “routine” or “procedure” or “subprogram”, w/ nuances • Contains program statements • Executes same way each time it is called • Programmer says name of function rather than inserting whole block of statements in the main routine • Example: 1 def triple(x): y = 3 * x return y • If you now say triple(4) , it prints 12 • Variables outside function can have different names from those inside: z = 5 triple(z) 15 • It works, even though we used z and not x ....
View Full Document
This note was uploaded on 11/09/2009 for the course AST 4762 taught by Professor Harrington during the Fall '09 term at University of Central Florida.
- Fall '09