def waterfall_stdev_of_avg(dats: Iterable[DatHDF]) -> go.Figure: dats = list(dats) data = np.array([dat.Transition.avg_data_std for dat in dats]) xs = [dat.Transition.avg_x for dat in dats] data, xs = [ U.resample_data(data=arr, max_num_pnts=500, resample_method='bin') for arr in [data, xs] ] plotter = TwoD(dats=dats) fig = plotter.figure( title=f'Dat{dats[0].datnum}-{dats[-1].datnum}: ' f'Standard deviation of averaged I_sense data after centering') fig.add_traces([ go.Scatter3d(mode='lines', x=x, y=[dat.Logs.fds['ESS']] * len(dat.Transition.avg_x), z=row, name=f'Dat{dat.datnum}') for x, row, dat in zip(xs, data, dats) ]) fig.update_layout(scene=dict( xaxis_title=dats[0].Logs.xlabel, yaxis_title=f'ESS /mV', zaxis_title=f'{dat_analysis.dat_analysis.characters.SIG}I_sense /nA', )) return fig
def plot_nrg(which: str, nrg: Optional[NRGData] = None, plot=True, x_axis_type: str = 'energy') -> go.Figure: @dataclass class PlotInfo: data: np.ndarray title: str if nrg is None: nrg = NRGData.from_old_mat() x = nrg.ens if x_axis_type == 'energy': xlabel = 'Energy' elif x_axis_type == 'gate': xlabel = 'Gate /Arbitrary mV' x = np.flip(x) else: raise NotImplementedError y = nrg.ts / 0.001 ylabel = f'{THETA}/Gamma' if which == 'conductance': pi = PlotInfo(data=nrg.conductance, title='NRG Conductance') elif which == 'dndt': pi = PlotInfo(data=nrg.dndt, title='NRG dN/dT') elif which == 'entropy': pi = PlotInfo(data=nrg.entropy, title='NRG Entropy') elif which == 'occupation': pi = PlotInfo(data=nrg.occupation, title='NRG Occupation') elif which == 'i_sense': pi = PlotInfo(data=1 - nrg.occupation, title='NRG I_sense (1-Occ)') elif which == 'int_dndt': pi = PlotInfo(data=nrg.int_dndt, title='NRG Integrated dN/dT') else: raise KeyError(f'{which} not recognized') plotter = TwoD(dat=None) fig = plotter.figure(xlabel=xlabel, ylabel=ylabel, title=pi.title) fig.add_trace(plotter.trace(data=pi.data, x=x, y=y)) fig.update_yaxes(type='log') if plot: fig.show() return fig