def load_spectrum(self): """initializes a wraith spectrum""" self.spectrum = spectra_fitting.Spectrum() xdata = analysis.xdata_calc(self.cube_data, self.cube_dataview) ydata = analysis.ydata_calc(self.cube_data, self.cube_dataview) self.spectrum.EE = xdata self.spectrum.data = ydata
def __init__(self, data, data_view, spectrum_holder, parent=None): super(Form, self).__init__(parent) self.filename = data.filename self.xdata = module_copy.copy(analysis.xdata_calc(data, data_view)) self.xdata = np.float64(self.xdata) self.data = data self.ydata = module_copy.copy(analysis.ydata_calc(data, data_view)) self.x = module_copy.copy(data_view.x) self.y = module_copy.copy(data_view.y) self.spectrum_holder = spectrum_holder self.spectrum_viewer = spectrum_viewer.SpectrumViewer(spectrum_holder) self.display_ev = copy(data_view.display_ev) self.setWindowTitle('Interactive XPS Explorer') self.ignore_signals = False self.files = {} #self.data = DataHolder() self.series_list_model = QStandardItemModel() self.series_list_root = self.series_list_model.invisibleRootItem() self.series_list_model.itemChanged.connect(self.update_file_checks) #self.create_menu() self.create_main_frame() self.create_status_bar() self.load_file() self.update_file_checks(self.series_list_model.item(0)) self.threadPool = [] self.update_ui() self.on_show()
def mouseMoved_graph(self, evt): pos = evt if self.p1.sceneBoundingRect().contains(pos): mousePoint = self.p1.vb.mapSceneToView(pos) index = analysis.get_index(mousePoint.x(), self.data, self.dataview) ydata = analysis.ydata_calc(self.data, self.dataview) if index > 0 and index < len(ydata): self.graph_label.setText("<span style='font-size: 12pt'>x=%0.1f, y1=%0.3f" % (mousePoint.x(), ydata[index])) self.vLine_2.setPos(mousePoint.x())
def export_spectrum(filename, data, data_view): """ export the current spectrum to an excel file in the original file's folder """ location = 'x' + str(data_view.x) + 'y' + str(data_view.y) no_ext_filename, ext = os.path.splitext(filename) out_filename = no_ext_filename + location + '.csv' xdata = analysis.xdata_calc(data, data_view) ydata = analysis.ydata_calc(data, data_view) out = np.c_[xdata, ydata] np.savetxt(str(out_filename), out, delimiter=",", fmt="%10.5f")
def export_spectrum(filename, data, data_view): """ export the current spectrum to an excel file in the original file's folder """ location = 'x' + str(data_view.x) + 'y' + str(data_view.y) no_ext_filename, ext = os.path.splitext(filename) out_filename = no_ext_filename + location + '.csv' xdata = analysis.xdata_calc(data,data_view) ydata = analysis.ydata_calc(data,data_view) out = np.c_[xdata,ydata] np.savetxt(str(out_filename), out, delimiter=",", fmt="%10.5f")
def mouseMoved_graph(self, evt): pos = evt if self.p1.sceneBoundingRect().contains(pos): mousePoint = self.p1.vb.mapSceneToView(pos) index = analysis.get_index(mousePoint.x(), self.data, self.dataview) ydata = analysis.ydata_calc(self.data, self.dataview) if index > 0 and index < len(ydata): self.graph_label.setText( "<span style='font-size: 12pt'>x=%0.1f, y1=%0.3f" % (mousePoint.x(), ydata[index])) self.vLine_2.setPos(mousePoint.x())
def change_display(axes, data, dataview): """ changes the view between ev and wavelength for ev and wavelength data """ axes.cla() xdata = analysis.xdata_calc(data, dataview) ydata = analysis.ydata_calc(data, dataview) img2, = axes.plot(xdata, ydata, ".") if dataview.display_ev: axes.set_xlabel("ev") else: axes.set_xlabel("$\lambda$ [nm]") return img2
def change_display(axes, data, dataview): """ changes the view between ev and wavelength for ev and wavelength data """ axes.cla() xdata = analysis.xdata_calc(data, dataview) ydata = analysis.ydata_calc(data, dataview) img2, = axes.plot(xdata, ydata, '.') if dataview.display_ev: axes.set_xlabel('ev') else: axes.set_xlabel('$\lambda$ [nm]') return img2
def initialize_graph(axes, data, dataview): """ initializes the graph on screen xs and ys start from 0 """ axes.cla() xdata = analysis.xdata_calc(data, dataview) ydata = analysis.ydata_calc(data, dataview) maxval = analysis.maxval_calc(data, dataview) axes.set_ylim((-maxval / 10, maxval)) img2, = axes.plot(xdata, ydata, ".") if dataview.display_ev: plt.xlabel("ev") else: plt.xlabel("$\lambda$ [nm]") return img2
def initialize_graph(axes, data, dataview): """ initializes the graph on screen xs and ys start from 0 """ axes.cla() xdata = analysis.xdata_calc(data, dataview) ydata = analysis.ydata_calc(data, dataview) maxval = analysis.maxval_calc(data, dataview) axes.set_ylim((-maxval / 10, maxval)) img2, = axes.plot(xdata, ydata, '.') if dataview.display_ev: plt.xlabel('ev') else: plt.xlabel('$\lambda$ [nm]') return img2
def plot_graph(img, axes, data, dataview): """updates the graph on screen with the given x and y coordinates""" ydata = analysis.ydata_calc(data, dataview) img.set_ydata(ydata) img.figure.canvas.draw()
def graph_pyqt(curve1, curve2, data, dataview): xdata = analysis.xdata_calc(data, dataview) ydata = analysis.ydata_calc(data, dataview) curve1.setData(xdata, ydata, pen="w") curve2.setData(xdata, ydata, pen="w")