示例#1
0
def entropy_vs_time_fig(title: Optional[str] = None):
    plotter = OneD()
    if title is None:
        title = 'Entropy vs Time'
    fig = plotter.figure(xlabel='Time', ylabel='Entropy /kB', title=title)
    fig.update_xaxes(tickformat="%H:%M\n%a")
    return fig
示例#2
0
def get_integrated_fig(dats=None, title_append: str = '') -> go.Figure:
    plotter = OneD()
    if dats:
        title_prepend = f'Dats{dats[0].datnum}-{dats[-1].datnum}: '
    else:
        title_prepend = ''
    fig = plotter.figure(
        xlabel='ESC /mV',
        ylabel='Entropy /kB',
        title=f'{title_prepend}Integrated Entropy {title_append}')
    return fig
示例#3
0
def plot_stdev_of_avg_data(dat: DatHDF,
                           data_type: str = 'transition',
                           data_name: str = 'default') -> go.Figure:
    """Plot the stdev of averaging the 2D data (i.e. looking for whether more uncertainty near transition)"""
    plotter = OneD(dat=dat)

    fig = plotter.figure(
        ylabel=f'{dat_analysis.dat_analysis.characters.SIG}I_sense /nA',
        title=
        f'Dat{dat.datnum}: Standard deviation of averaged I_sense data after centering',
    )
    fig.add_trace(trace_stdev_of_avg_data(dat, data_type, data_name))
    return fig
示例#4
0
def plot_linear_theta_comparison(
        e_dats,
        t_dats,
        a_dats,
        fit_name='gamma_small') -> Tuple[List[FitInfo], go.Figure]:
    csq_mapped = True if 'csq' in fit_name else False
    efit = plot_linear_theta_nrg_fit(e_dats,
                                     show_plots=False,
                                     csq_mapped=csq_mapped)
    tfit = plot_linear_theta_nrg_fit(t_dats,
                                     show_plots=False,
                                     csq_mapped=csq_mapped)
    fit = plot_linear_theta_nrg_fit(a_dats,
                                    show_plots=False,
                                    csq_mapped=csq_mapped)

    plotter = OneD(dats=all_dats)
    fig = plotter.figure(
        xlabel='ESC /mV',
        ylabel='Theta /mV (real)',
        title=f'Dats{all_dats[0].datnum}-{all_dats[-1].datnum}: Theta vs ESC')
    for dats, name in zip((e_dats, t_dats), ['entropy', 'transition']):
        xs = [dat.Logs.dacs['ESC'] for dat in dats]
        thetas = [
            dat.NrgOcc.get_fit(name=fit_name).best_values.theta for dat in dats
        ]
        datnums = [dat.datnum for dat in dats]
        fig.add_trace(
            plotter.trace(data=thetas,
                          x=xs,
                          name=name,
                          mode='markers',
                          text=datnums))

    xs = [dat.Logs.dacs['ESC'] for dat in t_dats]
    for f, name in zip((efit, tfit, fit),
                       ['entropy fit', 'transition fit', 'all fit']):
        fig.add_trace(
            plotter.trace(x=xs,
                          data=f.eval_fit(np.array(xs)),
                          name=name,
                          mode='lines'))
    return [efit, tfit, fit], fig
示例#5
0
def transition_fig(dats: Optional[List[DatHDF]] = None, xlabel: str = '/mV', title_append: str = '',
                   param: str = 'amp') -> go.Figure:
    plotter = OneD(dats=dats)
    titles = {
        'amp': 'Amplitude',
        'theta': 'Theta',
        'theta real': 'Theta',
        'g': 'Gamma',
        'amp/const': 'Amplitude/Const (sensitivity)',
    }
    ylabels = {
        'amp': 'Amplitude /nA',
        'theta': 'Theta /mV',
        'theta real': 'Theta /mV (real)',
        'g': 'Gamma /mV',
        'amp/const': 'Amplitude/Const'
    }

    fig = plotter.figure(xlabel=xlabel, ylabel=ylabels[param],
                         title=f'Dats{dats[0].datnum}-{dats[-1].datnum}: {titles[param]}{title_append}')
    return fig
示例#6
0
def dcbias_multi_dat(dats: List[DatHDF]):
    plotter = OneD(dats=dats)

    fig = plotter.figure(
        xlabel='Heater Current Bias /nA',
        ylabel='Theta /mV',
        title=f'Dats{dats[0].datnum}-{dats[-1].datnum}: DCbias')

    thetas = []
    biases = []
    for dat in dats:
        fit = dat.Transition.get_fit(which='avg',
                                     name='default',
                                     check_exists=False)
        theta = fit.best_values.theta
        thetas.append(theta)
        biases.append(dat.Logs.fds['HO1/10M'] / 10)

    hover_infos = common_dat_hover_infos(datnum=True)
    hover_infos.append(
        HoverInfo(name='Bias',
                  func=lambda dat: dat.Logs.dacs['HO1/10M'] / 10,
                  precision='.2f',
                  units='nA'))
    hover_infos.append(
        HoverInfo(name='Theta',
                  func=lambda dat: dat.Transition.get_fit().best_values.theta,
                  precision='.2f',
                  units='mV'))
    hover_group = HoverInfoGroup(hover_infos=hover_infos)

    fig.add_trace(
        plotter.trace(x=biases,
                      data=thetas,
                      mode='markers+lines',
                      hover_template=hover_group.template,
                      hover_data=hover_group.customdata(dats)))
    return fig
示例#7
0
def plot_fit_integrated_comparison(dats: List[DatHDF],
                                   x_func: Callable,
                                   x_label: str,
                                   title_append: Optional[str] = '',
                                   int_info_name: Optional[str] = None,
                                   fit_name: str = 'SPS.0045',
                                   plot=True) -> go.Figure():
    if int_info_name is None:
        int_info_name = 'default'
    plotter = OneD(dats=dats)
    fig = plotter.figure(
        title=
        f'Dats{dats[0].datnum}-{dats[-1].datnum}: Fit and Integrated (\'{int_info_name}\') Entropy{title_append}',
        xlabel=x_label,
        ylabel='Entropy /kB')

    hover_infos = [
        HoverInfo(name='Dat',
                  func=lambda dat: dat.datnum,
                  precision='.d',
                  units=''),
        HoverInfo(name='Temperature',
                  func=lambda dat: dat.Logs.temps.mc * 1000,
                  precision='.1f',
                  units='mK'),
        HoverInfo(name='Bias',
                  func=lambda dat: dat.AWG.max(0) / 10,
                  precision='.1f',
                  units='nA'),
        # HoverInfo(name='Fit Entropy', func=lambda dat: dat.SquareEntropy.get_fit(which_fit='entropy', fit_name=fit_name).best_values.dS,
        #           precision='.2f', units='kB'),
        HoverInfo(
            name='Integrated Entropy',
            func=lambda dat: np.nanmean(
                dat.Entropy.get_integrated_entropy(
                    name=int_info_name,
                    data=dat.SquareEntropy.get_Outputs(
                        name=fit_name).average_entropy_signal)[-10:]),
            # TODO: Change to using proper output (with setpoints)
            precision='.2f',
            units='kB'),
    ]

    funcs, template = _additional_data_dict_converter(hover_infos)
    x = [x_func(dat) for dat in dats]
    hover_data = [[func(dat) for func in funcs] for dat in dats]

    entropies = [
        dat.Entropy.get_fit(name=fit_name).best_values.dS for dat in dats
    ]
    # entropy_errs = [np.nanstd([
    #     f.best_values.dS if f.best_values.dS is not None else np.nan
    #     for f in dat.Entropy.get_row_fits(name=fit_name) for dat in dats
    # ]) / np.sqrt(dat.Data.y_array.shape[0]) for dat in dats]
    entropy_errs = None
    fig.add_trace(
        plotter.trace(data=entropies,
                      data_err=entropy_errs,
                      x=x,
                      name=f'Fit Entropy',
                      mode='markers',
                      trace_kwargs={
                          'customdata': hover_data,
                          'hovertemplate': template
                      }))
    integrated_entropies = [
        np.nanmean(
            dat.Entropy.get_integrated_entropy(
                name=int_info_name,
                data=dat.SquareEntropy.get_Outputs(
                    name=fit_name).average_entropy_signal)[-10:])
        for dat in dats
    ]

    ### For plotting the impurity dot scans (i.e. isolate only the integrated entropy due to the main dot transition)
    # integrated_entropies = []
    # for dat in dats:
    #     out = dat.SquareEntropy.get_Outputs(name=fit_name)
    #     x1, x2 = U.get_data_index(out.x, [-40, 40], is_sorted=True)
    #     integrated = dat.Entropy.get_integrated_entropy(name=int_info_name,
    #                                                     data=out.average_entropy_signal)
    #     integrated_entropies.append(integrated[x2]-integrated[x1])

    fig.add_trace(
        plotter.trace(data=integrated_entropies,
                      x=x,
                      name=f'Integrated',
                      mode='markers+lines',
                      trace_kwargs={
                          'customdata': hover_data,
                          'hovertemplate': template
                      }))

    if plot:
        fig.show(renderer='browser')
    return fig