Commits
Sandra M. Castro authored d888ff33b10
1 1 | import os |
2 2 | from taskinit import * |
3 3 | from parallel.parallel_task_helper import ParallelTaskHelper |
4 4 | |
5 5 | def initweights(vis=None,wtmode=None,tsystable=None,gainfield=None,interp=None,spwmap=None,dowtsp=None): |
6 6 | |
7 7 | casalog.origin('initweights') |
8 8 | |
9 9 | # Do the trivial parallelization |
10 - | if ParallelTaskHelper.isParallelMS(vis): |
10 + | if ParallelTaskHelper.isMPIEnabled() and ParallelTaskHelper.isParallelMS(vis): |
11 11 | helper = ParallelTaskHelper('initweights', locals()) |
12 12 | helper.go() |
13 13 | # Write history to MS. |
14 14 | try: |
15 15 | param_names = initweights.func_code.co_varnames[:initweights.func_code.co_argcount] |
16 16 | param_vals = [eval(p) for p in param_names] |
17 17 | casalog.post('Updating the history in the output', 'DEBUG1') |
18 18 | write_history(ms, vis, 'initweights', param_names, |
19 19 | param_vals, casalog) |
20 20 | except Exception, instance: |
40 40 | interp="linear" |
41 41 | # ... and we are asked to do something... |
42 42 | # open without adding anything! |
43 43 | mycb.open(vis,compress=False,addcorr=False,addmodel=False) |
44 44 | mycb.initweights(wtmode=wtmode,dowtsp=dowtsp,tsystable=tsystable,gainfield=gainfield,interp=interp,spwmap=spwmap) |
45 45 | mycb.close() |
46 46 | else: |
47 47 | raise Exception, 'Visibility data set not found - please verify the name' |
48 48 | |
49 49 | # Write history to MS. |
50 - | # When running in parallel, history will be written in the parallel seciton above |
51 - | if ParallelTaskHelper.isMPIClient: |
50 + | # When running in parallel, history will be written in the parallel section above |
51 + | # normal MSs should write the history here |
52 + | if ParallelTaskHelper.isMPIClient(): |
52 53 | try: |
53 54 | param_names = initweights.func_code.co_varnames[:initweights.func_code.co_argcount] |
54 55 | param_vals = [eval(p) for p in param_names] |
55 56 | casalog.post('Updating the history in the output', 'DEBUG1') |
56 57 | write_history(myms, vis, 'initweights', param_names, |
57 58 | param_vals, casalog) |
58 59 | except Exception, instance: |
59 60 | casalog.post("*** Error \'%s\' updating HISTORY" % (instance), |
60 61 | 'WARN') |
61 62 | |