Commit db41ac66 authored by Robert's avatar Robert Committed by ohmacht@zwei-g.de

-adds way to import spectra file, even if file spectra.npy exists

parent 58513c6f
......@@ -90,11 +90,11 @@ class ParticleContainer(object):
def getMeasurementScanindex(self, indexOfMeasurement) -> int:
return self.measurements[indexOfMeasurement].getScanIndex()
def getSpectraFromDisk(self) -> np.ndarray:
def getSpectraFromDisk(self, forceDialog=False) -> np.ndarray:
spectra = None
if specImportEnabled:
specPath = self.datasetParent.getSpectraFileName()
if os.path.exists(specPath):
if os.path.exists(specPath) and not forceDialog:
spectra = np.load(specPath)
else:
fname = QtWidgets.QFileDialog.getOpenFileName(QtWidgets.QWidget(), 'Select Spectra File',
......
......@@ -263,8 +263,8 @@ class SpectraPlot(QtWidgets.QGroupBox):
def setDataSet(self, data_set):
self.dataset = data_set
def loadSpectraAndInitializeSpecPlot(self):
self.spectra = self.dataset.particleContainer.getSpectraFromDisk()
def loadSpectraAndInitializeSpecPlot(self, forceDialog=False):
self.spectra = self.dataset.particleContainer.getSpectraFromDisk(forceDialog)
self.canvas.draw()
def updateParticleSpectrum(self, specIndex, assignment, hqi):
......
......@@ -51,6 +51,8 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
self.specPlotInitialized = False
self.setWindowTitle('Results of polymer analysis')
self.parent = parent
self.layout = QtWidgets.QHBoxLayout()
......@@ -378,7 +380,8 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self.expSQLAct.setDisabled(False)
def initializeSpecPlot(self):
self.specPlot.loadSpectraAndInitializeSpecPlot()
self.specPlot.loadSpectraAndInitializeSpecPlot(self.specPlotInitialized)
self.specPlotInitialized = True
self.updateSpecPlot()
def updateTypeHistogram(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment