-
Notifications
You must be signed in to change notification settings - Fork 0
/
C185_overtones_histo.py
44 lines (35 loc) · 1.01 KB
/
C185_overtones_histo.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
34
35
36
37
38
39
40
41
42
43
44
import os
import matplotlib.pyplot as plt
import numpy as np
# Define the directory where your files are located
file = 'output4.csv'
# Initialize a list to store the data from the files
data = []
with open(file, 'r') as f:
x = 0
# Read the data from the file and append it to the list
for line in f.readlines():
lines = line.split(',')
#quality_num = int(lines[8]) #lines[9] for output2
#if quality_num < 21:
# continue
try:
peaks = np.array(lines[7])
except:
continue
peaks = str(peaks) # Replace "string" with "str"
peaks = np.array(peaks.split(' '))
for peak in peaks:
try:
peak = float(peak)
except:
continue
print(peak)
data.append(peak)
x += 1
plt.figure()
# Plot the histogram
plt.hist(np.round(data,1),250)
# Add tick marks at every value of 5
plt.xticks(np.arange(15, 250, 5))
plt.show()