-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelen_Fmax.py
42 lines (32 loc) · 998 Bytes
/
Selen_Fmax.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 12 20:37:56 2021
@author: selenm
"""
import glob
import os
#import numpy as np
import matplotlib.pyplot as plt
os.chdir(r'/Users/selenm/Documents/Python_test/Selen_Manioglu_CodeClinic_File/F_vs_t_curves')
myFiles = sorted(glob.glob('*.txt'))
#print(myFiles)
f=open(myFiles[0],"r")
lines=f.readlines()
F=[]
t=[]
for x in lines[1:]:
t.append(float(x.split('\t')[0]))
F.append(float(x.split('\t')[1]))
f.close()
max_value = max(F)
max_index = F.index(max_value)+1
print ('The maximum F value is '+str(max_value)+' pN and its index is '+str(max_index)+'.')
print ('The time value at maximum F value is '+str(t[max_index])+' ms.')
#The maximum F value is 149.9152 pN and its index is 127.
#The time value at maximum F value is 0.9921881 ms.
plt.plot(t,F) #Plotting F vs t curve
plt.plot(t[max_index],max_value, marker='D', markersize=5, color="red")
plt.xlabel('t (ms)')
plt.ylabel('F (pN)')
plt.show()