-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaSC_Test_File_Split_Text_Files.py
68 lines (62 loc) · 1.53 KB
/
PaSC_Test_File_Split_Text_Files.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
import os
#import numpy as np
#import matplotlib.pyplot as plt
import sys
str1 = '/scratch365/sbanerj1/PaSC_Old_Vito_Asym/handheld'
c = 0
cnt_img = 1
cnt_file = 1
f1 = open('/scratch365/sbanerj1/PaSC_Old_Vito_Asym/pasc_handheld'+str(cnt_file)+'.txt','w')
for dirpath, dirnames, filenames in os.walk(str1):
for file1 in [f for f in filenames if f.endswith(".jpg")]:
if cnt_img <= 10000:
f1.write(file1+'\n')
cnt_img += 1
c += 1
else:
f1.close()
cnt_file += 1
cnt_img = 1
f1 = open('//scratch365/sbanerj1/PaSC_Old_Vito_Asym/pasc_handheld'+str(cnt_file)+'.txt','w')
f1.write(file1+'\n')
cnt_img += 1
c += 1
print c
f1.close()
'''
str1 = '/scratch365/sbanerj1/PaSC_2DAligned/test'
str2 = '/scratch365/sbanerj1/PaSC_2DAligned/control_testimages_nobaddetections.csv'
f2 = open(str2,'r')
det_list = []
c = 0
for line in f2:
#fl = line.split("/")
fl = line.split("'")
det_list.append(fl[1])
#print fl[1]
c += 1
print c
print det_list[0], det_list[1]
#f1 = open('rand.txt','w')
c = 0
cnt_img = 1
cnt_file = 1
f1 = open('/scratch365/sbanerj1/PaSC_2DAligned/pasc_control'+str(cnt_file)+'.txt','w')
for dirpath, dirnames, filenames in os.walk(str1):
for file1 in [f for f in filenames if f.endswith(".jpg")]:
if file1 in det_list:
if cnt_img <= 10000:
f1.write(file1+'\n')
cnt_img += 1
c += 1
else:
f1.close()
cnt_file += 1
cnt_img = 1
f1 = open('/scratch365/sbanerj1/PaSC_2DAligned/pasc_control'+str(cnt_file)+'.txt','w')
f1.write(file1+'\n')
cnt_img += 1
c += 1
print c
f1.close()
'''