-
Notifications
You must be signed in to change notification settings - Fork 0
/
testgod.py
70 lines (64 loc) · 2.42 KB
/
testgod.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import numpy as np
import pandas as pd
import re
import glob
#os.chdir('D:\\temdpp\\dattest\\')
def structure_selection(folderpwd):
folderpwd=folderpwd+'*'
selection=[]
temp_filelist=glob.glob(folderpwd)
empty_df=pd.DataFrame()
for filename in temp_filelist:
print(filename)
fileopen=np.loadtxt(filename)
filename=pd.DataFrame(fileopen)
selection.append(filename)
#data_datDF.to_csv('test.csv',index=False)
for i in range(48,70):
Ang1 =filename[1] <= 85
Ang1_1 = filename[1] >=75
Ang2 = filename[2] <= 93
Ang2_1 =84 <= filename[2]
Ang3 = filename[3] <= 90
Ang3_1 = 82 <= filename[3]
Ang4 = filename[4] <= 92
Ang4_1 = 82 <= filename[4]
a=(i+2)*0.1
b=(i-2)*0.1
dissel = filename[5] <= a
dissel2 = b <= filename[5]
Ang = filename[Ang1 & Ang1_1 & Ang2 & Ang2_1 & Ang3 & Ang3_1 & Ang4 & Ang4_1 & dissel & dissel2]
column_name=range(1,6)
Ang[0]=Ang[0].apply(int)
final_df=Ang.set_index(0)
final_df=final_df[column_name]
print(final_df)
final_df=pd.DataFrame(final_df)
finalcsv=pd.concat([empty_df,final_df],axis=0)
#finalcsv.to_csv('final.csv',index=True)
#finalcsv.to_csv('final.csv',index=True)
return finalcsv
finalcsv=structure_selection('D:\\temdpp\\dattest\\dat\\')
finalcsv.to_csv('D:\\temdpp\\dattest\\final.csv',header=0)
#finalcsv.to_csv('final.csv',index=True)
# data_dat = np.loadtxt('5kcal_angle_00048.dat')
# data_datDF = pd.DataFrame(data_dat)
# data_datDF.to_csv('test.csv',index=False)
# Ang1 =data_datDF[1] <= 85
# Ang1_1 = data_datDF[1] >=75
# Ang2 = data_datDF[2] <= 93
# Ang2_1 =84 <= data_datDF[2]
# Ang3 = data_datDF[3] <= 90
# Ang3_1 = 82 <= data_datDF[3]
# Ang4 = data_datDF[4] <= 92
# Ang4_1 = 82 <= data_datDF[4]
# dissel = data_datDF[5] <=5
# dissel2 = 4.6 <= data_datDF[5]
# Ang = data_datDF[Ang1 & Ang1_1 & Ang2 & Ang2_1 & Ang3 & Ang3_1 & Ang4 & Ang4_1 & dissel & dissel2]
# column_name=range(1,6)
# Ang[0]=Ang[0].apply(int)
# final_df=Ang.set_index(0)
# final_df=final_df[column_name]
# print(final_df)
# final_df.to_csv('final.csv',index=True)