● Why Python? ● What is & isn't possible ● Pitfalls ● Tips & tricks / workarounds ● Real-life example: automatically run efp on all one- dimensional data.

Slides:



Advertisements
Similar presentations
Programming for Beginners
Advertisements

Introducing JavaScript
MACROS CS1100 Computer Science and its Applications CS11001.
Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Georgia Institute of Technology DrJava Appendix A Barb Ericson Georgia Institute of Technology May 2006.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
The Basic Tools Presented by: Robert E., & Jonathan Chase.
Reference Manager Making your life easier! Updated September 2007.
CSC 9010: Natural Language Processing
Dani Vainstein & Monika Arora Gautam 1 Utils Layer Building Library Functions.
INTRODUCTION TO FRONTPAGE. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features Features  Starting Front Page Starting Front Page  Components.
YourClassPage.com TM Inservice Quickstart Guide Getting YOUR classpage up and running!
Lesson 6. GCSE Computing – programming languages Candidates should be able to:  describe common tools and facilities available in an integrated development.
August 29, 2005ICP: Chapter 1: Introduction to Python Programming 1 Introduction to Computer Programming Chapter 1: Introduction to Python Programming.
GNU Compiler Collection (GCC) and GNU C compiler (gcc) tools used to compile programs in Linux.
1 JavaScript in Context. Server-Side Programming.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
CPSC1301 Computer Science 1 Overview of Dr. Java.
Structured programming 3 Day 33 LING Computational Linguistics Harry Howard Tulane University.
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 2 (submit by midnight Friday) Today is Perl.
JCreator Tonga Institute of Higher Education. Programming with the command line and notepad is difficult. DOS disadvantages  User Interface (UI) is not.
Python – May 11 Briefing Course overview Introduction to the language Lab.
Creating Links. The Anchor Element: The anchor tag can be used in three different ways: 1.External link – to link to a web page outside your own website.
I Power Higher Computing Software Development Development Languages and Environments.
Getting Started with Web Page Creation for Fuqua Authors Spring 1999.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Week 1 basic Python programs, defining functions Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where.
DROPBOX VS. GOOGLE DOCS WHICH ONE TO USE?. QUESTIONS TO ASK YOURSELF – SELF ASSESSMENT Do you have too many copies of the same files on multiple computers?
Unit 1 Basic Python programs, functions Special thanks to Roy McElmurry, John Kurkowski, Scott Shawcroft, Ryan Tucker, Paul Beck for their work. Except.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Intermediate 2 Computing Unit 2 - Software Development Topic 2 - Software Development Languages and Environments.
CMSC 1041 Introduction to C Creating your first C program.
1 JavaScript in Context. Server-Side Programming.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Exploring Spyder: An IDE for scientific computing
1/10/2008. >>> About Us Paul Beck * Third quarter TA * Computer Engineering * Ryan Tucker * Second quarter TA * Computer.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Web Scraping with Python and Selenium. What is Web Scraping?  Software technique for extracting info from websites Get information programmatically that.
1 Week 8 Creating Simple Shell Scripts. 2 Chapter Objectives  In this chapter, you will :  Learn how to create Shell Scripts  Commenting / Making Portable.
8/2/07. >>> About Me Scott Shawcroft * Junior * Computer Engineering * Third Quarter TA * Creative Commons Intern * Small-time Open Source Developer
Today… Style, Cont. – Naming Things! Methods and Functions Aside - Python Help System Punctuation Winter 2016CISC101 - Prof. McLeod1.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Getting Started With Python Brendan Routledge
A Simple Website using Cascading Style Sheets (CSS) IST2101.
Debugging using By: Samuel Ashby. What is debugging?  A bug is an error in either a program or the hardware itself.  Debugging is first locating and.
A Simple Website using Cascading Style Sheets (CSS) IST2101.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
CST 1101 Problem Solving Using Computers
Introduction to GIS PythonScript CGIS-NURIntroduction to ArcGIS II.
MET4750 Techniques for Earth System Modeling
Written by Anthony McNicoll
Computer Science A-level
Python Lesson 12 Mr. Kalmes.
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
basic Python programs, defining functions
Python Lesson 12 Mr. Kalmes.
Test Automation For Web-Based Applications
basic Python programs, defining functions
Introduction to Ansible
Test Automation For Web-Based Applications
Creating your first C program
“Under the hood”: Angry Birds Maze
Finding and using code online
Running & Testing :: IDEs
Computer Science A-level
Presentation transcript:

● Why Python? ● What is & isn't possible ● Pitfalls ● Tips & tricks / workarounds ● Real-life example: automatically run efp on all one- dimensional data Using Python with Topspin

What I won't tell you ● General tutorial in how to use Python – Would take too long – Available from several other places (UCS, python.org website, elsewhere on web) ● Generating pulse programs with Python – I haven't needed to do this myself

What is Python? ● Named after Monty Python ● Interpreted (not compiled) language (“script”) ● Aims for code readability & re-use ● Features that cause pitfalls with Topspin + Python: – Leading whitespace (space vs tab) is significant – Pass-by-reference

Why Python? ● Allows automating tedious tasks ● Easier & quicker than C ('AU' programs) – Python has a more complete standard library – Python does not require type declarations – Many AU commands risk causing buffer overruns ● Record of what you did last time

Getting started (1)

Getting started (2)

Getting started (3)

Getting started (4)

Whitespace problems (1) Spot the difference between the two script files... IncorrectCorrect

Whitespace problems (1) Spot the difference between the two script files... IncorrectCorrect Here!

Whitespace problems (2) Default indent in the topspin editor is tab Default indent in code distributed with Topspin is two spaces Editor displays a tab as two spaces Confusing errors!

Whitespace problems (3)

Whitespace problems (4)

Whitespace problems fixed...

Pass / copy by reference ● Every variable in Python is a reference ● Can't tell the difference for immutable data ● For mutable data structures (lists etc.) this can give surprising results

Reference vs Value (immutable)

Reference vs Value (mutable) Value: Word Document attachment Reference: Google Docs

Workaround – deep copy

Tips & tricks 1 – look in TopCmds.py

Tips & Tricks 2 – text files in exp folder

More info about Python ● Online tutorial at Python website – ● UCS courses – n n ● Download (to use Python outside Topspin) –