Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt at extracting certain frames from the main window #297

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions gui/acquisition/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .vector_params import VectorParamsFrame
from .multicol_params import MultiColParamsFrame
from .characterize_params import CharacterizeParamsFrame
from .raster_params import RasterParamsFrame
from .processing_options import ProcessingOptionsFrame
55 changes: 55 additions & 0 deletions gui/acquisition/characterize_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from qtpy import QtWidgets, QtCore


class CharacterizeParamsFrame(QtWidgets.QFrame):
def __init__(self, parent):
super().__init__(parent)
vBoxCharacterizeParams1 = QtWidgets.QVBoxLayout()
self.hBoxCharacterizeLayout1 = QtWidgets.QHBoxLayout()
self.characterizeTargetLabel = QtWidgets.QLabel("Characterization Targets")
characterizeResoLabel = QtWidgets.QLabel("Resolution")
characterizeResoLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeResoEdit = QtWidgets.QLineEdit("3.0")
characterizeISIGLabel = QtWidgets.QLabel("I/Sigma")
characterizeISIGLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeISIGEdit = QtWidgets.QLineEdit("2.0")
self.characterizeAnomCheckBox = QtWidgets.QCheckBox("Anomolous")
self.characterizeAnomCheckBox.setChecked(False)
self.hBoxCharacterizeLayout2 = QtWidgets.QHBoxLayout()
characterizeCompletenessLabel = QtWidgets.QLabel("Completeness")
characterizeCompletenessLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeCompletenessEdit = QtWidgets.QLineEdit("0.99")
characterizeMultiplicityLabel = QtWidgets.QLabel("Multiplicity")
characterizeMultiplicityLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeMultiplicityEdit = QtWidgets.QLineEdit("auto")
characterizeDoseLimitLabel = QtWidgets.QLabel("Dose Limit")
characterizeDoseLimitLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeDoseLimitEdit = QtWidgets.QLineEdit("100")
characterizeSpaceGroupLabel = QtWidgets.QLabel("Space Group")
characterizeSpaceGroupLabel.setAlignment(QtCore.Qt.AlignCenter)
self.characterizeSpaceGroupEdit = QtWidgets.QLineEdit("P1")
self.hBoxCharacterizeLayout1.addWidget(characterizeResoLabel)
self.hBoxCharacterizeLayout1.addWidget(self.characterizeResoEdit)
self.hBoxCharacterizeLayout1.addWidget(characterizeISIGLabel)
self.hBoxCharacterizeLayout1.addWidget(self.characterizeISIGEdit)
self.hBoxCharacterizeLayout1.addWidget(characterizeSpaceGroupLabel)
self.hBoxCharacterizeLayout1.addWidget(self.characterizeSpaceGroupEdit)
self.hBoxCharacterizeLayout1.addWidget(self.characterizeAnomCheckBox)
self.hBoxCharacterizeLayout2.addWidget(characterizeCompletenessLabel)
self.hBoxCharacterizeLayout2.addWidget(self.characterizeCompletenessEdit)
self.hBoxCharacterizeLayout2.addWidget(characterizeMultiplicityLabel)
self.hBoxCharacterizeLayout2.addWidget(self.characterizeMultiplicityEdit)
self.hBoxCharacterizeLayout2.addWidget(characterizeDoseLimitLabel)
self.hBoxCharacterizeLayout2.addWidget(self.characterizeDoseLimitEdit)
vBoxCharacterizeParams1.addWidget(self.characterizeTargetLabel)
vBoxCharacterizeParams1.addLayout(self.hBoxCharacterizeLayout1)
vBoxCharacterizeParams1.addLayout(self.hBoxCharacterizeLayout2)
self.setLayout(vBoxCharacterizeParams1)

def get_params(self):
return {
"aimed_completeness": float(self.characterizeCompletenessEdit.text()),
"aimed_multiplicity": str(self.characterizeMultiplicityEdit.text()),
"aimed_resolution": float(self.characterizeResoEdit.text()),
"aimed_ISig": float(self.characterizeISIGEdit.text()),
}
18 changes: 18 additions & 0 deletions gui/acquisition/multicol_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from qtpy import QtWidgets, QtCore


class MultiColParamsFrame(QtWidgets.QFrame):
def __init__(self, parent):
super().__init__(parent)
self.hBoxMultiColParamsLayout1 = QtWidgets.QHBoxLayout()
self.hBoxMultiColParamsLayout1.setAlignment(QtCore.Qt.AlignLeft)
multiColCutoffLabel = QtWidgets.QLabel("Diffraction Cutoff")
multiColCutoffLabel.setFixedWidth(110)
self.multiColCutoffEdit = QtWidgets.QLineEdit(
"320"
) # may need to store this in DB at some point, it's a silly number for now
self.multiColCutoffEdit.setFixedWidth(60)
self.hBoxMultiColParamsLayout1.addWidget(multiColCutoffLabel)
self.hBoxMultiColParamsLayout1.addWidget(self.multiColCutoffEdit)
self.setLayout(self.hBoxMultiColParamsLayout1)

33 changes: 33 additions & 0 deletions gui/acquisition/processing_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from qtpy import QtWidgets, QtCore


class ProcessingOptionsFrame(QtWidgets.QFrame):
def __init__(self, parent):
super().__init__(parent)
self.hBoxProcessingLayout1 = QtWidgets.QHBoxLayout()
self.hBoxProcessingLayout1.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)
procOptionLabel = QtWidgets.QLabel("Processing Options:")
procOptionLabel.setFixedWidth(200)
self.autoProcessingCheckBox = QtWidgets.QCheckBox("AutoProcessing On")
self.autoProcessingCheckBox.setChecked(True)
self.autoProcessingCheckBox.stateChanged.connect(self.autoProcessingCheckCB)
self.fastEPCheckBox = QtWidgets.QCheckBox("FastEP")
self.fastEPCheckBox.setChecked(False)
self.fastEPCheckBox.setEnabled(False)
self.dimpleCheckBox = QtWidgets.QCheckBox("Dimple")
self.dimpleCheckBox.setChecked(True)
self.xia2CheckBox = QtWidgets.QCheckBox("Xia2")
self.xia2CheckBox.setChecked(False)
self.hBoxProcessingLayout1.addWidget(self.autoProcessingCheckBox)
self.hBoxProcessingLayout1.addWidget(self.fastEPCheckBox)
self.hBoxProcessingLayout1.addWidget(self.dimpleCheckBox)
self.setLayout(self.hBoxProcessingLayout1)

def autoProcessingCheckCB(self, state):
if state == QtCore.Qt.CheckState.Checked:
self.dimpleCheckBox.setEnabled(True)
self.xia2CheckBox.setEnabled(True)
else:
self.fastEPCheckBox.setEnabled(False)
self.dimpleCheckBox.setEnabled(False)
self.xia2CheckBox.setEnabled(False)
105 changes: 105 additions & 0 deletions gui/acquisition/raster_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
from qtpy import QtWidgets, QtCore, QtGui
from enum import Enum
import typing
import db_lib, daq_utils

if typing.TYPE_CHECKING:
from gui.control_main import ControlMain


class RasterStep(float, Enum):
COARSE = 20.0
FINE = 10.0
VFINE = 5.0


class RasterParamsFrame(QtWidgets.QFrame):
def __init__(self, parent):
super().__init__(parent)
self.rasterStep: float = RasterStep.COARSE.value

self.vBoxRasterParams = QtWidgets.QVBoxLayout()
self.hBoxRasterLayout1 = QtWidgets.QHBoxLayout()
self.hBoxRasterLayout1.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)
self.hBoxRasterLayout2 = QtWidgets.QHBoxLayout()
self.hBoxRasterLayout2.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeft)
rasterStepLabel = QtWidgets.QLabel("Raster Step")
rasterStepLabel.setFixedWidth(110)
self.rasterStepEdit = QtWidgets.QLineEdit(str(RasterStep.COARSE.value))
self.rasterStepEdit.setValidator(QtGui.QDoubleValidator())
self.rasterStepEdit.textChanged.connect(self.rasterStepChanged)
self.rasterStepEdit.setFixedWidth(60)
self.rasterGrainRadioGroup = QtWidgets.QButtonGroup()
self.rasterGrainCoarseRadio = QtWidgets.QRadioButton("Coarse")
self.rasterGrainCoarseRadio.setChecked(False)
self.rasterGrainCoarseRadio.toggled.connect(
lambda: self.rasterGrainToggledCB(RasterStep.COARSE)
)
self.rasterGrainRadioGroup.addButton(self.rasterGrainCoarseRadio)
self.rasterGrainFineRadio = QtWidgets.QRadioButton("Fine")
self.rasterGrainFineRadio.setChecked(False)
self.rasterGrainFineRadio.toggled.connect(
lambda: self.rasterGrainToggledCB(RasterStep.FINE)
)
self.rasterGrainRadioGroup.addButton(self.rasterGrainFineRadio)
self.rasterGrainVFineRadio = QtWidgets.QRadioButton("VFine")
self.rasterGrainVFineRadio.setChecked(False)
self.rasterGrainVFineRadio.toggled.connect(
lambda: self.rasterGrainToggledCB(RasterStep.VFINE)
)
self.rasterGrainRadioGroup.addButton(self.rasterGrainVFineRadio)
self.rasterGrainCustomRadio = QtWidgets.QRadioButton("Custom")
self.rasterGrainCustomRadio.setChecked(True)
self.rasterGrainCustomRadio.toggled.connect(
lambda: self.rasterStepChanged(self.rasterStepEdit.text())
)
self.rasterGrainRadioGroup.addButton(self.rasterGrainCustomRadio)
rasterEvalLabel = QtWidgets.QLabel("Raster\nEvaluate By:")
rasterEvalOptionList = ["Spot Count", "Resolution", "Intensity"]
self.rasterEvalComboBox = QtWidgets.QComboBox(self)
self.rasterEvalComboBox.addItems(rasterEvalOptionList)
self.rasterEvalComboBox.setCurrentIndex(
db_lib.beamlineInfo(daq_utils.beamline, "rasterScoreFlag")["index"]
)
self.rasterEvalComboBox.activated.connect(self.rasterEvalComboActivatedCB)
self.hBoxRasterLayout1.addWidget(rasterStepLabel)
self.hBoxRasterLayout1.addWidget(self.rasterStepEdit)
self.hBoxRasterLayout1.addWidget(self.rasterGrainCoarseRadio)
self.hBoxRasterLayout1.addWidget(self.rasterGrainFineRadio)
self.hBoxRasterLayout1.addWidget(self.rasterGrainVFineRadio)
self.hBoxRasterLayout1.addWidget(self.rasterGrainCustomRadio)
self.hBoxRasterLayout1.addWidget(rasterEvalLabel)
self.hBoxRasterLayout1.addWidget(self.rasterEvalComboBox)
self.vBoxRasterParams.addLayout(self.hBoxRasterLayout1)
self.vBoxRasterParams.addLayout(self.hBoxRasterLayout2)
self.setLayout(self.vBoxRasterParams)

def rasterGrainToggledCB(self, identifier: RasterStep):
self.rasterStepEdit.setText(str(identifier.value))
self.rasterStep = identifier.value

def rasterStepChanged(self, text):
self.rasterStep = float(text)

def rasterEvalComboActivatedCB(self, text):
db_lib.beamlineInfo(
daq_utils.beamline,
"rasterScoreFlag",
info_dict={"index": self.rasterEvalComboBox.findText(str(text))},
)
if self.parent().currentRasterCellList != []:
self.parent().reFillPolyRaster()

def parent(self):
return typing.cast("ControlMain", super().parent())

def setGridStep(self, value: float):
self.rasterStepEdit.setText(str(value))
if value == RasterStep.COARSE:
self.rasterGrainCoarseRadio.setChecked(True)
elif value == RasterStep.FINE:
self.rasterGrainFineRadio.setChecked(True)
elif value == RasterStep.VFINE:
self.rasterGrainVFineRadio.setChecked(True)
else:
self.rasterGrainCustomRadio.setChecked(True)
42 changes: 42 additions & 0 deletions gui/acquisition/vector_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from qtpy import QtWidgets
from qtpy.QtGui import QIntValidator
import typing

if typing.TYPE_CHECKING:
from gui.control_main import ControlMain


class VectorParamsFrame(QtWidgets.QFrame):
def __init__(self, parent):
super().__init__(parent)
hBoxVectorLayout1 = QtWidgets.QHBoxLayout()
setVectorStartButton = QtWidgets.QPushButton("Vector\nStart")
setVectorStartButton.setStyleSheet("background-color: blue")
setVectorStartButton.clicked.connect(
lambda: self.parent().setVectorPointCB("vectorStart")
)
setVectorEndButton = QtWidgets.QPushButton("Vector\nEnd")
setVectorEndButton.setStyleSheet("background-color: red")
setVectorEndButton.clicked.connect(
lambda: self.parent().setVectorPointCB("vectorEnd")
)
vectorFPPLabel = QtWidgets.QLabel("Number of Wedges")
self.vectorFPP_ledit = QtWidgets.QLineEdit("1")
self.vectorFPP_ledit.setValidator(QIntValidator(self))
vecLenLabel = QtWidgets.QLabel(" Length(microns):")
self.vecLenLabelOutput = QtWidgets.QLabel("---")
vecSpeedLabel = QtWidgets.QLabel(" Speed(microns/s):")
self.vecSpeedLabelOutput = QtWidgets.QLabel("---")
hBoxVectorLayout1.addWidget(setVectorStartButton)
hBoxVectorLayout1.addWidget(setVectorEndButton)
hBoxVectorLayout1.addWidget(vectorFPPLabel)
hBoxVectorLayout1.addWidget(self.vectorFPP_ledit)
hBoxVectorLayout1.addWidget(vecLenLabel)
hBoxVectorLayout1.addWidget(self.vecLenLabelOutput)
hBoxVectorLayout1.addWidget(vecSpeedLabel)
hBoxVectorLayout1.addWidget(self.vecSpeedLabelOutput)
self.setLayout(hBoxVectorLayout1)

def parent(self):
return typing.cast("ControlMain", super().parent())

Loading