-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecomp_List.py
More file actions
31 lines (26 loc) · 787 Bytes
/
Decomp_List.py
File metadata and controls
31 lines (26 loc) · 787 Bytes
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
# Decomp_List.py
# Produce list for Decompose_Image.py
# Usage: $ python Decomp_List.py <op_dir>
# Where <op_dir> is the output dir for decomposed images
# NOTE: MODIFY THE ls COMMAND EACH TIME!!!
# By Jiachuan Xu, Feb, 23, 2018
import sys, os
# Confirm arguments
if len(sys.argv)!=2:
print("Usage: $ python Decomp_List.py <op_dir>")
exit()
# get current working dir
cwd = os.getcwd()
# list the FITS files, including images and confidence maps
os.system("ls w*.fit > list")
image_list = open("list", 'r')
op_list = open("op_list", 'w')
op_dir = sys.argv[1]
# loop through list
for line in image_list.readlines():
# <input image file> <output dir>
content = "%s/%s %s\n"%(cwd, line[:-1], op_dir)
op_list.write(content)
image_list.close()
op_list.close()
os.system("rm list")