def sortData(batch, datatags): items = [] for tag in datatags: items += [item for item in batch if item == tag] return items lines = [] for i, par in enumerate(args.params): for paramtag in paramtag_for_param[par]: dataTable = table[paramtag] print paramtag, len(dataTable) if args.compare is not None: dataTable = sortData(dataTable, args.compare) cols = [makeMath(names.parWithName(par, True).label)] for datatag in dataTable: if args.latex_filename is not None: for par in args.params: if par in table[paramtag][datatag]: res = table[paramtag][datatag][par] if len(res) > 1: cols.append(textAsColumn(res[1])) cols.append(textAsColumn(res[0], latex=res[0] != '---')) else: print ' ', table[paramtag][datatag], datatag lines.append(" & ".join(cols) + args.endline) if args.latex_filename is not None: if args.latex_filename .find('.') < 0: args.latex_filename += '.tex' (outdir, outname) = os.path.split(args.latex_filename) if not os.path.exists(outdir): os.makedirs(os.path.dirname(outdir)) ResultObjs.textFile(lines).write(args.latex_filename)
elif args.changes_replacing is not None: referenceDataJobItem = None for replace in args.changes_replacing[1:]: if replace in jobItem.data_set.names: referenceDataJobItem = baseJobItems.get( batch.normalizeDataTag(jobItem.data_set.tagReplacing(replace, args.changes_replacing[0])), None) break referenceJobItem = referenceDataJobItem if args.changes_only and not referenceDataJobItem: continue else: referenceJobItem = baseJobItems.get(dataIndex(jobItem), None) if args.changes_from_paramtag is not None: referenceDataJobItem = referenceJobItem if not args.forpaper: lines.append('\\subsection{ ' + texEscapeText(jobItem.name) + '}') try: tableLines = paramResultTable(jobItem, referenceJobItem, referenceDataJobItem) if args.separate_tex: ResultObjs.textFile(tableLines).write(jobItem.distRoot + '.tex') lines += tableLines except Exception as e: print 'ERROR: ' + jobItem.name print "Index Error:" + e.message if not args.forpaper: lines.append('\\end{document}') (outdir, outname) = os.path.split(outfile) if len(outdir) > 0 and not os.path.exists(outdir): os.makedirs(outdir) ResultObjs.textFile(lines).write(outfile) (root, _) = os.path.splitext(outfile) if not args.forpaper: print 'Now converting to PDF...' delext = ['aux', 'log', 'out', 'toc']