Exemplo n.º 1
0
def test_two_qubit_nearest_neighbor(ax):
    value_map = {
        (grid_qubit.GridQubit(3, 2), grid_qubit.GridQubit(4, 2)):
        0.004619111460557768,
        (grid_qubit.GridQubit(4, 1), grid_qubit.GridQubit(3, 2)):
        0.0076079162393482835,
    }
    with pytest.raises(ValueError, match="not nearest neighbors"):
        heatmap.TwoQubitInteractionHeatmap(value_map, coupler_width=0).plot(ax)
Exemplo n.º 2
0
def test_invalid_args():
    value_map = {
        (grid_qubit.GridQubit(3, 2), grid_qubit.GridQubit(4, 2)):
        0.004619111460557768,
        (grid_qubit.GridQubit(4, 1), grid_qubit.GridQubit(4, 2)):
        0.0076079162393482835,
    }
    with pytest.raises(ValueError, match="invalid argument.*colormap"):
        heatmap.TwoQubitInteractionHeatmap(value_map, colormap='Greys')
Exemplo n.º 3
0
def test_two_qubit_heatmap(ax):
    value_map = {
        (grid_qubit.GridQubit(3, 2), grid_qubit.GridQubit(4, 2)):
        0.004619111460557768,
        (grid_qubit.GridQubit(4, 1), grid_qubit.GridQubit(4, 2)):
        0.0076079162393482835,
    }
    title = "Two Qubit Interaction Heatmap"
    heatmap.TwoQubitInteractionHeatmap(value_map, title=title).plot(ax)
    assert ax.get_title() == title
Exemplo n.º 4
0
def test_plot_updates_local_config():
    value_map_2d = {
        (grid_qubit.GridQubit(3, 2), grid_qubit.GridQubit(4, 2)):
        0.004619111460557768,
        (grid_qubit.GridQubit(4, 1), grid_qubit.GridQubit(4, 2)):
        0.0076079162393482835,
    }
    value_map_1d = {
        (grid_qubit.GridQubit(3, 2), ): 0.004619111460557768,
        (grid_qubit.GridQubit(4, 2), ): 0.0076079162393482835,
    }
    original_title = "Two Qubit Interaction Heatmap"
    new_title = "Temporary title for the plot"
    for random_heatmap in [
            heatmap.TwoQubitInteractionHeatmap(value_map_2d,
                                               title=original_title),
            heatmap.Heatmap(value_map_1d, title=original_title),
    ]:
        _, ax = plt.subplots()
        random_heatmap.plot(ax, title=new_title)
        assert ax.get_title() == new_title
        _, ax = plt.subplots()
        random_heatmap.plot(ax)
        assert ax.get_title() == original_title