Astronomical Data Analysis with Python

Size: px
Start display at page:

Download "Astronomical Data Analysis with Python"

Transcription

1 Astronomical Data Analysis with Python Lecture 8 Yogesh Wadadekar NCRA-TIFR July August 2010 Yogesh Wadadekar (NCRA-TIFR) Topical course 1 / 27

2 Slides available at: yogesh/python_course_2010/ Yogesh Wadadekar (NCRA-TIFR) Topical course 2 / 27

3 Comments on assignment Yogesh Wadadekar (NCRA-TIFR) Topical course 3 / 27

4 SciPy - superset of numpy constants: physical constants and conversion factors (since version 0.7.0[1]) cluster: hierarchical clustering, vector quantization, K-means fftpack: Discrete Fourier Transform algorithms integrate: numerical integration routines interpolate: interpolation tools io: data input and output lib: Python wrappers to external libraries linalg: linear algebra routines misc: miscellaneous utilities (e.g. image reading/writing) optimize: optimization algorithms including linear programming signal: signal processing tools sparse: sparse matrix and related algorithms spatial: KD-trees, nearest neighbors, distance functions Yogesh Wadadekar (NCRA-TIFR) Topical course 4 / 27

5 SciPy special: special functions stats: statistical functions weave: tool for writing C/C++ code as Python multiline strings ndimage: image processing Via RPy, SciPy can interface to the R statistical package R. Yogesh Wadadekar (NCRA-TIFR) Topical course 5 / 27

6 SciPy Cookbook This page hosts worked examples of commonly-done tasks. Some are introductory in nature, while others are quite advanced (these are at the bottom of the page). Yogesh Wadadekar (NCRA-TIFR) Topical course 6 / 27

7 power of matplotlib import numpy as np x, y = np.random.randn(2, ) H, xedges, yedges = np.histogram2d(x, y, bins=50) extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]] imshow(h, extent=extent) Yogesh Wadadekar (NCRA-TIFR) Topical course 7 / 27

8 Three main reasons to extend Python 1 speed. 2 to leverage existing libraries that are not already wrapped. 3 to allow Python programs to access devices at absolute memory addresses, using C functions as an intermediary. If neither of these reasons apply, you can happily code only in Python. Yogesh Wadadekar (NCRA-TIFR) Topical course 8 / 27

9 Questions to answer before trying to extend Python is the compiled language code you need small enough to recode in Python. e.g. a Numerical recipes routine that requires perhaps 3-4 other routines should be easily rewritable in Python. Yogesh Wadadekar (NCRA-TIFR) Topical course 9 / 27

10 Questions to answer before trying to extend Python is the compiled language code you need small enough to recode in Python. e.g. a Numerical recipes routine that requires perhaps 3-4 other routines should be easily rewritable in Python. if the code is large, check whether it already has a Python interface. e.g. LAPACK Yogesh Wadadekar (NCRA-TIFR) Topical course 9 / 27

11 Questions to answer before trying to extend Python is the compiled language code you need small enough to recode in Python. e.g. a Numerical recipes routine that requires perhaps 3-4 other routines should be easily rewritable in Python. if the code is large, check whether it already has a Python interface. e.g. LAPACK if the code in question is in octave, idl, matlab, mathematica and you have a licensed copy of these software, it will be easier to use the interfaces to those languages. Yogesh Wadadekar (NCRA-TIFR) Topical course 9 / 27

12 Questions to answer before trying to extend Python is the compiled language code you need small enough to recode in Python. e.g. a Numerical recipes routine that requires perhaps 3-4 other routines should be easily rewritable in Python. if the code is large, check whether it already has a Python interface. e.g. LAPACK if the code in question is in octave, idl, matlab, mathematica and you have a licensed copy of these software, it will be easier to use the interfaces to those languages. Do you really need to pass arrays or are disk files a good way of exchanging data? Yogesh Wadadekar (NCRA-TIFR) Topical course 9 / 27

13 Questions to answer before trying to extend Python is the compiled language code you need small enough to recode in Python. e.g. a Numerical recipes routine that requires perhaps 3-4 other routines should be easily rewritable in Python. if the code is large, check whether it already has a Python interface. e.g. LAPACK if the code in question is in octave, idl, matlab, mathematica and you have a licensed copy of these software, it will be easier to use the interfaces to those languages. Do you really need to pass arrays or are disk files a good way of exchanging data? It is more efficient to wrap a set of related subroutines rather than just one (or a few). Can you collaborate to do this? Ask on astropy mailing list. Yogesh Wadadekar (NCRA-TIFR) Topical course 9 / 27

14 Numpy C extensions Yogesh Wadadekar (NCRA-TIFR) Topical course 10 / 27

15 SWIG SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages such as Perl, PHP, Python, Tcl, Ruby, C#, Common Lisp (CLISP, Allegro CL, CFFI, UFFI), Java, Lua, Modula-3, OCAML, Octave and R. Also several interpreted and compiled Scheme implementations (Guile, MzScheme, Chicken) are supported. SWIG is most commonly used to create high-level interpreted or compiled programming environments, user interfaces, and as a tool for testing and prototyping C/C++ software. Yogesh Wadadekar (NCRA-TIFR) Topical course 11 / 27

16 The example.c file Yogesh Wadadekar (NCRA-TIFR) Topical course 12 / 27

17 The example.i interface file Now, in order to add these files to your favorite language, you need to write an interface file which is the input to SWIG. An interface file for the C functions we want to wrap is needed. Yogesh Wadadekar (NCRA-TIFR) Topical course 13 / 27

18 Building the module $ swig -python example.i $ gcc -c example.c example_wrap.c -I/usr/include/python2.6 $ ld -shared example.o example_wrap.o -o _example.so Yogesh Wadadekar (NCRA-TIFR) Topical course 14 / 27

19 Dynamic typing gives way to static typing You can use an assert before the function call to the external function. Yogesh Wadadekar (NCRA-TIFR) Topical course 15 / 27

20 F2PY - Fortran to Python interface generator autogenerates interface files to allow Python to call a Fortran subroutine. Yogesh Wadadekar (NCRA-TIFR) Topical course 16 / 27

21 Installing f2py Recent versions of numpy already include f2py. So, if you installed numpy there is nothing more to do. Yogesh Wadadekar (NCRA-TIFR) Topical course 17 / 27

22 The Hello example C File hello.f subroutine foo (a) integer a print*, "Hello from Fortran!" print*, "a=",a end Of course, there may be multiple subroutines in hello.f, all of which will get wrapped in one go. Yogesh Wadadekar (NCRA-TIFR) Topical course 18 / 27

23 Build the module $ f2py -c -m hello hello.f doc are autocreated. Yogesh Wadadekar (NCRA-TIFR) Topical course 19 / 27

24 A more complicated example - fib3.f Calculate the first n Fibbonacci numbers. Yogesh Wadadekar (NCRA-TIFR) Topical course 20 / 27

25 If you can t edit the Fortran code you can work with signature files which are like the interface files in C. Yogesh Wadadekar (NCRA-TIFR) Topical course 21 / 27

26 Features of f2py F2PY automatically generates doc strings (and optionally LaTeX documentation) for extension modules. F2PY generated functions accept arbitrary (but sensible) Python objects as arguments. The F2PY interface automatically takes care of type-casting. most Fortran 90 features also work. Pyfort, a competitor to f2py is not as feature rich Yogesh Wadadekar (NCRA-TIFR) Topical course 22 / 27

27 Attributes and statements of f2py intent([ in inout out hide in,out inout,out c copy cache callback inplace aux ]) dimension(<dimspec>) common, parameter allocatable optional, required, external depend([<names>]) check([<c-booleanexpr>]) note(<latex text>) usercode, callstatement, callprotoargument, threadsafe, fortranname pymethoddef entry Yogesh Wadadekar (NCRA-TIFR) Topical course 23 / 27

28 Other options for extending Python SIP: lighter version of SWIG. Only works with C/C++. Originally written for PyQt ctypes: no interface code needed, can directly call compiled functions in a binary library file. Some features work only on Windows. Boost.python: good for wrapping entire libraries in C or C++ Pyrex: is a Python like language designed for writing Python extension modules. Almost any Python code is valid Pyrex code. Yogesh Wadadekar (NCRA-TIFR) Topical course 24 / 27

29 Extending Python to Java and C# Java: Jython is an implementation of Python for the JVM. Jython takes the Python programming language syntax and enables it to run on the Java platform. This allows seamless integration with the use of Java libraries and other Java-based applications. But CPython extensions don t work. C# - IronPython is an implementation of the Python programming language running under.net and Silverlight Yogesh Wadadekar (NCRA-TIFR) Topical course 25 / 27

30 My recommendations see if numpy C extensions will do the job for you. if you use Fortran (any flavour), use f2py. If you need to write fresh code (for speedy execution), write in Fortran and wrap with f2py. For C/C++ use SWIG or may SIP For Java - use Jython, for C# use IronPython For all other languages, SWIG is the richest option and please don t forget regression tests. Yogesh Wadadekar (NCRA-TIFR) Topical course 26 / 27

31 Feel free to contact me for any teething problems... Yogesh Wadadekar (NCRA-TIFR) Topical course 27 / 27

operator overloading algorithmic differentiation the class DifferentialNumber operator overloading

operator overloading algorithmic differentiation the class DifferentialNumber operator overloading operator overloading 1 Computing with Differential Numbers algorithmic differentiation the class DifferentialNumber operator overloading 2 Computing with Double Doubles the class DoubleDouble defining

More information

Python Scripting for Computational Science

Python Scripting for Computational Science Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures 43 Springer Table of Contents 1 Introduction... 1 1.1 Scripting versus Traditional Programming... 1 1.1.1

More information

C - extensions. only a small part of application benefits from compiled code

C - extensions. only a small part of application benefits from compiled code C - EXTENSIONS C - extensions Some times there are time critical parts of code which would benefit from compiled language 90/10 rule: 90 % of time is spent in 10 % of code only a small part of application

More information

Python Scripting for Computational Science

Python Scripting for Computational Science Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures Sprin ger Table of Contents 1 Introduction 1 1.1 Scripting versus Traditional Programming 1 1.1.1 Why Scripting

More information

Python where we can, C ++ where we must

Python where we can, C ++ where we must Python where we can, C ++ where we must Source: http://xkcd.com/353/ Guy K. Kloss Python where we can,c++ where we must 1/28 Python where we can, C ++ where we must Guy K. Kloss BarCamp Auckland 2007 15

More information

Introduction to Scripting Languages. October 2017

Introduction to Scripting Languages. October 2017 Introduction to Scripting Languages damien.francois@uclouvain.be October 2017 1 Goal of this session: Advocate the use of scripting languages and help you choose the most suitable for your needs 2 Agenda

More information

Scientific Computing Using. Atriya Sen

Scientific Computing Using. Atriya Sen Scientific Computing Using Atriya Sen Broad Outline Part I, in which I discuss several aspects of the Python programming language Part II, in which I talk about some Python modules for scientific computing

More information

Mixed language programming

Mixed language programming Mixed language programming Simon Funke 1,2 Ola Skavhaug 3 Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Dept. of Informatics, University of

More information

Simplified Wrapper Interface Generator

Simplified Wrapper Interface Generator Simplified Wrapper Interface Generator (aka SWIG) Michel.Caillat@obspm.fr 1 Definition SWIG is a software development tool. It generates the code needed to bind C/C++ functions, classes, methods etc with

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

FORTRAN TO PYTHON INTERFACE GENERATOR WITH AN APPLICATION TO AEROSPACE ENGINEERING

FORTRAN TO PYTHON INTERFACE GENERATOR WITH AN APPLICATION TO AEROSPACE ENGINEERING FORTRAN TO PYTHON INTERFACE GENERATOR WITH AN APPLICATION TO AEROSPACE ENGINEERING Pearu Peterson Joaquim R. R. A. Martins Juan J. Alonso Institute of Cybernetics at TTU Estonia Dept. of Aeronautics and

More information

Python, C, C++, and Fortran Relationship Status: It s Not That Complicated. Philip Semanchuk

Python, C, C++, and Fortran Relationship Status: It s Not That Complicated. Philip Semanchuk Python, C, C++, and Fortran Relationship Status: It s Not That Complicated Philip Semanchuk (philip@pyspoken.com) This presentation is part of a talk I gave at PyData Carolinas 2016. This presentation

More information

The G3 F2PY for connecting Python to Fortran 90 programs

The G3 F2PY for connecting Python to Fortran 90 programs The G3 F2PY for connecting Python to Fortran 90 programs Pearu Peterson pearu@simula.no F2PY What is it? Example. What more it can do? What it cannot do? G3 F2PY The 3rd generation of F2PY. Aims and status.

More information

Getting along and working together. Fortran-Python Interoperability Jacob Wilkins

Getting along and working together. Fortran-Python Interoperability Jacob Wilkins Getting along and working together Fortran-Python Interoperability Jacob Wilkins Fortran AND Python working together? Fortran-Python May 2017 2/19 Two very different philosophies Two very different code-styles

More information

Introduction to Python. Didzis Gosko

Introduction to Python. Didzis Gosko Introduction to Python Didzis Gosko Scripting language From Wikipedia: A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment

More information

Driving and Extending Legacy Codes using Python

Driving and Extending Legacy Codes using Python Driving and Extending Legacy Codes using Python Neilen Marais and David B. Davidson Department of Electrical and Electronic Engineering University of Stellenbosch, South Africa nmarais@gmail.com, davidson@sun.ac.za

More information

Universitetet i Oslo Institutt for informatikk. Scripting in High-Performance Computing. Roger Hansen. Cand Scient Thesis

Universitetet i Oslo Institutt for informatikk. Scripting in High-Performance Computing. Roger Hansen. Cand Scient Thesis Universitetet i Oslo Institutt for informatikk Scripting in High-Performance Computing Roger Hansen Cand Scient Thesis August, 2001 Abstract This thesis describes how the use of more than one type of

More information

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory SCRIPTING Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Reflection Bindings Serialization Performance, memory Rationale C++ isn't the best choice

More information

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Scripting 1 Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Rationale C++ isn't the best choice for all problems Complicated feature set, syntax Low-level,

More information

F2PY Users Guide and Reference Manual

F2PY Users Guide and Reference Manual F2PY Users Guide and Reference Manual Author: Pearu Peterson Contact: pearu@cens.ioc.ee Web site: http://cens.ioc.ee/projects/f2py2e/ Date: 2005-01-30 Revision: 1.25 1 Introduction 2 Three ways to wrap

More information

LECTURE 19. Numerical and Scientific Packages

LECTURE 19. Numerical and Scientific Packages LECTURE 19 Numerical and Scientific Packages NUMERICAL AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that

More information

Part VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10,

Part VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10, Part VI Scientific Computing in Python Compact Course @ Max-PlanckMarch 6-10, 2017 63 Doing maths in Python Standard sequence types (list, tuple,... ) Can be used as arrays Can contain different types

More information

Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros

Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros In the beginning (ENIAC) Evolution Evolution Evolution Introduction The SunPy project is an effort to create an opensource software library

More information

LECTURE 22. Numerical and Scientific Packages

LECTURE 22. Numerical and Scientific Packages LECTURE 22 Numerical and Scientific Packages NUMERIC AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that extend

More information

Advanced and Parallel Python

Advanced and Parallel Python Advanced and Parallel Python December 1st, 2016 http://tinyurl.com/cq-advanced-python-20161201 By: Bart Oldeman and Pier-Luc St-Onge 1 Financial Partners 2 Setup for the workshop 1. Get a user ID and password

More information

ctypes extending python was never easier! Anant Narayanan Malaviya National Institute of Technology

ctypes extending python was never easier! Anant Narayanan Malaviya National Institute of Technology C! ctypes extending python was never easier! Anant Narayanan Malaviya National Institute of Technology So what is python? Dynamically typed, interpreted language Allows for fast prototyping, thanks to

More information

NAG at Manchester. Michael Croucher (University of Manchester)

NAG at Manchester. Michael Croucher (University of Manchester) NAG at Manchester Michael Croucher (University of Manchester) Michael.Croucher@manchester.ac.uk www.walkingrandomly.com Twitter: @walkingrandomly My background PhD Computational Physics from Sheffield

More information

NumPy and SciPy. Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center Pittsburgh Supercomputing Center

NumPy and SciPy. Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center Pittsburgh Supercomputing Center NumPy and SciPy Shawn T. Brown Director of Public Health Applications Pittsburgh Supercomputing Center 2012 Pittsburgh Supercomputing Center What are NumPy and SciPy NumPy and SciPy are open-source add-on

More information

Day 15: Science Code in Python

Day 15: Science Code in Python Day 15: Science Code in Python 1 Turn In Homework 2 Homework Review 3 Science Code in Python? 4 Custom Code vs. Off-the-Shelf Trade-offs Costs (your time vs. your $$$) Your time (coding vs. learning) Control

More information

Compiler Design Spring 2018

Compiler Design Spring 2018 Compiler Design Spring 2018 Thomas R. Gross Computer Science Department ETH Zurich, Switzerland 1 Logistics Lecture Tuesdays: 10:15 11:55 Thursdays: 10:15 -- 11:55 In ETF E1 Recitation Announced later

More information

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics Computer Organization Computer Basics TOPICS Computer Organization Data Representation Program Execution Computer Languages 1 2 Architecture Computer Organization n central-processing unit n performs the

More information

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python AMath 483/583 Lecture 27 May 27, 2011 Today: Python exception handling Python plus Fortran: f2py Next week: More Python plus Fortran Visualization Parallel IPython Read: Class notes and references If you

More information

Grad Refresher Series Python. Marius Muja September 28, 2011

Grad Refresher Series Python. Marius Muja September 28, 2011 Grad Refresher Series 2011 Python Marius Muja mariusm@cs.ubc.ca September 28, 2011 The Python Programming Language Interpreted - but can have modules written in C/C++ Dynamically, strongly typed dynamically

More information

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007 Course Web Site http://www.nps.navy.mil/cs/facultypages/squire/cs2900 All course related materials will be posted

More information

Introduction to the Julia language. Marc Fuentes - SED Bordeaux

Introduction to the Julia language. Marc Fuentes - SED Bordeaux Introduction to the Julia language Marc Fuentes - SED Bordeaux Outline 1 motivations Outline 1 motivations 2 Julia as a numerical language Outline 1 motivations 2 Julia as a numerical language 3 types

More information

Part VI. Scientific Computing in Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part VI. Scientific Computing in Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part VI Scientific Computing in Python Compact Course @ Max-Planck, February 16-26, 2015 81 More on Maths Module math Constants pi and e Functions that operate on int and float All return values float

More information

The Python Programming Language

The Python Programming Language Python Marius Muja The Python Programming Language Interpreted - but can have modules written in C/C++ Dynamically but strongly typed dynamically typed - no need to declare variable types strongly typed

More information

Fortran to Python Interface Generator with an application to Aerospace Engineering

Fortran to Python Interface Generator with an application to Aerospace Engineering Fortran to Python Interface Generator with an application to Aerospace Engineering Pearu Peterson Center of Nonlinear Studies Institute of Cybernetics at TTU Akadeemia Rd 21, 12618

More information

Mixed language programming with NumPy arrays

Mixed language programming with NumPy arrays Mixed language programming with NumPy arrays Simon Funke 1,2 Ola Skavhaug 3 Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Dept. of Informatics,

More information

Scripted Components: Problem. Scripted Components. Problems with Components. Single-Language Assumption. Dr. James A. Bednar

Scripted Components: Problem. Scripted Components. Problems with Components. Single-Language Assumption. Dr. James A. Bednar Scripted Components: Problem Scripted Components Dr. James A. Bednar jbednar@inf.ed.ac.uk http://homepages.inf.ed.ac.uk/jbednar (Cf. Reuse-Oriented Development; Sommerville 2004 Chapter 4, 18) A longstanding

More information

Scripted Components Dr. James A. Bednar

Scripted Components Dr. James A. Bednar Scripted Components Dr. James A. Bednar jbednar@inf.ed.ac.uk http://homepages.inf.ed.ac.uk/jbednar SAPM Spring 2012: Scripted Components 1 Scripted Components: Problem (Cf. Reuse-Oriented Development;

More information

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics Basic Python K. 1 1 Department of Mathematics 2018 Python Guido van Rossum 1994 Original Python was developed to version 2.7 2010 2.7 continues to receive maintenance New Python 3.x 2008 The 3.x version

More information

Physics 514 Basic Python Intro

Physics 514 Basic Python Intro Physics 514 Basic Python Intro Emanuel Gull September 8, 2014 1 Python Introduction Download and install python. On Linux this will be done with apt-get, evince, portage, yast, or any other package manager.

More information

Chapter 11 Introduction to Programming in C

Chapter 11 Introduction to Programming in C Chapter 11 Introduction to Programming in C C: A High-Level Language Gives symbolic names for containers of values don t need to know which register or memory location Provides abstraction of underlying

More information

The Data Conditioning API s baseline requirements

The Data Conditioning API s baseline requirements LASER INTERFEROMETER GRAVITATIONAL WAVE OBSERVATORY - LIGO - CALIFORNIA INSTITUTE OF TECHNOLOGY MASSACHUSETTS INSTITUTE OF TECHNOLOGY Document Type LIGO-T990002-00- E 02/10/1999 The Data Conditioning API

More information

oascript HowTo Kevin Nesmith Lead Engineer, Si2 June 10, 2013

oascript HowTo Kevin Nesmith Lead Engineer, Si2 June 10, 2013 oascript HowTo Kevin Nesmith Lead Engineer, Si2 June 10, 2013 1 oascript News Chip Designer Centric Python API Tcl API Ruby API Perl API Language-Specific Bindings Type Mapping Type Mapping Type Mapping

More information

Adv. Course in Programming Languages

Adv. Course in Programming Languages Department of Computer Science, University of Tsukuba No.3 How to write Code Generator for Power? In your favorite programming language!! C, C++ (with template), C# Fortran Lisp, Scheme, Clojure Java,

More information

Type Inference. Prof. Clarkson Fall Today s music: Cool, Calm, and Collected by The Rolling Stones

Type Inference. Prof. Clarkson Fall Today s music: Cool, Calm, and Collected by The Rolling Stones Type Inference Prof. Clarkson Fall 2016 Today s music: Cool, Calm, and Collected by The Rolling Stones Review Previously in 3110: Interpreters: ASTs, evaluation, parsing Formal syntax Formal semantics

More information

Outline. S: past, present and future Some thoughts. The 80s. Interfaces - 60s & 70s. Duncan Temple Lang Department of Statistics UC Davis

Outline. S: past, present and future Some thoughts. The 80s. Interfaces - 60s & 70s. Duncan Temple Lang Department of Statistics UC Davis S: past, present and future Some thoughts Duncan Temple Lang Department of Statistics UC Davis Outline Good idea that was either taken up or missed. Interfaces Thoughts on how S evolved and what implications

More information

Extensions in C and Fortran

Extensions in C and Fortran Extensions in C and Fortran Why? C and Fortran are compiled languages Source code is translated to machine instructons by the compiler before you run. Ex: gfortran -o mycode mycode.f90 gcc -o mycode mycode.c

More information

c++ and python modern programming techniques

c++ and python modern programming techniques c++ and python modern programming techniques Jakša Vučičević IPB, Tuesday, February 28 th, 2017 Outline Introduction to Python, Java and C++ programming paradigms compilation model Template programming

More information

Scientific Computing: Lecture 1

Scientific Computing: Lecture 1 Scientific Computing: Lecture 1 Introduction to course, syllabus, software Getting started Enthought Canopy, TextWrangler editor, python environment, ipython, unix shell Data structures in Python Integers,

More information

Cosmology with python: Beginner to Advanced in one week. Tiago Batalha de Castro

Cosmology with python: Beginner to Advanced in one week. Tiago Batalha de Castro Cosmology with python: Beginner to Advanced in one week Tiago Batalha de Castro What is Python? (From python.org) Python is an interpreted, object-oriented, high-level programming language with dynamic

More information

Scientific Computing with Python and CUDA

Scientific Computing with Python and CUDA Scientific Computing with Python and CUDA Stefan Reiterer High Performance Computing Seminar, January 17 2011 Stefan Reiterer () Scientific Computing with Python and CUDA HPC Seminar 1 / 55 Inhalt 1 A

More information

pandas: Rich Data Analysis Tools for Quant Finance

pandas: Rich Data Analysis Tools for Quant Finance pandas: Rich Data Analysis Tools for Quant Finance Wes McKinney April 24, 2012, QWAFAFEW Boston about me MIT 07 AQR Capital: 2007-2010 Global Macro and Credit Research WES MCKINNEY pandas: 2008 - Present

More information

The MPI API s baseline requirements

The MPI API s baseline requirements LASER INTERFEROMETER GRAVITATIONAL WAVE OBSERVATORY - LIGO - CALIFORNIA INSTITUTE OF TECHNOLOGY MASSACHUSETTS INSTITUTE OF TECHNOLOGY Document Type LIGO-T990086-01- E 01/26/2000 The MPI API s baseline

More information

The MPI API s baseline requirements

The MPI API s baseline requirements LASER INTERFEROMETER GRAVITATIONAL WAVE OBSERVATORY - LIGO - CALIFORNIA INSTITUTE OF TECHNOLOGY MASSACHUSETTS INSTITUTE OF TECHNOLOGY Document Type LIGO-T990086-00- E 09/14/1999 The MPI API s baseline

More information

Python for Scientific Computing. Eric Jones

Python for Scientific Computing. Eric Jones Python for Scientific Computing Eric Jones Language Popularity (as rated by TIOBE*) * * www.tiobe.com Language Popularity (as rated by TIOBE*) * * www.tiobe.com Language Popularity (as rated by TIOBE*)

More information

Introduction to Python for Scientific Computing

Introduction to Python for Scientific Computing 1 Introduction to Python for Scientific Computing http://tinyurl.com/cq-intro-python-20151022 By: Bart Oldeman, Calcul Québec McGill HPC Bart.Oldeman@calculquebec.ca, Bart.Oldeman@mcgill.ca Partners and

More information

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG) SKILL AREA 304: Review Programming Language Concept Computer Programming (YPG) 304.1 Demonstrate an Understanding of Basic of Programming Language 304.1.1 Explain the purpose of computer program 304.1.2

More information

Python for C programmers

Python for C programmers Python for C programmers The basics of Python are fairly simple to learn, if you already know how another structured language (like C) works. So we will walk through these basics here. This is only intended

More information

LECTURE 17. Expressions and Assignment

LECTURE 17. Expressions and Assignment LECTURE 17 Expressions and Assignment EXPRESSION SYNTAX An expression consists of An atomic object, e.g. number or variable. An operator (or function) applied to a collection of operands (or arguments)

More information

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software. Hardware and Software Computer Basics TOPICS Computer Organization Data Representation Program Execution Computer Languages Computer systems consist of hardware and software. Hardware includes the tangible

More information

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017

CS Introduction to Computational and Data Science. Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 CS 133 - Introduction to Computational and Data Science Instructor: Renzhi Cao Computer Science Department Pacific Lutheran University Spring 2017 Previous class We have learned the path and file system.

More information

Command Line and Python Introduction. Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016

Command Line and Python Introduction. Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016 Command Line and Python Introduction Jennifer Helsby, Eric Potash Computation for Public Policy Lecture 2: January 7, 2016 Today Assignment #1! Computer architecture Basic command line skills Python fundamentals

More information

The Shogun Machine Learning Toolbox

The Shogun Machine Learning Toolbox The Shogun Machine Learning Toolbox heiko.strathmann@gmail.com Europython 2014 July 24, 2014 Outline Overview Machine Learning Features Technical Features Community A bit about me Heiko Strathmann - http://herrstrathmann.de/

More information

An Introduction to F2Py

An Introduction to F2Py An Introduction to Jules Kouatchou, Hamid Oloso and Mike Rilee Jules.Kouatchou@nasa.gov, Amidu.O.Oloso@nasa.gov and Michael.Rilee@nasa.gov Goddard Space Flight Center Software System Support Office Code

More information

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented Course Goal CMSC 330: Organization of Programming Languages Introduction Learn how programming languages work Broaden your language horizons! Different programming languages! Different language features

More information

Python on GACRC Computing Resources

Python on GACRC Computing Resources Python on GACRC Computing Resources Georgia Advanced Computing Resource Center EITS/University of Georgia Zhuofei Hou, zhuofei@uga.edu 1 Outline GACRC Python Overview Python on Clusters Python Packages

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 1: Class overview. Cristina Nita-Rotaru Lecture 1/ Fall 2013 1 WELCOME to CS240 Cristina Nita-Rotaru Lecture 1/ Fall 2013 2 240 Team Instructor: Cristina Nita-Rotaru Special

More information

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C Final Review CS304 Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation

More information

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen

Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems. Tommi Tervonen Programming (ERIM) Lecture 1: Introduction to programming paradigms and typing systems Tommi Tervonen Econometric Institute, Erasmus School of Economics Course learning objectives After this course, you

More information

Python Optimization and Integration

Python Optimization and Integration [Software Development] Python Optimization and Integration Davide Balzarotti Eurecom Sophia Antipolis, France 1 When Python is not Enough Python is great for rapid application development Many famous examples...

More information

KSTAR tokamak. /

KSTAR tokamak. / KSTAR tokamak / spinhalf@nfri.re.kr !!! Data parallelism CUDA programming python! pycuda GPU Development tools Python 2.6+ Scientific libraries as python package for interactive computing (Numpy, Scipy..)

More information

Lecture 7: Binding Time and Storage

Lecture 7: Binding Time and Storage Lecture 7: Binding Time and Storage COMP 524 Programming Language Concepts Stephen Olivier February 5, 2009 Based on notes by A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts Goal of Lecture The

More information

The MPI API s baseline requirements

The MPI API s baseline requirements LASER INTERFEROMETER GRAVITATIONAL WAVE OBSERVATORY - LIGO - CALIFORNIA INSTITUTE OF TECHNOLOGY MASSACHUSETTS INSTITUTE OF TECHNOLOGY Document Type LIGO-T990086-07- E 10/30/2000 The MPI API s baseline

More information

PyPy - How to not write Virtual Machines for Dynamic Languages

PyPy - How to not write Virtual Machines for Dynamic Languages PyPy - How to not write Virtual Machines for Dynamic Languages Institut für Informatik Heinrich-Heine-Universität Düsseldorf ESUG 2007 Scope This talk is about: implementing dynamic languages (with a focus

More information

Teaching numerical methods : a first experience. Ronojoy Adhikari The Institute of Mathematical Sciences Chennai.

Teaching numerical methods : a first experience. Ronojoy Adhikari The Institute of Mathematical Sciences Chennai. Teaching numerical methods : a first experience Ronojoy Adhikari The Institute of Mathematical Sciences Chennai. Numerical Methods : the first class 14 students, spread across second and third years of

More information

Software II: Principles of Programming Languages. Why Expressions?

Software II: Principles of Programming Languages. Why Expressions? Software II: Principles of Programming Languages Lecture 7 Expressions and Assignment Statements Why Expressions? Expressions are the fundamental means of specifying computations in a programming language

More information

EL2310 Scientific Programming

EL2310 Scientific Programming Lecture 6: Introduction to C (pronobis@kth.se) Overview Overview Lecture 6: Introduction to C Roots of C Getting started with C Closer look at Hello World Programming Environment Schedule Last time (and

More information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-49362-1 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

The Frame API s baseline requirements

The Frame API s baseline requirements LASER INTERFEROMETER GRAVITATIONAL WAVE OBSERVATORY - LIGO - CALIFORNIA INSTITUTE OF TECHNOLOGY MASSACHUSETTS INSTITUTE OF TECHNOLOGY Document Type LIGO-T980117-00- E 12/4/1998 The Frame API s baseline

More information

Programming. Dr Ben Dudson University of York

Programming. Dr Ben Dudson University of York Programming Dr Ben Dudson University of York Outline Last lecture covered the basics of programming and IDL This lecture will cover More advanced IDL and plotting Fortran and C++ Programming techniques

More information

System Design S.CS301

System Design S.CS301 System Design S.CS301 (Autumn 2015/16) Page 1 Agenda Contents: Course overview Reading materials What is the MATLAB? MATLAB system History of MATLAB License of MATLAB Release history Syntax of MATLAB (Autumn

More information

Getting Started with Java. Atul Prakash

Getting Started with Java. Atul Prakash Getting Started with Java Atul Prakash Running Programs C++, Fortran, Pascal Python, PHP, Ruby, Perl Java is compiled into device-independent code and then interpreted Source code (.java) is compiled into

More information

1 Week 1: Basics of scientific programming I

1 Week 1: Basics of scientific programming I MTH739N/P/U: Topics in Scientific Computing Autumn 2016 1 Week 1: Basics of scientific programming I 1.1 Introduction The aim of this course is use computing software platforms to solve scientific and

More information

https://lambda.mines.edu Evaluating programming languages based on: Writability: How easy is it to write good code? Readability: How easy is it to read well written code? Is the language easy enough to

More information

Topic 9: Type Checking

Topic 9: Type Checking Recommended Exercises and Readings Topic 9: Type Checking From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6 and

More information

Topic 9: Type Checking

Topic 9: Type Checking Topic 9: Type Checking 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6

More information

Chapter 7. Expressions and Assignment Statements

Chapter 7. Expressions and Assignment Statements Chapter 7 Expressions and Assignment Statements Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit Evaluation Assignment

More information

The Python Scripting Language. Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service

The Python Scripting Language. Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service The Python Scripting Language Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service 1 Why Python? e-science interviews basic programming skills easy access

More information

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction

Lecture content. Course goals. Course Introduction. TDDA69 Data and Program Structure Introduction Lecture content TDDA69 Data and Program Structure Introduction Cyrille Berger Course Introduction to the different Programming Paradigm The different programming paradigm Why different paradigms? Introduction

More information

Computer Science 102. Into to Computational Modeling Special Topics: Programming in Matlab

Computer Science 102. Into to Computational Modeling Special Topics: Programming in Matlab Computer Science 102 Into to Computational Modeling Special Topics: Programming in Matlab Matlab An integrated programming and graphical environment Interpreted : interactive; get answer immediately Also

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Aapo Nummenmaa, PhD Athinoula A. Martinos Center for Biomedical Imaging, Massachusetts General Hospital, Harvard Medical School, Boston Background Overview! What is MATLAB?! MATLAB=(MATrix

More information

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software. Hardware and Software Computer Basics TOPICS Computer Organization Data Representation Program Execution Computer Languages Computer systems consist of hardware and software. Hardware includes the tangible

More information

CS263: Runtime Systems Lecture: High-level language virtual machines

CS263: Runtime Systems Lecture: High-level language virtual machines CS263: Runtime Systems Lecture: High-level language virtual machines Today: A Review of Object-oriented features Chandra Krintz UCSB Computer Science Department Virtual machines (VMs) Terminology Aka managed

More information

Scientific computing platforms at PGI / JCNS

Scientific computing platforms at PGI / JCNS Member of the Helmholtz Association Scientific computing platforms at PGI / JCNS PGI-1 / IAS-1 Scientific Visualization Workshop Josef Heinen Outline Introduction Python distributions The SciPy stack Julia

More information

CHAPTER 1 Introduction to Computers and Java

CHAPTER 1 Introduction to Computers and Java CHAPTER 1 Introduction to Computers and Java Copyright 2016 Pearson Education, Inc., Hoboken NJ Chapter Topics Chapter 1 discusses the following main topics: Why Program? Computer Systems: Hardware and

More information

Introduction to Fortran Programming. -Internal subprograms (1)-

Introduction to Fortran Programming. -Internal subprograms (1)- Introduction to Fortran Programming -Internal subprograms (1)- Subprograms Subprograms are used to split the program into separate smaller units. Internal subprogram is not an independent part of a program.

More information

Introduction to Python

Introduction to Python Introduction to Python Dr. Hans van der Kwast Senior Lecturer in Ecohydrological Modelling IHE Delft Institute for Water Education h.vanderkwast@un-ihe.org Schedule Monday Install software DOS and GDAL

More information