Commits
112 112 | pampest=pampest, pcenterest=pcenterest, |
113 113 | pfwhmest=pfwhmest, pfix=pfix, |
114 114 | gmncomps=gmncomps, gmampcon=gmampcon, |
115 115 | gmcentercon=gmcentercon, gmfwhmcon=gmfwhmcon, |
116 116 | gmampest=gmampest, gmcenterest=gmcenterest, |
117 117 | gmfwhmest=gmfwhmest, gmfix=gmfix, logfile=logfile, |
118 118 | append=append, pfunc=pfunc, goodamprange=goodamprange, |
119 119 | goodcenterrange=goodcenterrange, goodfwhmrange=goodfwhmrange, |
120 120 | sigma=sigma, outsigma=outsigma |
121 121 | ) |
122 + | |
122 123 | try: |
123 124 | param_names = specfit.__code__.co_varnames[:specfit.__code__.co_argcount] |
124 125 | if is_python3: |
125 126 | vars = locals( ) |
126 127 | param_vals = [vars[p] for p in param_names] |
127 128 | else: |
128 129 | param_vals = [eval(p) for p in param_names] |
129 130 | ims = [model, residual] |
130 131 | for x in [amp, amperr, center, centererr, fwhm, fwhmerr, integral, integralerr]: |
131 132 | if x: |
132 133 | ims.extend(get_created_images(x, target_time)) |
133 134 | for im in ims: |
134 135 | write_image_history( |
135 136 | im, sys._getframe().f_code.co_name, |
136 137 | param_names, param_vals, casalog |
137 138 | ) |
138 139 | except Exception as instance: |
139 140 | casalog.post("*** Error \'%s\' updating HISTORY" % (instance), 'WARN') |
140 141 | |
141 - | except Exception as instance: |
142 - | casalog.post('*** Error *** ' + str(instance), 'SEVERE') |
143 - | retval = None |
144 - | myia.done() |
145 - | if (wantreturn): |
146 - | return retval |
147 - | else: |
148 - | if (retval): |
149 - | del retval |
150 - | return None |
142 + | finally: |
143 + | myia.done() |
144 + | if (wantreturn): |
145 + | return retval |
146 + | else: |
147 + | if (retval): |
148 + | del retval |