-
Notifications
You must be signed in to change notification settings - Fork 25
/
preamble.py
33 lines (24 loc) · 1.05 KB
/
preamble.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#This is my preamble.py file to set things at the beginning for a Jupyter Notebook.
#
#Include this preamble in Notebook at the begining with "import preamble" for easiness of use and to ensure consistency across all notebooks.
#
# by Xiaofeng Liu, Ph.D., P.E., Penn State University
# This line configures matplotlib to show figures embedded in the notebook,
# instead of opening a new window for each figure. More about that later.
# If you are using an old version of IPython, try using '%pylab inline' instead.
#%matplotlib inline
print("Start to load preamble.")
import numpy as np
from IPython.display import Image
from IPython.core.display import HTML
#the following makes the plot to be inline (within the Notebook).
import matplotlib.pyplot as plt
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('pdf', 'png')
plt.rcParams['savefig.dpi'] = 75
#import libraries
import scipy.integrate as sp_int
import scipy.optimize as sp_opt
from pylab import *
__all__ = ['np', 'plt', 'sp_int', 'sp_opt']
print("Finished loading preamble.")