Git Product home page Git Product logo

python-high-performance-second-edition's Introduction

$5 Tech Unlocked 2021!

If you have read this book, please leave a review on Amazon.com. Potential readers can then use your unbiased opinion to help them make purchase decisions. Thank you. The $5 campaign runs from December 15th 2020 to January 13th 2021.

Python High Performance - Second Edition

This is the code repository for Python High Performance - Second Edition, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

Python is a versatile language that has found applications in many industries. The clean syntax, rich standard library, and vast selection of third-party libraries make Python a wildly popular language.

Python High Performance is a practical guide that shows how to leverage the power of both native and third-party Python libraries to build robust applications.

The book explains how to use various profilers to find performance bottlenecks and apply the correct algorithm to fix them. The reader will learn how to effectively use NumPy and Cython to speed up numerical code. The book explains concepts of concurrent programming and how to implement robust and responsive applications using Reactive programming. Readers will learn how to write code for parallel architectures using Tensorflow and Theano, and use a cluster of computers for large-scale computations using technologies such as Dask and PySpark.

By the end of the book, readers will have learned to achieve performance and scale from their Python applications.

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

Chapter 9 does not contain any code.

The code will look like the following:

    def square(x):
    return x * x

    inputs = [0, 1, 2, 3, 4]
    outputs = pool.map(square, inputs)

The software in this book is tested on Python version 3.5 and on Ubuntu version 16.04. However, majority of the examples can also be run on the Windows and Mac OS X operating systems. The recommended way to install Python and the associated libraries is through the Anaconda distribution, which can be downloaded from https://www.continuum.io/downloads, for Linux, Windows, and Mac OS X.

Related Products

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781787282896

python-high-performance-second-edition's People

Contributors

dominicpereira92 avatar jijom avatar packt-itservice avatar packtutkarshr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-high-performance-second-edition's Issues

code problem

Hello, I wrote down the codes like below.. but, this code doesn't run..
What's wrong with this?

---------------- code --------------------

class Particle:
def init(self, x, y, ang_vel):
self.x = x
self.y = y
self.ang_vel = ang_vel

class ParticleSimulator:
def init(self, particles):
self.particles = particles
def evolve(self, dt):
timestep = 0.00001
nsteps = int(dt/timestep) #dt가 어디서 왔을까?
for i in range(nsteps):
for p in self.particles:
norm = (p.x2 + p.y2)**0.5
v_x = -p.y/norm
v_y = p.x/norm
d_x = timestep * p.ang_vel * v_x
d_y = timestep * p.ang_vel * v_y
p.x += d_x
p.y += d_y

from matplotlib import pyplot as plt
from matplotlib import animation

def visualize(simulator):
X = [p.x for p in simulator.particles]
Y = [p.y for p in simulator.particles]

fig = plt.figure()
ax = plt.subplot(111, aspect = 'equal')
line, = ax.plot(X, Y, 'ro')

plt.xlim(-1, 1)
plt.ylim(-1, 1)

def init():
line.set_data([],[])
return line,

def animate(i):
simulator.evolve(0.01)
X = [p.x for p in simulator.particles]
Y = [p.y for p in simulator.particles]

line.set_data(X,Y)
return line,

anim = animation.FuncAnimation(fig, animate, init_func = init, blit = True, interval = 10)
plt.show()

def test_visualize():
particles = [Particle(0.3,0.5,1), Particle(0.0,-0.5,-1), Particle(-0.1,-0.4,3)]
simulator = ParticleSimulator(particles)
visualize(simulator)

if name == 'main':
test_visualize()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.