Commit 8e7707c0 authored by JosefBrandt's avatar JosefBrandt

Small Bugfixes / Optimizations

parent 3ad72d39
......@@ -6,3 +6,7 @@ gepard\.cfg
analysis/database_config\.txt
*.so
*.c
external/build/
......@@ -111,8 +111,8 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self.specNumberSelector = QtWidgets.QSpinBox()
self.specNumberSelector.setMinimumWidth(100)
self.specNumberSelector.setMinimum(1)
numParticles = self.particleContainer.getNumberOfParticles()
self.specNumberSelector.setMaximum(numParticles)
numSpectra = self.particleContainer.getNumberOfMeasurements()
self.specNumberSelector.setMaximum(numSpectra)
self.jumpToSpecBtn = QtWidgets.QPushButton('Jump To Spectrum of Number:')
self.jumpToSpecBtn.released.connect(self.jumpToIndicatedSpectrum)
......@@ -387,8 +387,8 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self.typeSelectorCombo.addItems(uniquePolymers)
self.typeSelectorCombo.currentIndexChanged.connect(self.setTypeSelector)
numParticles = self.particleContainer.getNumberOfParticles()
self.specNumberSelector.setMaximum(numParticles)
numSpectra = self.particleContainer.getNumberOfMeasurements()
self.specNumberSelector.setMaximum(numSpectra)
def initializeSpecPlot(self):
self.specPlot.loadSpectraAndInitializeSpecPlot()
......@@ -531,7 +531,6 @@ class ParticleAnalysis(QtWidgets.QMainWindow):
self.particleSelector.setValue(partIndices.index(particleIndex)+1)
specIndices = self.particleContainer.getSpectraIndicesOfParticle(self.currentParticleIndex)
self.spectrumSelector.setValue(1)
self.spectrumSelector.setMaximum(len(specIndices))
......
......@@ -176,6 +176,9 @@ class ParticleContainer(object):
def getNumberOfParticles(self):
return len(self.particles)
def getNumberOfMeasurements(self):
return len(self.measurements)
def getParticleContours(self):
contours = [part.contour for part in self.particles]
return contours
......
......@@ -166,7 +166,7 @@ class ParticlePainter(QtWidgets.QGraphicsItem):
painter.drawEllipse(p[0]-p[2], p[1]-p[2], 2*p[2], 2*p[2])
if self.pixmap is not None:
painter.setOpacity(0.6)
painter.setOpacity(0.4)
painter.drawPixmap(self.topLeft[1], self.topLeft[0], self.pixmap)
......
......@@ -252,6 +252,9 @@ class DataSet(object):
self.particleContainer.clearMeasurements()
if self.particles2spectra is None:
self.particles2spectra = [[int(np.where(self.ramanscansortindex == i)[0])] for i in range(len(self.ramanscansortindex))]
if len(self.particlestats) > 0: #i.e., particle detection was completed and particle data is there
self.particleDetectionDone = True
for particleIndex, listOfScanIndices in enumerate(self.particles2spectra):
......@@ -259,11 +262,12 @@ class DataSet(object):
curParticle.measurements = []
for scanIndex in listOfScanIndices:
indexOfNewMeas = self.particleContainer.addEmptyMeasurement()
x, y = self.ramanpoints[indexOfNewMeas][0], self.ramanpoints[indexOfNewMeas][1]
indexOfMeasInRamanPoints = self.ramanscansortindex[scanIndex]
x, y = self.ramanpoints[indexOfMeasInRamanPoints][0], self.ramanpoints[indexOfMeasInRamanPoints][1]
self.particleContainer.setMeasurementPixelCoords(indexOfNewMeas, x, y)
self.particleContainer.setMeasurementScanIndex(indexOfNewMeas, scanIndex)
curParticle.addMeasurement(self.particleContainer.measurements[indexOfNewMeas])
for particle in self.particleContainer.particles:
for meas in particle.measurements:
specIndex = meas.getScanIndex()
......
......@@ -672,7 +672,6 @@ class ParticleDetectionView(QtWidgets.QWidget):
particleContainer.setMeasurementPixelCoords(indexOfNewMeas, point.x, point.y)
curParticle.addMeasurement(particleContainer.measurements[indexOfNewMeas])
self.dataset.ramanpoints = measurementPoints
self.dataset.particleDetectionDone = True
self.dataset.mode = "prepareraman"
self.dataset.save()
......
......@@ -329,8 +329,8 @@ if __name__ == '__main__':
logname = os.path.join(logpath, 'logfile.txt')
fp = open(logname, "a")
# sys.stderr = fp
# sys.stdout = fp
sys.stderr = fp
sys.stdout = fp
print("starting GEPARD at: " + strftime("%d %b %Y %H:%M:%S", localtime()), flush=True)
gepard = GEPARDMainWindow(logpath)
......
......@@ -234,7 +234,6 @@ class RamanScanUI(QtWidgets.QWidget):
for measIndex, ramanScanIndex in enumerate(cmin):
self.dataset.particleContainer.setMeasurementScanIndex(measIndex, ramanScanIndex)
self.dataset.ramanscansortindex = cmin
self.view.saveDataSet()
self.view.prepareAnalysis()
self.view.scaleImage(2.0)
......
......@@ -555,18 +555,11 @@ class SampleView(QtWidgets.QGraphicsView):
def prepareAnalysis(self):
self.clearItems()
if self.dataset.particleDetectionDone:
data = []
for i in self.dataset.ramanscansortindex:
data.append(list(self.dataset.ramanpoints[i]))
for i in range(len(data)):
item = RamanScanIndicator(self, i+1, 20, (data[i][0],data[i][1]))
for meas in self.dataset.particleContainer.measurements:
number = meas.ramanScanIndex+1
item = RamanScanIndicator(self, number, 20, (meas.pixelcoord_x, meas.pixelcoord_y))
self.scene().addItem(item)
self.ramanscanitems.append(item)
# for index, meas in enumerate(self.dataset.particleContainer.measurements):
# number = meas.ramanScanIndex+1
# item = RamanScanIndicator(self, number, 20, (meas.pixelcoord_x, meas.pixelcoord_y))
# self.scene().addItem(item)
# self.ramanscanitems.append(item)
def resetParticleContours(self):
t0 = time.time()
......
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