forked from DL4Jets/DeepJet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlist_writer.py
35 lines (27 loc) · 1013 Bytes
/
list_writer.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
import os
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--train", help="Path to training sample")
parser.add_argument("--test", help="Path to testing sample, if not specified will replace 'train' with 'test' in train path", default=None)
parser.add_argument("--listname", help="'(train/test)_'+listname+'.root'", default="list")
args=parser.parse_args()
if args.test == None:
args.test = args.train.replace("train", "test")
### Write train input list
path = args.train
if path.endswith("/"): path = path[:-1]
f = open('train_'+args.listname+'.txt', 'w')
for i in os.listdir(path):
if not i.endswith("root"): continue
f.write(path+"/"+i+'\n')
f.close()
#path = '/eos/user/a/anovak/test2files/test'
#path = '/eos/user/a/anovak/train_files'
### Write test input list
path = args.test
if path.endswith("/"): path = path[:-1]
f = open('test_'+args.listname+'.txt', 'w')
for i in os.listdir(path):
if not i.endswith("root"): continue
f.write(path+"/"+i+'\n')
f.close()