Commit 25423ad8 authored by Josef Brandt's avatar Josef Brandt

Further bugfixes and comort functions

Color mode is fixed (bgr2rgb not needed),
More hotkeys,
Preparation for Renishaw interface (handles raman measurement differently),
"Measure fraction of particles" now keeps all particles, but measures only a fraction of them,
Better Navigation in Analysisview (button press responses)
parent ad95af53
...@@ -14,3 +14,7 @@ external/build/ ...@@ -14,3 +14,7 @@ external/build/
.idea/ .idea/
*.pyd *.pyd
ramancom/renishawcom.py
ramancom/renishawtesting.py
...@@ -205,12 +205,17 @@ class GEPARDMainWindow(QtWidgets.QMainWindow): ...@@ -205,12 +205,17 @@ class GEPARDMainWindow(QtWidgets.QMainWindow):
self.configRamanCtrlAct.setDisabled(True) self.configRamanCtrlAct.setDisabled(True)
self.noOverlayAct = QtWidgets.QAction("&No Overlay", self) self.noOverlayAct = QtWidgets.QAction("&No Overlay", self)
self.noOverlayAct.setShortcut("1")
self.selOverlayAct = QtWidgets.QAction("&Selected Overlay", self) self.selOverlayAct = QtWidgets.QAction("&Selected Overlay", self)
self.selOverlayAct.setShortcut("2")
self.fullOverlayAct = QtWidgets.QAction("&Full Overlay", self) self.fullOverlayAct = QtWidgets.QAction("&Full Overlay", self)
self.fullOverlayAct.setShortcut("3")
self.transpAct = QtWidgets.QAction("&Transparent Overlay", self) self.transpAct = QtWidgets.QAction("&Transparent Overlay", self)
self.transpAct.setShortcut("T")
self.hideLabelAct = QtWidgets.QAction('&Hide Spectra Numbers', self) self.hideLabelAct = QtWidgets.QAction('&Hide Spectra Numbers', self)
self.hideLabelAct.setShortcut("H") self.hideLabelAct.setShortcut("H")
self.darkenAct = QtWidgets.QAction("&Darken Image", self) self.darkenAct = QtWidgets.QAction("&Darken Image", self)
self.darkenAct.setShortcut("D")
self.seedAct = QtWidgets.QAction("&Set Color Seed", self) self.seedAct = QtWidgets.QAction("&Set Color Seed", self)
for act in [self.noOverlayAct, self.selOverlayAct, self.fullOverlayAct, self.hideLabelAct, self.transpAct, self.darkenAct, self.seedAct]: for act in [self.noOverlayAct, self.selOverlayAct, self.fullOverlayAct, self.hideLabelAct, self.transpAct, self.darkenAct, self.seedAct]:
......
...@@ -209,13 +209,19 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox): ...@@ -209,13 +209,19 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox):
self.particleSelector.setValue(partIndices.index(particleIndex)+1) self.particleSelector.setValue(partIndices.index(particleIndex)+1)
specIndices = self.particleContainer.getSpectraIndicesOfParticle(self.currentParticleIndex) specIndices = self.particleContainer.getSpectraIndicesOfParticle(self.currentParticleIndex)
self.spectrumSelector.setValue(1) if len(specIndices) > 0:
self.spectrumSelector.setMaximum(len(specIndices)) self.spectrumSelector.setDisabled(False)
self.spectrumSelector.setValue(1)
self.spectrumSelector.setMaximum(len(specIndices))
self.currentSpectrumIndex = specIndices[self.spectrumSelector.value()-1]
self.specNumberSelector.setValue(self.currentSpectrumIndex+1)
else:
self.spectrumSelector.setDisabled(True)
self.spectrumSelector.setValue(0)
self.spectrumSelector.setMaximum(0)
self.spectrumNumberLabel.setText(f'of {len(specIndices)} spectra') self.spectrumNumberLabel.setText(f'of {len(specIndices)} spectra')
self.currentSpectrumIndex = specIndices[self.spectrumSelector.value()-1]
self.specNumberSelector.setValue(self.currentSpectrumIndex+1)
self.typeSelectorCombo.currentIndexChanged.connect(self.setTypeSelector) self.typeSelectorCombo.currentIndexChanged.connect(self.setTypeSelector)
self.spectrumSelector.valueChanged.connect(self.setSpecSelector) self.spectrumSelector.valueChanged.connect(self.setSpecSelector)
self.particleSelector.valueChanged.connect(self.setParticleSelector) self.particleSelector.valueChanged.connect(self.setParticleSelector)
...@@ -232,10 +238,6 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox): ...@@ -232,10 +238,6 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox):
def setParticleSelector(self): def setParticleSelector(self):
assignment = self.typeSelectorCombo.currentText() assignment = self.typeSelectorCombo.currentText()
if assignment != '': if assignment != '':
# if self.lastParticleIndex is not None:
# self.currentParticleIndex = self.lastParticleIndex
# self.lastParticleIndex = None
# else:
partIndices = self.particleContainer.getIndicesOfParticleType(assignment) partIndices = self.particleContainer.getIndicesOfParticleType(assignment)
self.currentParticleIndex = partIndices[self.particleSelector.value()-1] self.currentParticleIndex = partIndices[self.particleSelector.value()-1]
...@@ -246,22 +248,22 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox): ...@@ -246,22 +248,22 @@ class PolymerNavigationToolbar(QtWidgets.QGroupBox):
self.setSpecSelector() self.setSpecSelector()
def setSpecSelector(self): def setSpecSelector(self):
# if self.lastSpecIndex is not None:
# self.currentSpectrumIndex = self.lastSpecIndex
# self.lastSpecIndex = None
# else:
specIndices = self.particleContainer.getSpectraIndicesOfParticle(self.currentParticleIndex) specIndices = self.particleContainer.getSpectraIndicesOfParticle(self.currentParticleIndex)
self.currentSpectrumIndex = specIndices[self.spectrumSelector.value()-1] if len(specIndices) == 0:
self.spectrumSelector.setDisabled(True)
self.specNumberSelector.setValue(self.currentSpectrumIndex+1) else:
self.spectrumSelector.setDisabled(False)
self.WidgetsUpdated.emit()
self.JumpToIndicatedSpec.emit() self.currentSpectrumIndex = specIndices[self.spectrumSelector.value()-1]
self.specNumberSelector.setValue(self.currentSpectrumIndex+1)
if self.lastSpecIndex is not None: if self.lastSpecIndex is not None:
self.currentParticleIndex = self.particleContainer.getParticleIndexContainingSpecIndex(self.lastSpecIndex) self.currentParticleIndex = self.particleContainer.getParticleIndexContainingSpecIndex(self.lastSpecIndex)
self.lastSpecIndex = None self.lastSpecIndex = None
self.setWidgetsToNewParticleIndex(self.currentParticleIndex) self.setWidgetsToNewParticleIndex(self.currentParticleIndex)
self.JumpToIndicatedSpec.emit()
self.WidgetsUpdated.emit()
class FindColoredParticleWindow(QtWidgets.QWidget): class FindColoredParticleWindow(QtWidgets.QWidget):
......
...@@ -76,7 +76,6 @@ class ExpExcelDialog(QtWidgets.QDialog): ...@@ -76,7 +76,6 @@ class ExpExcelDialog(QtWidgets.QDialog):
polymers = np.array(self.particleContainer.getListOfParticleAssignments()) polymers = np.array(self.particleContainer.getListOfParticleAssignments())
sizes = np.array(self.particleContainer.getSizesOfAllParticles()) sizes = np.array(self.particleContainer.getSizesOfAllParticles())
for box in self.checkBoxes: for box in self.checkBoxes:
if box.isChecked() == True: if box.isChecked() == True:
if box.text() != 'Size Classes': if box.text() != 'Size Classes':
......
...@@ -121,7 +121,6 @@ class LoadTrueMatchResults(QtWidgets.QWidget): ...@@ -121,7 +121,6 @@ class LoadTrueMatchResults(QtWidgets.QWidget):
print('spectra in batch:', len(resBatch)) print('spectra in batch:', len(resBatch))
for result in resBatch: for result in resBatch:
specIndex, polymertype, additive, hqi, addhqi = self.interpretEntry(resBatchIndex, numSpectraInPreviousBatches, result, numhits, numcomps) specIndex, polymertype, additive, hqi, addhqi = self.interpretEntry(resBatchIndex, numSpectraInPreviousBatches, result, numhits, numcomps)
print('assigning currentSpecIndex', specIndex)
self.polymertypes[specIndex] = polymertype self.polymertypes[specIndex] = polymertype
self.hqis[specIndex] = hqi self.hqis[specIndex] = hqi
if numcomps > 1: if numcomps > 1:
......
...@@ -44,13 +44,19 @@ class Particle(object): ...@@ -44,13 +44,19 @@ class Particle(object):
meas.setHQI(100) meas.setHQI(100)
def getParticleAssignment(self): def getParticleAssignment(self):
return self.getMeasAssignmentWithHighestHQI() #probably another method could be more suitable... assignment = 'NotYetMeasured'
if len(self.measurements) > 0:
assignment = self.getMeasAssignmentWithHighestHQI() #probably another method could be more suitable...
return assignment
def getHighestHQI(self): def getHighestHQI(self):
hqis = [] maxHQI = None
for meas in self.measurements: if len(self.measurements) > 0:
hqis.append(meas.getHQI()) hqis = []
return max(hqis) for meas in self.measurements:
hqis.append(meas.getHQI())
maxHQI = max(hqis)
return maxHQI
def getHQIOfMeasurementIndex(self, index): def getHQIOfMeasurementIndex(self, index):
for meas in self.measurements: for meas in self.measurements:
......
...@@ -239,7 +239,7 @@ def getParticleCenterPoint(contour): ...@@ -239,7 +239,7 @@ def getParticleCenterPoint(contour):
return x, y return x, y
def loadFullimageFromDataset(dataset): def loadFullimageFromDataset(dataset):
return cv2imread_fix(dataset.getImageName(), cv2.COLOR_BGR2RGB) return cv2imread_fix(dataset.getImageName())
def loadZValImageFromDataset(dataset): def loadZValImageFromDataset(dataset):
return cv2imread_fix(dataset.getZvalImageName(), cv2.IMREAD_GRAYSCALE) return cv2imread_fix(dataset.getZvalImageName(), cv2.IMREAD_GRAYSCALE)
\ No newline at end of file
...@@ -44,6 +44,8 @@ class ParticleContainer(object): ...@@ -44,6 +44,8 @@ class ParticleContainer(object):
def clearMeasurements(self): def clearMeasurements(self):
self.measurements = [] self.measurements = []
for particle in self.particles:
particle.measurements = []
def setMeasurementScanIndex(self, indexOfMeasurment, scanIndex): def setMeasurementScanIndex(self, indexOfMeasurment, scanIndex):
self.measurements[indexOfMeasurment].ramanScanIndex = scanIndex self.measurements[indexOfMeasurment].ramanScanIndex = scanIndex
...@@ -94,7 +96,7 @@ class ParticleContainer(object): ...@@ -94,7 +96,7 @@ class ParticleContainer(object):
particle.contour = contours[index] particle.contour = contours[index]
def setParticleStats(self, particlestats): def setParticleStats(self, particlestats):
assert len(self.particles) == len(particlestats) assert len(self.particles) == len(particlestats), f'numParticles = {len(self.particles)}, len partStats = {len(particlestats)}'
for index, particle in enumerate(self.particles): for index, particle in enumerate(self.particles):
particle.__dict__.update(particlestats[index].__dict__) particle.__dict__.update(particlestats[index].__dict__)
......
...@@ -148,7 +148,7 @@ class DataSet(object): ...@@ -148,7 +148,7 @@ class DataSet(object):
'minparticlearea': 20, 'minparticlearea': 20,
'minparticledistance': 20, 'minparticledistance': 20,
'measurefrac': 1, 'measurefrac': 1,
'compactness': 0.1, 'compactness': 0.0,
'seedRad': 3} 'seedRad': 3}
self.particleContainer = ParticleContainer(self) self.particleContainer = ParticleContainer(self)
......
...@@ -20,11 +20,14 @@ If not, see <https://www.gnu.org/licenses/>. ...@@ -20,11 +20,14 @@ If not, see <https://www.gnu.org/licenses/>.
""" """
import numpy as np import numpy as np
from PyQt5 import QtCore, QtWidgets, QtGui from PyQt5 import QtCore, QtWidgets, QtGui
from .segmentation import Segmentation
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from threading import Thread from threading import Thread
from .segmentation import Segmentation
from .analysis.particleCharacterization import getParticleStatsWithPixelScale, loadZValImageFromDataset
from .errors import InvalidParticleError
Nscreen = 1000 Nscreen = 1000
class HistWidget(QtWidgets.QWidget): class HistWidget(QtWidgets.QWidget):
...@@ -377,8 +380,8 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -377,8 +380,8 @@ class ParticleDetectionView(QtWidgets.QWidget):
grid.addWidget(label, i+1, 0, QtCore.Qt.AlignLeft) grid.addWidget(label, i+1, 0, QtCore.Qt.AlignLeft)
grid.addWidget(self.seedradiusedit, i+1, 1, QtCore.Qt.AlignLeft) grid.addWidget(self.seedradiusedit, i+1, 1, QtCore.Qt.AlignLeft)
grid.addWidget(self.showseedpoints, i+2, 0, 1, 2, QtCore.Qt.AlignLeft) grid.addWidget(self.showseedpoints, i+2, 0, 1, 2, QtCore.Qt.AlignLeft)
grid.addWidget(QtWidgets.QLabel("Use Ctrl for seeds and Ctrl+Shift for delete points"), i+3, 0, 1, 2, QtCore.Qt.AlignLeft) grid.addWidget(QtWidgets.QLabel("Click mouse to add seeds, Click+Shift to add deletepoints"), i+3, 0, 1, 2, QtCore.Qt.AlignLeft)
grid.addWidget(QtWidgets.QLabel("Ctrl+Alt removes seeds near cursor"), i+4, 0, 1, 2, QtCore.Qt.AlignLeft) grid.addWidget(QtWidgets.QLabel("Click+Alt removes seeds near cursor"), i+4, 0, 1, 2, QtCore.Qt.AlignLeft)
group.setLayout(grid) group.setLayout(grid)
vbox.addWidget(group) vbox.addWidget(group)
...@@ -565,18 +568,12 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -565,18 +568,12 @@ class ParticleDetectionView(QtWidgets.QWidget):
self.seg.setParameters(**kwargs) self.seg.setParameters(**kwargs)
seedradius = self.seedradiusedit.value() seedradius = self.seedradiusedit.value()
if showname is not None: if showname is not None:
stepImg, imgtype = self.seg.apply2Image(img, self.imglabel.seedpoints, stepImg, imgtype = self.seg.apply2Image(img, self.imglabel.seedpoints, self.imglabel.seeddeletepoints,
self.imglabel.seeddeletepoints, seedradius, self.dataset, return_step=showname)
seedradius,
self.dataset,
return_step=showname)
self.imglabel.showStep(stepImg, imgtype) self.imglabel.showStep(stepImg, imgtype)
else: else:
measurementpoints, contours, particlestats = self.seg.apply2Image(img, measurementpoints, contours = self.seg.apply2Image(img, self.imglabel.seedpoints, self.imglabel.seeddeletepoints,
self.imglabel.seedpoints, seedradius, self.dataset)
self.imglabel.seeddeletepoints,
seedradius,
self.dataset)
self.imglabel.updateDetectionResults(contours, measurementpoints) self.imglabel.updateDetectionResults(contours, measurementpoints)
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
...@@ -628,15 +625,16 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -628,15 +625,16 @@ class ParticleDetectionView(QtWidgets.QWidget):
def checkOnComputation(self): def checkOnComputation(self):
if self.thread is not None: if self.thread is not None:
if not self.threadrunning: if not self.threadrunning:
#self.thread.join()
self.thread = None self.thread = None
self.unBlockUI() self.unBlockUI()
self.pdetectall.setText("Detect all") self.pdetectall.setText("Detect all")
self.imageUpdate.emit(self.view.microscopeMode) self.imageUpdate.emit(self.view.microscopeMode)
if self.dataset is not None: if self.dataset is not None:
self.setWindowTitle(str(self.dataset.particleContainer.getNumberOfParticles()) + " Particles") numParticles = self.dataset.particleContainer.getNumberOfParticles()
numMeasurements = self.dataset.particleContainer.getNumberOfMeasurements()
self.setWindowTitle(f'{numParticles} Particles ({numMeasurements} Measurements)')
else: else:
self.timer.start(100.) self.timer.start(100.)
def _worker(self): def _worker(self):
kwargs = {} kwargs = {}
...@@ -648,27 +646,27 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -648,27 +646,27 @@ class ParticleDetectionView(QtWidgets.QWidget):
kwargs[name] = valuefunc() kwargs[name] = valuefunc()
seedradius = self.seedradiusedit.value() seedradius = self.seedradiusedit.value()
self.seg.setParameters(**kwargs) self.seg.setParameters(**kwargs)
measurementPoints, contours, particlestats = self.seg.apply2Image(self.img,
seedpoints, measurementPoints, contours= self.seg.apply2Image(self.img, seedpoints, deletepoints, seedradius, self.dataset)
deletepoints,
seedradius,
self.dataset)
if measurementPoints is None: # computation was canceled if measurementPoints is None: # computation was canceled
return return
if self.dataset is not None: if self.dataset is not None:
self.applyResultsToDataset(measurementPoints, contours, particlestats) self.applyResultsToDataset(measurementPoints, contours)
self.threadrunning = False self.threadrunning = False
def applyResultsToDataset(self, measurementPoints, contours, particlestats): def applyResultsToDataset(self, measurementPoints, contours):
self.dataset.ramanscandone = False self.dataset.ramanscandone = False
particlestats = self.getParticleStats(contours)
particleContainer = self.dataset.particleContainer particleContainer = self.dataset.particleContainer
numParticles = len(contours) numParticles = len(contours)
particleContainer.initializeParticles(numParticles) particleContainer.initializeParticles(numParticles)
particleContainer.setParticleContours(contours) particleContainer.setParticleContours(contours)
particleContainer.setParticleStats(particlestats) particleContainer.setParticleStats(particlestats)
particleContainer.clearMeasurements()
for particleIndex in measurementPoints.keys(): for particleIndex in measurementPoints.keys():
measPoints = measurementPoints[particleIndex] measPoints = measurementPoints[particleIndex]
for index, point in enumerate(measPoints): for index, point in enumerate(measPoints):
...@@ -680,3 +678,16 @@ class ParticleDetectionView(QtWidgets.QWidget): ...@@ -680,3 +678,16 @@ class ParticleDetectionView(QtWidgets.QWidget):
self.dataset.particleDetectionDone = True self.dataset.particleDetectionDone = True
self.dataset.mode = "prepareraman" self.dataset.mode = "prepareraman"
self.dataset.save() self.dataset.save()
def getParticleStats(self, contours):
particlestats = []
zvalimg = loadZValImageFromDataset(self.dataset)
for contour in contours:
try:
stats = getParticleStatsWithPixelScale(contour, self.dataset, fullimage=self.img, zimg=zvalimg)
particlestats.append(stats)
except InvalidParticleError:
print('invalid contour in detection, skipping partile. Contour is:', contour)
continue
return particlestats
\ No newline at end of file
...@@ -77,6 +77,7 @@ def legacyConversion(dset, recreatefullimage=False): ...@@ -77,6 +77,7 @@ def legacyConversion(dset, recreatefullimage=False):
del dset.particleimgs del dset.particleimgs
dset.version = 1 dset.version = 1
dset.save()
if dset.version == 1: if dset.version == 1:
print("Converting legacy version 1 to 2") print("Converting legacy version 1 to 2")
...@@ -95,17 +96,20 @@ def legacyConversion(dset, recreatefullimage=False): ...@@ -95,17 +96,20 @@ def legacyConversion(dset, recreatefullimage=False):
dset.particles2spectra = [[int(np.where(dset.ramanscansortindex == i)[0])] for i in range(len(dset.ramanscansortindex))] dset.particles2spectra = [[int(np.where(dset.ramanscansortindex == i)[0])] for i in range(len(dset.ramanscansortindex))]
dset.version = 2 dset.version = 2
dset.save()
if dset.version == 2: if dset.version == 2:
print("Converting legacy version 2 to 3") print("Converting legacy version 2 to 3")
transferParticleStatsToParticleContainer(dset) transferParticleStatsToParticleContainer(dset)
dset.version = 3 dset.version = 3
dset.save()
if dset.version == 3: if dset.version == 3:
print("Converting legacy version 3 to 4") print("Converting legacy version 3 to 4")
updateParticleStats(dset) updateParticleStats(dset)
removeLegacyAttributes(dset) removeLegacyAttributes(dset)
dset.version = 4 dset.version = 4
dset.save()
# add later conversion for higher version numbers here # add later conversion for higher version numbers here
......
...@@ -93,7 +93,7 @@ class BackGroundManager(QtWidgets.QWidget): ...@@ -93,7 +93,7 @@ class BackGroundManager(QtWidgets.QWidget):
QtWidgets.QMessageBox.about(self, 'Warning', 'No Background Image is aquired') QtWidgets.QMessageBox.about(self, 'Warning', 'No Background Image is aquired')
return return
else: else:
from opticalscan import loadAndPasteImage from .opticalscan import loadAndPasteImage
self.dataset = self.parentOSwidget.dataset self.dataset = self.parentOSwidget.dataset
#acquire images in 3x3 area to preview quality of background subtraction #acquire images in 3x3 area to preview quality of background subtraction
......
...@@ -94,7 +94,7 @@ def loadAndPasteImage(srcnames, fullimage, fullzval, width, height, ...@@ -94,7 +94,7 @@ def loadAndPasteImage(srcnames, fullimage, fullzval, width, height,
curImg = cv2imread_fix(name) curImg = cv2imread_fix(name)
if background is not None: if background is not None:
curImg = subtractBackground(curImg, background) curImg = subtractBackground(curImg, background)
colimgs.append(cv2.cvtColor(curImg, cv2.COLOR_BGR2RGB)) colimgs.append(curImg)
img, zval = imageStacking(colimgs) img, zval = imageStacking(colimgs)
x, y = p x, y = p
...@@ -276,7 +276,7 @@ class OpticalScan(QtWidgets.QWidget): ...@@ -276,7 +276,7 @@ class OpticalScan(QtWidgets.QWidget):
self.zmaxedit.setMaximumWidth(100) self.zmaxedit.setMaximumWidth(100)
label3 = QtWidgets.QLabel("Focus steps:", self) label3 = QtWidgets.QLabel("Focus steps:", self)
self.nzedit = QtWidgets.QSpinBox(self) self.nzedit = QtWidgets.QSpinBox(self)
self.nzedit.setRange(2,20) self.nzedit.setRange(1,20)
self.nzedit.setValue(3) self.nzedit.setValue(3)
self.nzedit.setMaximumWidth(100) self.nzedit.setMaximumWidth(100)
self.hdrcheck = QtWidgets.QCheckBox("High dynamic range", self) self.hdrcheck = QtWidgets.QCheckBox("High dynamic range", self)
...@@ -451,7 +451,7 @@ class OpticalScan(QtWidgets.QWidget): ...@@ -451,7 +451,7 @@ class OpticalScan(QtWidgets.QWidget):
width, height, rotationvalue = self.ramanctrl.getImageDimensions(self.view.microscopeMode) width, height, rotationvalue = self.ramanctrl.getImageDimensions(self.view.microscopeMode)
pshift = self.ramanctrl.getRamanPositionShift() pshift = self.ramanctrl.getRamanPositionShift()
self.dataset.pshift = pshift self.dataset.pshift = pshift
img = cv2.cvtColor(cv2imread_fix(self.dataset.getTmpImageName()), cv2.COLOR_BGR2RGB) img = cv2imread_fix(self.dataset.getTmpImageName())
self.dataset.imagedim_bf = self.ramanctrl.getImageDimensions('bf') self.dataset.imagedim_bf = self.ramanctrl.getImageDimensions('bf')
self.dataset.pixelscale_bf = self.dataset.imagedim_bf[0]/img.shape[1] #=imagedim_width/shape[1] self.dataset.pixelscale_bf = self.dataset.imagedim_bf[0]/img.shape[1] #=imagedim_width/shape[1]
......
...@@ -205,7 +205,7 @@ class WITecCOM(RamanBase): ...@@ -205,7 +205,7 @@ class WITecCOM(RamanBase):
z = self.PosZCurUserFloatMan.GetSingleValueAsDouble()[1] z = self.PosZCurUserFloatMan.GetSingleValueAsDouble()[1]
return z return z
def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011, debugReturn=False, measurementRunning=False): def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011):
assert self.connected assert self.connected
initpos = self.getPosition() initpos = self.getPosition()
# move only if new position is really different; repeat if new position is ignored (happens some times) # move only if new position is really different; repeat if new position is ignored (happens some times)
......
...@@ -45,7 +45,7 @@ class RamanBase(object): ...@@ -45,7 +45,7 @@ class RamanBase(object):
def getUserZ(self): def getUserZ(self):
raise NotImplementedError raise NotImplementedError
def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011, debugReturn=False, measurementRunning=False): def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011):
raise NotImplementedError raise NotImplementedError
def moveZto(self, z, epsz=0.011): def moveZto(self, z, epsz=0.011):
......
...@@ -39,10 +39,10 @@ class SimulatedRaman(RamanBase): ...@@ -39,10 +39,10 @@ class SimulatedRaman(RamanBase):
self.currentZ = 0. self.currentZ = 0.
# some plausible data to simulate consecutively changing positions # some plausible data to simulate consecutively changing positions
self.positionlist = np.array([[ -1201, 1376, -1290], self.positionlist = np.array([[ -1201, 1376, -1290],
[ -1195, -9200, -1279], [ -1195, -1200, -1279],
[ 1097, -9254, -1297], [ 1097, -1254, -1297],
[ 2704.1, -1788.2, -138.1], [ 2704.1, 1288.2, -1381],
[ 3884. , -2650.8, -138.1]]) [ 1884. , -1500.8, -1381]])
self.znum = 4 self.znum = 4
self.gridnum = 36 self.gridnum = 36
self.positionindex = 0 self.positionindex = 0
...@@ -78,7 +78,7 @@ class SimulatedRaman(RamanBase): ...@@ -78,7 +78,7 @@ class SimulatedRaman(RamanBase):
else: else:
return self.currentZ return self.currentZ
def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011, debugReturn=False, measurementRunning=False): def moveToAbsolutePosition(self, x, y, z=None, epsxy=0.11, epsz=0.011):
assert self.connected assert self.connected
print('moving to:', x, y, z, file=stdout) print('moving to:', x, y, z, file=stdout)
if z is None: if z is None:
......
...@@ -67,7 +67,7 @@ def scan(ramanSettings, positions, controlclass, dataqueue, stopevent, ...@@ -67,7 +67,7 @@ def scan(ramanSettings, positions, controlclass, dataqueue, stopevent,
x, y, z = p x, y, z = p
print("time:", time(), flush=True) print("time:", time(), flush=True)
print("position:", x, y, z, flush=True) print("position:", x, y, z, flush=True)
ramanctrl.moveToAbsolutePosition(x, y, z, measurementRunning=True) ramanctrl.moveToAbsolutePosition(x, y, z)
print("move done", flush=True) print("move done", flush=True)
ramanctrl.triggerMeasurement(i)