def eplot2(plot, domain): def mixPlotWithLoc(loc): newPlot = copy.deepcopy(plot) newPlot["label"] = newPlot["label"].replace("%loc",loc) newPlot["algexp"] = substituteDataArrayElementInString("%loc", newPlot["algexp"], locations[loc]) newPlot["algexp"] = newPlot["algexp"].replace("%loc",loc) return newPlot def mixPlotWithOrgDst(matrixCell): (org, dst, r) = matrixCell if (options.fullMatrix == False and r == 0): return nullInstruction if (org != dst): newPlot = copy.deepcopy(plot) newPlot["label"] = newPlot["label"].replace("%org",org) newPlot["label"] = newPlot["label"].replace("%dst",dst) newPlot["algexp"] = substituteDataArrayElementInString("%org", newPlot["algexp"], locations[org]) newPlot["algexp"] = substituteDataArrayElementInString("%dst", newPlot["algexp"], locations[dst]) newPlot["algexp"] = newPlot["algexp"].replace("%cell", str(r)) newPlot["algexp"] = newPlot["algexp"].replace("%org",org) newPlot["algexp"] = newPlot["algexp"].replace("%dst",dst) return newPlot else: return nullInstruction plotBuilder = None if (domain[0].__class__ == "".__class__): #if it is string, it is just loc plotBuilder = mixPlotWithLoc else: #the type is tuple, it is a matrix plotBuilder = mixPlotWithOrgDst for r in map(plotBuilder, domain): printing.printPlot2(r)