Commit 36897f6a authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Rearranged imports and parallel sections

Original: 876e621b1a13aff8df2192d2b733a57a2b9e2663
parent ee142ff7
......@@ -61,12 +61,9 @@ if __name__ == '__main__':
outfile = open(opts.output, "w")
# Imports.
import glob
import functools
import itertools
import sqlite3
from pylal.progress import ProgressBar
from lalinference.bayestar import fits
from lalinference.bayestar import postprocess
......@@ -102,6 +99,13 @@ def process(fitsfilename):
if __name__ == '__main__':
import glob
import functools
import itertools
import pylal.progress
progress = pylal.progress.ProgressBar()
progress.update(-1, 'spawning {0} workers'.format(opts.jobs))
if opts.jobs == 1:
from itertools import imap
startup(dbfilename)
......@@ -109,8 +113,6 @@ if __name__ == '__main__':
import multiprocessing
imap = multiprocessing.Pool(opts.jobs, startup, (dbfilename,)).imap_unordered
progress = ProgressBar()
progress.update(-1, 'obtaining filenames of sky maps')
fitsfilenames = tuple(itertools.chain.from_iterable(glob.iglob(fitsfileglob)
for fitsfileglob in fitsfileglobs))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment