qiskit/tools/jupyter/backend_overview.py
def backend_widget(backend):
    """Creates a backend widget.
    """
    config = backend.configuration().to_dict()
    props = backend.properties().to_dict()

    name = widgets.HTML(value="<h4>{name}</h4>".format(name=backend.name()),
                        layout=widgets.Layout())

    n_qubits = config['n_qubits']

    qubit_count = widgets.HTML(value="<h5><b>{qubits}</b></h5>".format(qubits=n_qubits),
                               layout=widgets.Layout(justify_content='center'))

    cmap = widgets.Output(layout=widgets.Layout(min_width='250px', max_width='250px',
                                                max_height='250px',
                                                min_height='250px',
                                                justify_content='center',
                                                align_items='center',
                                                margin='0px 0px 0px 0px'))

    with cmap:
        _cmap_fig = plot_gate_map(backend,
                                  plot_directed=False,
                                  label_qubits=False)
        if _cmap_fig is not None:
            display(_cmap_fig)
            # Prevents plot from showing up twice.
            plt.close(_cmap_fig)

    pending = generate_jobs_pending_widget()

    is_oper = widgets.HTML(value="<h5></h5>",
                           layout=widgets.Layout(justify_content='center'))

    least_busy = widgets.HTML(value="<h5></h5>",
                              layout=widgets.Layout(justify_content='center'))

    t1_units = props['qubits'][0][0]['unit']
    avg_t1 = round(sum([q[0]['value'] for q in props['qubits']])/n_qubits, 1)
    t1_widget = widgets.HTML(value="<h5>{t1} {units}</h5>".format(t1=avg_t1, units=t1_units),
                             layout=widgets.Layout())

    t2_units = props['qubits'][0][1]['unit']
    avg_t2 = round(sum([q[1]['value'] for q in props['qubits']])/n_qubits, 1)
    t2_widget = widgets.HTML(value="<h5>{t2} {units}</h5>".format(t2=avg_t2, units=t2_units),
                             layout=widgets.Layout())

    out = widgets.VBox([name, cmap, qubit_count, pending,
                        least_busy, is_oper, t1_widget, t2_widget],
                       layout=widgets.Layout(display='inline-flex',
                                             flex_flow='column',
                                             align_items='center'))

    out._is_alive = True
    return out
def backend_widget(backend):
    config = backend.configuration().to_dict()
    props = backend.properties().to_dict()

    name = widgets.HTML(value="<h4>{name}</h4>".format(name=backend.name()),
                        layout=widgets.Layout())

    n_qubits = config['n_qubits']

    qubit_count = widgets.HTML(value="<h5><b>{qubits}</b></h5>".format(qubits=n_qubits),
                               layout=widgets.Layout(justify_content='center'))

    cmap = widgets.Output(layout=widgets.Layout(min_width='250px', max_width='250px',
                                                max_height='250px',
                                                min_height='250px',
                                                justify_content='center',
                                                align_items='center',
                                                margin='0px 0px 0px 0px'))

    with cmap:
        _cmap_fig = plot_gate_map(backend,
                                  plot_directed=False,
                                  label_qubits=False)
        if _cmap_fig is not None:
            display(_cmap_fig)
            # Prevents plot from showing up twice.
            plt.close(_cmap_fig)

    pending = generate_jobs_pending_widget()

    is_oper = widgets.HTML(value="<h5></h5>",
                           layout=widgets.Layout(justify_content='center'))

    least_busy = widgets.HTML(value="<h5></h5>",
                              layout=widgets.Layout(justify_content='center'))

    t1_units = props['qubits'][0][0]['unit']
    avg_t1 = round(sum([q[0]['value'] for q in props['qubits']])/n_qubits, 1)
    t1_widget = widgets.HTML(value="<h5>{t1} {units}</h5>".format(t1=avg_t1, units=t1_units),
                             layout=widgets.Layout())

    t2_units = props['qubits'][0][1]['unit']
    avg_t2 = round(sum([q[1]['value'] for q in props['qubits']])/n_qubits, 1)
    t2_widget = widgets.HTML(value="<h5>{t2} {units}</h5>".format(t2=avg_t2, units=t2_units),
                             layout=widgets.Layout())

    out = widgets.VBox([name, cmap, qubit_count, pending,
                        least_busy, is_oper, t1_widget, t2_widget],
                       layout=widgets.Layout(display='inline-flex',
                                             flex_flow='column',
                                             align_items='center'))

    out._is_alive = True
    return out
def backend_widget ( backend ) : config = backend . configuration ( ) . to_dict ( ) props = backend . properties ( ) . to_dict ( ) name = widgets . HTML ( value = "<h4>{name}</h4>" . format ( name = backend . name ( ) ) , layout = widgets . Layout ( ) ) n_qubits = config [ 'n_qubits' ] qubit_count = widgets . HTML ( value = "<h5><b>{qubits}</b></h5>" . format ( qubits = n_qubits ) , layout = widgets . Layout ( justify_content = 'center' ) ) cmap = widgets . Output ( layout = widgets . Layout ( min_width = '250px' , max_width = '250px' , max_height = '250px' , min_height = '250px' , justify_content = 'center' , align_items = 'center' , margin = '0px 0px 0px 0px' ) ) with cmap : _cmap_fig = plot_gate_map ( backend , plot_directed = False , label_qubits = False ) if _cmap_fig is not None : display ( _cmap_fig ) # Prevents plot from showing up twice. plt . close ( _cmap_fig ) pending = generate_jobs_pending_widget ( ) is_oper = widgets . HTML ( value = "<h5></h5>" , layout = widgets . Layout ( justify_content = 'center' ) ) least_busy = widgets . HTML ( value = "<h5></h5>" , layout = widgets . Layout ( justify_content = 'center' ) ) t1_units = props [ 'qubits' ] [ 0 ] [ 0 ] [ 'unit' ] avg_t1 = round ( sum ( [ q [ 0 ] [ 'value' ] for q in props [ 'qubits' ] ] ) / n_qubits , 1 ) t1_widget = widgets . HTML ( value = "<h5>{t1} {units}</h5>" . format ( t1 = avg_t1 , units = t1_units ) , layout = widgets . Layout ( ) ) t2_units = props [ 'qubits' ] [ 0 ] [ 1 ] [ 'unit' ] avg_t2 = round ( sum ( [ q [ 1 ] [ 'value' ] for q in props [ 'qubits' ] ] ) / n_qubits , 1 ) t2_widget = widgets . HTML ( value = "<h5>{t2} {units}</h5>" . format ( t2 = avg_t2 , units = t2_units ) , layout = widgets . Layout ( ) ) out = widgets . VBox ( [ name , cmap , qubit_count , pending , least_busy , is_oper , t1_widget , t2_widget ] , layout = widgets . Layout ( display = 'inline-flex' , flex_flow = 'column' , align_items = 'center' ) ) out . _is_alive = True return out
Creates a backend widget.
Creates a backend widget .