Project

General

Profile

Introduction to Conda and Jupyter notebook » some_material.txt

David CORRE, 10/26/2017 08:16 AM

 
1
# Conda py27
2
conda create -n py27 python=2.7 anaconda
3

    
4
# Export environment
5
conda env export > environment.yml
6

    
7
#write manually a yml environment file
8
name: stats2
9
channels:
10
  - javascript
11
dependencies:
12
  - python=3.4   # or 2.7
13
  - bokeh=0.9.2
14
  - numpy=1.9.*
15
  - nodejs=0.10.*
16
  - flask
17
  - pip:
18
    - Flask-Testing
19

    
20
# Create environment from file
21
conda env create -f environment.yml
22

    
23
# Exemple matplotlib
24
"""
25
Simple demo with multiple subplots.
26
"""
27
import numpy as np
28
import matplotlib.pyplot as plt
29

    
30

    
31
x1 = np.linspace(0.0, 5.0)
32
x2 = np.linspace(0.0, 2.0)
33

    
34
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
35
y2 = np.cos(2 * np.pi * x2)
36

    
37
plt.subplot(2, 1, 1)
38
plt.plot(x1, y1, 'o-')
39
plt.title('A tale of 2 subplots')
40
plt.ylabel('Damped oscillation')
41

    
42
plt.subplot(2, 1, 2)
43
plt.plot(x2, y2, '.-')
44
plt.xlabel('time (s)')
45
plt.ylabel('Undamped')
46

    
47
plt.show()
48

    
49
# Reload import
50
%load_ext autoreload
51
%autoreload 2
52

    
53

    
54
# Load video
55
<iframe width="560" height="315" src="https://www.youtube.com/embed/YJC6ldI3hWk" frameborder="0" allowfullscreen></iframe>
56

    
57

    
58

    
59

    
(2-2/2)