def load(self, filename): self.spectrum_geometry = AzimuthalIntegrator() self.spectrum_geometry.load(filename) self.orig_pixel1 = self.spectrum_geometry.pixel1 self.orig_pixel2 = self.spectrum_geometry.pixel2 self.calibration_name = get_base_name(filename) self.filename = filename self.is_calibrated = True self.create_cake_geometry() self.set_supersampling()
def set_spectrum(self, x, y, filename='', unit=''): """ set the current data spectrum. :param x: x-values :param y: y-values :param filename: name for the spectrum, defaults to '' :param unit: unit for the x values """ self.spectrum_filename = filename self.spectrum.data = (x, y) self.spectrum.name = get_base_name(filename) self.unit = unit self.spectrum_changed.emit()
def _add_phase(self, filename): try: self.phase_model.add_phase(filename) if self.widget.phase_apply_to_all_cb.isChecked(): pressure = np.float(self.widget.phase_pressure_sb.value()) temperature = np.float(self.widget.phase_temperature_sb.value()) self.phase_model.phases[-1].compute_d(pressure=pressure, temperature=temperature) else: pressure = 0 temperature = 298 self.phase_model.get_lines_d(-1) color = self.add_phase_plot() self.widget.add_phase(get_base_name(filename), '#%02x%02x%02x' % (color[0], color[1], color[2])) self.widget.set_phase_pressure(len(self.phase_model.phases)-1, pressure) self.update_phase_temperature(len(self.phase_model.phases)-1, temperature) except PhaseLoadError as e: self.widget.show_error_msg('Could not load:\n\n{0}.\n\nPlease check if the format of the input file is correct.'.\ format(e.filename))
def save(self, filename): self.cake_geometry.save(filename) self.calibration_name = get_base_name(filename) self.filename = filename