-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut02a.py
More file actions
22 lines (18 loc) · 763 Bytes
/
Copy pathtut02a.py
File metadata and controls
22 lines (18 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import numpy as np
import matplotlib.pyplot as plt
############################################################
#NUMPY TUTORIAL 02(a)
############################################################
#Task: load ZnO.xye and write a function to calculate the area under the
#peaks
#Load data here (as per 01a):
fpath = '/home/tomwood/Documents/Misc/numpy-tutorials/ZnO.xye'
data = np.loadtxt(fpath)
def fig_setup(figsize=(10, 10)):
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(111)
return fig, ax
#Reusing bits of your code from tut01b, write a function that finds the
#maximum peak and the area under said peak within a certain width. The
#output for find_area(data, width=1.5) should be 43.075
#def area_under_biggest_peak(data, width=1.5):