forked from GalSim-developers/GalSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_batch_first.py
More file actions
43 lines (38 loc) · 1.57 KB
/
Copy pathrun_batch_first.py
File metadata and controls
43 lines (38 loc) · 1.57 KB
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
# Copyright (c) 2012-2026 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions, and the disclaimer given in the accompanying LICENSE
# file.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions, and the disclaimer given in the documentation
# and/or other materials provided with the distribution.
#
import subprocess
import numpy as np
import glob
import os
def run_batch():
if os.path.isdir('outfile') is False:
subprocess.call(["mkdir", 'outfile'])
for fl in glob.glob('outfile/out_1_*'):
os.remove(fl)
file_name = '/nfs/slac/g/ki/ki19/deuce/AEGIS/unzip/seg_ids.txt'
all_seg_ids = np.loadtxt(file_name, delimiter=" ", dtype='S2')
for seg_id in all_seg_ids:
print 'SEG ID ', seg_id
outfile = 'outfile/out_1_{0}.txt'.format(seg_id)
com1 = '/nfs/slac/g/ki/ki19/deuce/AEGIS/AEGIS_catalog_full/'
com2 = 'python get_objects.py --out_path=' + com1
final_args = ['bsub', '-W', '2:40', '-o', outfile, com2]
final_args.append("--seg_id=" + seg_id)
subprocess.call(final_args)
if __name__ == '__main__':
run_batch()