コード例 #1
0
ファイル: smith_full_test.py プロジェクト: lrenaud/ps_plotter
def tb_markers():
    tb = "Markers"
    VStartMarker = np.array([[0, 0], [0.5, 0.5], [0, -0.5], [-0.5, 0.5],
                             [0, 0]])
    XEndMarker = np.array([[0, 0], [0.5, 0.5], [0.25, 0], [0.5, -0.5], [0, 0],
                           [-0.5, -0.5], [-0.25, 0], [-0.5, 0.5], [0, 0]])

    fig = pp.figure(figsize=(4 * figsize, 2 * figsize))
    fig.set_tight_layout(True)

    i = 0
    for hackline, startmarker, endmarker, rotate_marker in [
        [False, None, None, False], [True, "s", "^", False],
        [True, "s", None, False], [True, VStartMarker, XEndMarker, False],
        [True, "s", "^", True], [True, None, "^", False]
    ]:
        i += 1
        ax = pp.subplot(2,
                        3,
                        i,
                        projection="smith",
                        plot_marker_hack=hackline,
                        plot_marker_rotate=rotate_marker)
        SmithAxes.update_scParams(instance=ax,
                                  plot_marker_start=startmarker,
                                  plot_marker_end=endmarker)

        def ptype(x):
            if isinstance(x, np.ndarray):
                return "custom"
            elif x is True:
                return "on"
            elif x is False:
                return "off"
            elif x is None:
                return None
            else:
                return "'%s'" % x

        plot_example(
            tb,
            "HackLines: %s - StartMarker: %s\nEndMarker: %s - Rotate: %s" %
            tuple(map(ptype,
                      [hackline, startmarker, endmarker, rotate_marker])),
            markersize=10)

    savefig(tb)
コード例 #2
0
def tb_markers():
    tb = "Markers"
    VStartMarker = np.array([[0, 0], [0.5, 0.5], [0, -0.5], [-0.5, 0.5], [0, 0]])
    XEndMarker = np.array([[0, 0], [0.5, 0.5], [0.25, 0], [0.5, -0.5], [0, 0], [-0.5, -0.5], [-0.25, 0], [-0.5, 0.5], [0, 0]])

    fig = pp.figure(figsize=(4 * figsize, 2 * figsize))
    fig.set_tight_layout(True)

    i = 0
    for hackline, startmarker, endmarker, rotate_marker in [[False, None, None, False],
                                                            [True, "s", "^", False],
                                                            [True, "s", None, False],
                                                            [True, VStartMarker, XEndMarker, False],
                                                            [True, "s", "^", True],
                                                            [True, None, "^", False]]:
        i += 1
        ax = pp.subplot(2, 3, i, projection="smith",
                        plot_marker_hack=hackline,
                        plot_marker_rotate=rotate_marker)
        SmithAxes.update_scParams(instance=ax, plot_marker_start=startmarker,
                                  plot_marker_end=endmarker)

        def ptype(x):
            if isinstance(x, np.ndarray):
                return "custom"
            elif x is True:
                return "on"
            elif x is False:
                return "off"
            elif x is None:
                return None
            else:
                return "'%s'" % x

        plot_example(tb, "HackLines: %s - StartMarker: %s\nEndMarker: %s - Rotate: %s" % tuple(map(ptype, [hackline, startmarker, endmarker, rotate_marker])), markersize=10)

    savefig(tb)
コード例 #3
0
from smithplot import smithhelper

rcParams.update({"legend.numpoints": 3,
                 "axes.axisbelow": True})

# sample data
steps = 40
data = np.loadtxt("data/s11.csv", delimiter=",", skiprows=1)[::steps]
sp_data = data[:, 1] + data[:, 2] * 1j

data = np.loadtxt("data/s22.csv", delimiter=",", skiprows=1)[::steps]
z_data = 50 * (data[:, 1] + data[:, 2] * 1j)

# default params
SmithAxes.update_scParams({"plot.marker.hack": False,
                           "plot.marker.rotate": False,
                           "grid.minor.enable": False,
                           "grid.minor.fancy": False})

FT = [False, True]
figsize = 6
ExportFormats = ["pdf", "png"]


def plot_example(testbench, title, scale=50, **kwargs):
    print("Testbench '%s' : %s" % (testbench, title.replace("\n", "")))
    kwargs.setdefault("markevery", 1)
    pp.plot(smithhelper.moebius_inv_z(sp_data, norm=50), datatype="Z", **kwargs)
    pp.plot(z_data, datatype="Z", **kwargs)
    pp.plot(100, datatype="Z", **kwargs)
    pp.plot(25 + 25j, datatype="Z", **kwargs)
    pp.title(title)
コード例 #4
0
ファイル: smith_full_test.py プロジェクト: lrenaud/ps_plotter
from smithplot import smithhelper

rcParams.update({"legend.numpoints": 3, "axes.axisbelow": True})

# sample data
steps = 40
data = np.loadtxt("data/s11.csv", delimiter=",", skiprows=1)[::steps]
sp_data = data[:, 1] + data[:, 2] * 1j

data = np.loadtxt("data/s22.csv", delimiter=",", skiprows=1)[::steps]
z_data = 50 * (data[:, 1] + data[:, 2] * 1j)

# default params
SmithAxes.update_scParams({
    "plot.marker.hack": False,
    "plot.marker.rotate": False,
    "grid.minor.enable": False,
    "grid.minor.fancy": False
})

FT = [False, True]
figsize = 6
ExportFormats = ["pdf", "png"]


def plot_example(testbench, title, scale=50, **kwargs):
    print("Testbench '%s' : %s" % (testbench, title.replace("\n", "")))
    kwargs.setdefault("markevery", 1)
    pp.plot(smithhelper.moebius_inv_z(sp_data, norm=50),
            datatype="Z",
            **kwargs)
    pp.plot(z_data, datatype="Z", **kwargs)