Book Image

IPython Interactive Computing and Visualization Cookbook - Second Edition

By : Cyrille Rossant
Book Image

IPython Interactive Computing and Visualization Cookbook - Second Edition

By: Cyrille Rossant

Overview of this book

Python is one of the leading open source platforms for data science and numerical computing. IPython and the associated Jupyter Notebook offer efficient interfaces to Python for data analysis and interactive visualization, and they constitute an ideal gateway to the platform. IPython Interactive Computing and Visualization Cookbook, Second Edition contains many ready-to-use, focused recipes for high-performance scientific computing and data analysis, from the latest IPython/Jupyter features to the most advanced tricks, to help you write better and faster code. You will apply these state-of-the-art methods to various real-world examples, illustrating topics in applied mathematics, scientific modeling, and machine learning. The first part of the book covers programming techniques: code quality and reproducibility, code optimization, high-performance computing through just-in-time compilation, parallel computing, and graphics card programming. The second part tackles data science, statistics, machine learning, signal and image processing, dynamical systems, and pure and applied mathematics.
Table of Contents (19 chapters)
IPython Interactive Computing and Visualization CookbookSecond Edition
Contributors
Preface
Index

A typical workflow with Git branching


A distributed version control system such as Git is designed for the complex and nonlinear workflows that are typical in interactive computing and exploratory research. A central concept is branching, which we will discuss in this recipe.

Getting ready

You need to work in a local Git repository for this recipe (see the previous recipe, Learning the basics of the distributed version control system Git).

How to do it...

  1. We go to the myproject repository and we create a new branch named newidea:

    $ pwd
    /home/cyrille/git/cookbook-2nd/chapter02
    $ cd myproject
    $ git branch newidea
    $ git branch
    * master
      newidea
    

    As indicated by the star *, we are still on the master branch.

  2. We switch to the newly-created newidea branch:

    $ git checkout newidea
    Switched to branch 'newidea'
    $ git branch
      Master
    * newidea
    
  3. We make changes to the code, for instance, by creating a new file:

    $ echo "print('new')" > newfile.py
    $ cat newfile.py
    print('new')
    
  4. We add this file to the staging...