Commits

consistent error (except) handling, task sdsmooth, CAS-13125, CAS-13018
No tags

casa5/gcwrap/python/scripts/task_sdsmooth.py

Modified
24 24 field=None, spw=None, timerange=None, scan=None,
25 25 pol=None, intent=None, reindex=None,
26 26 kernel=None, kwidth=None,
27 27 outfile=None, overwrite=None):
28 28
29 29 casalog.origin('sdsmooth')
30 30
31 31 try:
32 32 if len(outfile) == 0:
33 33 errmsg = 'outfile is empty.'
34 - raise_exception(errmsg)
34 + raise ValueError(errmsg)
35 35
36 36 if (os.path.exists(outfile)) and (not overwrite):
37 37 errmsg = outfile+' exists.'
38 - raise_exception(errmsg)
38 + raise ValueError(errmsg)
39 39
40 40 sdms.open(infile)
41 41 sdms.set_selection(spw=spw, field=field,
42 42 antenna=antenna,
43 43 timerange=timerange, scan=scan,
44 44 polarization=pol, intent=intent,
45 45 reindex=reindex)
46 46 sdms.smooth(type=kernel, width=kwidth, datacolumn=datacolumn, outfile=outfile)
47 47
48 48 # Write to HISTORY of outfile MS
49 49 param_names = sdsmooth.__code__.co_varnames[:sdsmooth.__code__.co_argcount]
50 50 if is_python3:
51 51 vars = locals()
52 52 param_vals = [vars[p] for p in param_names]
53 53 else:
54 54 param_vals = [eval(p) for p in param_names]
55 55 write_history(ms, outfile, 'sdsmooth', param_names,
56 56 param_vals, casalog)
57 57
58 - except Exception:
59 - raise
60 58 finally:
61 59 sdms.close()
62 -
63 -def raise_exception(errmsg):
64 - casalog.post(errmsg, priority='SEVERE')
65 - raise Exception(errmsg)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut