def show(self): if len(self.samples) > 1: self.log.warning("MORE THAN one sample found, using first one for plot") self.hys = self.samples[0].find_measurement("hys")[0] self.samples[0].find_measurement("hys")[0] try: self.coe = self.samples[0].find_measurement(mtype="coe")[0] except IndexError: self.log.error("NOT FOUND\t << coe >> measurement") self.coe = None self.factor = { "mass": self.hys.sample_obj.mass_kg, "max": max(self.hys.up_field[:, 1]), "calibration": self.hys.calibration_factor, None: 1, } self.norm_factor = self.factor[self.norm] self.ax.xaxis.major.formatter._useMathText = True self.ax = plt.subplot2grid((1, 1), (0, 0), colspan=1, rowspan=1) plt.suptitle(self.hys.sample_obj.name) self.factor = { "mass": self.hys.sample_obj.mass_kg, "max": max(self.hys.up_field[:, 1]), "calibration": self.hys.calibration_factor, None: 1, } norm_factor = self.factor[self.norm] # # NORMALIZATION FACTOR self.ax.set_ylim( [min(self.hys.down_field[:, 1]) / norm_factor * 1.1, max(self.hys.down_field[:, 1]) / norm_factor * 1.1] ) self.ax.set_xlim([min(self.hys.down_field[:, 0]), max(self.hys.down_field[:, 0])]) if self.coe: backfield.plot_coe(coe_obj=self.coe, ax=self.ax, norm_factor=self.norm_factor) backfield.add_bcr_line(coe_obj=self.coe, ax=self.ax, norm_factor=self.norm_factor, method="fit", text=True) hysteresis.plot_hys(self.hys, ax=self.ax, norm_factor=self.norm_factor, out="rtn", plt_opt={"color": "k"}) hysteresis.plot_virgin(self.hys, ax=self.ax, norm_factor=self.norm_factor, out="rtn") hysteresis.plot_rev(self.hys, ax=self.ax, norm_factor=self.norm_factor, out="rtn") hysteresis.plot_irrev(self.hys, ax=self.ax, norm_factor=self.norm_factor, out="rtn") hysteresis.fill_hys(hys_obj=self.hys, ax=self.ax, norm_factor=self.norm_factor) # hysteresis.fill_virgin(hys_obj=self.hys, ax=self.ax, norm_factor=self.norm_factor) hysteresis.add_virgin_info(self.hys, ax=self.ax, norm_factor=self.norm_factor) hysteresis.add_05ms_line(hys_obj=self.hys, ax=self.ax, norm_factor=self.norm_factor, text=True) hysteresis.add_ms_line(hys_obj=self.hys, ax=self.ax, norm_factor=self.norm_factor, text=True) self.ax.ticklabel_format(style="sci", axis="y", scilimits=(0, 0)) self.add_label(ax=self.ax)
def show(self): for sample in self.samples: self.measurements = sample.find_measurement("hys") for measurement in self.measurements: if measurement > 1: paramag_text = False else: True factor = { "mass": measurement.sample_obj.mass_kg, "max": max(measurement.up_field[:, 1]), "calibration": measurement.calibration_factor, None: 1, } norm_factor = factor[self.norm] # # NORMALIZATION FACTOR if self.plt_branches: hysteresis.plot_hys( measurement, ax=self.ax, norm_factor=norm_factor, out="rtn", paramag_text=paramag_text, plt_opt=self.plt_opt, ) if self.plt_virgin: hysteresis.plot_virgin(measurement, ax=self.ax, norm_factor=norm_factor, out="rtn")