diff --git a/pymule/vegas.py b/pymule/vegas.py index 4c0957452c640401227155d23ccbfe11ace37398..0336eba1144d4ee00250aeab7b8370d8f932c5d4 100644 --- a/pymule/vegas.py +++ b/pymule/vegas.py @@ -151,12 +151,16 @@ def exportvegas(dic, filename="", fp=None): dic['xi'] = -np.ones(17*50) if 'randy' not in dic: dic['randy'] = -1 + if 'runtime' not in dic: + dic['runtime'] = -1 + if 'msg' not in dic: + dic['msg'] = "Warning: Generated with Python" while type(dic['chi2a']) == list: dic['chi2a'] = dic['chi2a'][0] plots = sorted(list(set(dic.keys()) - { - 'SHA','chi2a','iteration','msg','value','time','ndo','randy','xi' + 'SHA','chi2a','iteration','msg','value','time','ndo','randy','xi','runtime' })) y,e = dic['value'] @@ -172,16 +176,17 @@ def exportvegas(dic, filename="", fp=None): dic['chi2a']*(dic['iteration']-1) + y**2/e**2 ) - write_record(fp, 'd', dic['xi']) + write_record(fp, 'd', list(dic['xi'])) write_record(fp, 'i', dic['randy']) nrbins = len(dic[plots[0]]) nrq = len(plots) + namelen = max(max([len(i) for i in plots]),6) write_record(fp, 'i', [ nrq, nrbins, - max(max([len(i) for i in plots]),6) + namelen ]) quant = np.zeros(2*(nrbins + 2)*nrq) @@ -213,3 +218,10 @@ def exportvegas(dic, filename="", fp=None): quant[nrq*(nrbins + 2) + i::nrq] = delta**2*dic['iteration']*( pp[:,2]**2*(dic['iteration']-1) + pp[:,1]**2 ) + + write_record(fp, 'd', minv+maxv) + write_record(fp, 'c', "".join([i.ljust(namelen) for i in plots])) + write_record(fp, 'd', list(quant)) + + write_record(fp, 'd', dic['runtime']) + write_record(fp, 'c', dic['msg'])