(lines, traceType)
| 718 | return traceDict, xVar, xUnits |
| 719 | |
| 720 | def _makeACtraces(lines, traceType): |
| 721 | reMagDict = {} |
| 722 | imPhsDict = {} |
| 723 | traceDict = {} |
| 724 | for i in range(len(lines)): |
| 725 | fields = lines[i].split() |
| 726 | if i == 0: |
| 727 | xVar = fields[0] |
| 728 | if fields[0] == xVar: |
| 729 | labels = [fields[j] for j in range(1, len(fields))] |
| 730 | for label in labels: |
| 731 | traceDict[label] = [[],[],[]] # frequency, real, imag |
| 732 | else: |
| 733 | for j in range(len(labels)): |
| 734 | if j%2: |
| 735 | traceDict[labels[j]][2].append(eval(fields[j+1])) # imag |
| 736 | else: |
| 737 | traceDict[labels[j]][0].append(eval(fields[0])) # frequency |
| 738 | traceDict[labels[j]][1].append(eval(fields[j+1])) # real |
| 739 | for key in traceDict: |
| 740 | freq = traceDict[key][0] |
| 741 | real = array(traceDict[key][1]) |
| 742 | imag = array(traceDict[key][2]) |
| 743 | if traceType == 'realImag': |
| 744 | reMagDict[key] = trace((freq, real)) |
| 745 | reMagDict[key].label = key |
| 746 | imPhsDict[key] = trace((freq, imag)) |
| 747 | imPhsDict[key].label = key |
| 748 | elif traceType == 'magPhase': |
| 749 | reMagDict[key] = trace((freq, sqrt(real**2+imag**2))) |
| 750 | reMagDict[key].label = key |
| 751 | imPhsDict[key] = trace((freq, unwrap(arctan(imag/real), discont=pi/4, period=pi/2)*180/pi)) |
| 752 | imPhsDict[key].label = key |
| 753 | elif traceType == 'dBmagPhase': |
| 754 | reMagDict[key] = trace((freq, 10*log10(real**2+imag**2))) |
| 755 | reMagDict[key].label = key |
| 756 | imPhsDict[key] = trace((freq, unwrap(arctan(imag/real), discont=pi/4, period=pi/2)*180/pi)) |
| 757 | imPhsDict[key].label = key |
| 758 | if xVar == "frequency": |
| 759 | xUnits = "Hz" |
| 760 | else: |
| 761 | xUnits = "" |
| 762 | return reMagDict, imPhsDict, xVar, xUnits |
| 763 | |
| 764 | def selectTraces(traceDict, namesList): |
| 765 | """ |
no test coverage detected