def PlotEffMass_VarMeth(self, plot_plane, **kwargs): if hasattr(self, 'booted_proj_corr') and self.booted_proj_corr is not None: return self.PlotEffMass_VarMeth_Boot(plot_plane, **kwargs) if not hasattr(self, 'eff_mass'): print('effective mass not computed, computing now') self.PlotEffMass_VarMeth() hold_series = null_series if 'color' in kwargs.keys(): hold_series['color'] = kwargs['color'] del kwargs['color'] if 'shift' in kwargs.keys(): hold_series['shift'] = kwargs['shift'] del kwargs['shift'] try: data_plot = self.proj_eff_mass.unstack().sel(**kwargs) except Exception as err: data_plot = self.proj_eff_mass.sel(**kwargs).unstack() data_plot = data_plot.stack(all=self.proj_eff_mass.dims).to_pandas() this_index = pa.MultiIndex.from_tuples(list(map_str(data_plot.index)), names=data_plot.index.names) data_plot = pa.Series(data_plot.values, index=this_index) hold_series['x_data'] = 'from_keys' hold_series['key_select'] = data_plot.index[0] hold_series['type'] = 'plot' if isinstance(data_plot.index[0], (tuple, list, np.ndarray)): if len(data_plot.index[0]) > 1: hold_series['key_select'] = data_plot.index[0] hold_series['key_select'] = list( hold_series['key_select'])[:-1] + [slice(None)] hold_series['type'] += '_vary' hold_series['y_data'] = data_plot hold_series['label'] = self.name + ' VarMeth' plot_plane.AppendData(hold_series) return plot_plane
def PlotEffMass_Prony_Boot(self, plot_plane, **kwargs): if not hasattr(self, 'booted_pro_proj_eff_mass' ) or self.booted_pro_proj_eff_mass is None: print('effective mass not computed, computing now') self.MakeEffMass() hold_series = null_series if 'color' in kwargs.keys(): hold_series['color'] = kwargs['color'] del kwargs['color'] if 'shift' in kwargs.keys(): hold_series['shift'] = kwargs['shift'] del kwargs['shift'] try: data_plot = self.booted_pro_proj_eff_mass.unstack().sel(**kwargs) except Exception as err: data_plot = self.booted_pro_proj_eff_mass.sel(**kwargs).unstack() data_plot = data_plot.stack( all=self.booted_pro_proj_eff_mass.dims).to_pandas() this_index = pa.MultiIndex.from_tuples(list(map_str(data_plot.index)), names=data_plot.index.names) data_plot = pa.Series(data_plot.values, index=this_index) data_plot.apply(lambda x: x.Stats()) data_avg = data_plot.apply(lambda x: x.Avg) data_std = data_plot.apply(lambda x: x.Std) hold_series['x_data'] = 'from_keys' hold_series['key_select'] = data_plot.index[0] hold_series['type'] = 'error_bar' if isinstance(data_plot.index[0], (tuple, list, np.ndarray)): if len(data_plot.index[0]) > 1: hold_series['key_select'] = data_plot.index[0] hold_series['key_select'] = list( hold_series['key_select'])[:-1] + [slice(None)] hold_series['type'] += '_vary' hold_series['y_data'] = data_avg hold_series['yerr_data'] = data_std hold_series['label'] = self.name + ' Prony' plot_plane.AppendData(hold_series) return plot_plane