Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PySmithPlot/Polar Plot update broken in 2.1.2 (works in 2.0.2)  #10654

Closed
@chrisgmorton

Description

@chrisgmorton

Bug report

Bug summary

The smith chart grid is distorted in 2.1.2, correct in 2.0.2.
Updating the polar plot data blanks the plot in 2.1.2, updates properly in 2.0.2.

In both versions when I create the plots/lines I see:

/Users/chrisgmorton/usr/tcad/fusion/prod/lib/python3.6/site-packages/pysmithplot-0.2.0-py3.6.egg/smithplot/smithhelper.py:46: RuntimeWarning: divide by zero encountered in true_divide
/Users/chrisgmorton/usr/tcad/fusion/prod/lib/python3.6/site-packages/pysmithplot-0.2.0-py3.6.egg/smithplot/smithhelper.py:46: RuntimeWarning: invalid value encountered in true_divide
/Users/chrisgmorton/usr/tcad/fusion/prod/lib/python3.6/site-packages/matplotlib/projections/polar.py:58: RuntimeWarning: invalid value encountered in less
mask = r < 0

On the first update of the plots I see:

Users/chrisgmorton/usr/tcad/fusion/prod/lib/python3.6/site-packages/matplotlib/projections/polar.py:58: RuntimeWarning: invalid value encountered in less
mask = r < 0

and the polar plots are then blanked out (not so with 2.0.2).

Code for reproduction

Plots are built with:

        self.axes=[]
        n = self.numberOfPorts
        
        for i,j in self.indices:
            if i==j: self.axes.append(self.fig.add_subplot(n,n,1+i*2+j, projection='smith'))
            else: self.axes.append(self.fig.add_subplot(n,n,1+i*2+j, projection='polar'))

        for k,(i,j) in enumerate(self.indices):
            self.axes[k].tick_params(which='major', labelsize=10)

        self.fig.subplots_adjust(top=0.9)

Lines initialized with:

        self.lines=[]
        
        for m,(i,j) in enumerate(self.indices):

            if i==j: # Smith Chart
                S=self.Splt.T[j,i].T
                Z = (1+S)/(1-S) # normalized impedance on Smith Chart

                self.lines.append(self.axes[m].plot(Z.T, color='b', marker='', markerfacecolor='b', markeredgecolor='b'))
            else: # Polar Plot
                S = self.Splt.T[j,i].T
                self.lines.append(self.axes[m].plot(np.angle(S.T), np.absolute(S.T), color='r', marker='', markerfacecolor='r', markeredgecolor='r'))

Lines updated with:

        for k,(i,j) in enumerate(self.indices):
            
            if i==j: # Smith Chart
                S=self.Splt.T[j,i].T
                Z = (1+S)/(1-S) # normalized impedance on Smith Chart

                [line.set_xdata(np.real(Z[idx])) for idx, line in enumerate(self.lines[k])]
                [line.set_ydata(np.imag(Z[idx])) for idx, line in enumerate(self.lines[k])]
                
            else: # Polar Plot
                S = self.Splt.T[j,i].T

                [line.set_xdata(np.angle(S[idx])) for idx, line in enumerate(self.lines[k])]
                [line.set_ydata(np.absolute(S[idx])) for idx, line in enumerate(self.lines[k])]

Actual outcome

Matplotlib 2.1.2 output, on completion of simulation:

screen shot 2018-03-02 at 4 59 20 pm

Expected outcome

Matplotlib 2.0.2 output, on completion of simulation:

screen shot 2018-03-02 at 3 18 06 pm

Matplotlib version

  • Operating system: Ubuntu 16.04 and OSX 10.13.3
  • Matplotlib version: 2.1.2
  • Matplotlib backend: Qt5Agg (Qt5.10)
  • Python version: 3.6.4
  • PySmithPlot version: 0.2

Matplotlib installed using pip. Qt5 and PyQt5 built from source. Python 3.6.4 built from source.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions