Top Banner
Python: Part 4 Daniel Lucio Python Crash Course April 13, 2016
17

Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Jul 08, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python: Part 4Daniel Lucio

Python Crash CourseApril 13, 2016

Page 2: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Packages and Modules

A module is a file containing Python definitions, functions, classes and statements.

A package is simply a collection of modules organized in a directory

Page 3: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Packages and ModulesGeometry

Area

Volume

Rectangle

Circle

Cube

Sphere

http://www.slideshare.net/p3infotech_solutions/python-programming-essentials-m18-modules-and-packages

Page 4: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course http://python-packaging-user-guide.readthedocs.org/en/latest/pip_easy_install/

Page 5: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course http://python-packaging-user-guide.readthedocs.org/en/latest/installing/

$pip3installmatplotlib

$pip3install-Upip

$pip3install-Unumpy

OnWindowspython-mpipinstall-Upipsetuptools

How to install packages?

Page 6: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Package for Scientific Computing with Python

http://www.numpy.org/

Page 7: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Numpy Tutorial

https://docs.scipy.org/doc/numpy-dev/user/quickstart.html

Page 8: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Plotting library for Python

http://matplotlib.org/index.html

Page 9: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Pyplot Tutorial

http://matplotlib.org/users/pyplot_tutorial.html

Page 10: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Pyplot

http://matplotlib.org/api/pyplot_summary.html

Page 11: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Pyplot Tutorial

http://matplotlib.org/users/pyplot_tutorial.html

Page 12: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Plot from a file

import pylabdata= pylab.loadtxt('input.txt')pylab.plot (data[:,0], data[:,1])pylab.show()

$ cat > input.txt1 23 45 67 8

Page 13: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

The SciPy ecosystem

http://scipy.org/

Page 14: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

SciPy - Core packages

http://scipy.org/

• Python, a general purpose programming language. It is interpreted and dynamically typed and is very suited for interactive work and quick prototyping, while being powerful enough to write large applications in.

• NumPy, the fundamental package for numerical computation. It defines the numerical array and matrix types and basic operations on them.

• The SciPy library, a collection of numerical algorithms and domain-specific toolboxes, including signal processing, optimization, statistics and much more.

• Matplotlib, a mature and popular plotting package, that provides publication-quality 2D plotting as well as rudimentary 3D plotting

• pandas, providing high-performance, easy to use data structures.• SymPy, for symbolic mathematics and computer algebra.• IPython, a rich interactive interface, letting you quickly process data and test

ideas. The IPython notebook works in your web browser, allowing you to document your computation in an easily reproducible form.

• nose, a framework for testing Python code.

Page 15: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

SciPy - Other packages

http://scipy.org/

• Chaco is another Python plotting toolkit designed from the ground up to be great for embedded, interactive plotting. It is built on Traits, both are part of the Enthought Tool Suite.

• Mayavi is a powerful and user-friendly framework for 3D visualization, built on top of the award winning Visualization Toolkit, VTK.

• Cython extends Python syntax so that you can conveniently build C extensions, either to speed up critical code, or to integrate with C/C++ libraries.

• Scikits are extra packages for more specific functionality. scikit-image and scikit-learn are two of the most prominent.

• h5py and PyTables can both access data stored in the HDF5 format.

Page 16: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

Questions?

Page 17: Python: Part 4 - nics.tennessee.eduPython Crash Course Packages and Modules A module is a file containing Python definitions, functions, classes and statements. A package is simply

Python Crash Course

More informationPython Crash Course: A Hands-On, Project-

Based Introduction to ProgrammingEric Matthes

A Primer on Scientific Programming with Python

Hans Petter Langtangen

Python for Data Science For Dummies John Paul Mueller , Luca Massaron