Skip to content

Commit

Permalink
Merge branch 'DEV' into Laudastuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mlj5j authored Oct 30, 2024
2 parents 736d210 + f872ed7 commit 043a8b7
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 39 deletions.
91 changes: 91 additions & 0 deletions Gui/QtGUIutils/QtApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from PyQt5.QtWidgets import (
QApplication,
QCheckBox,
QSpinBox,
QComboBox,
QDialog,
QGridLayout,
Expand Down Expand Up @@ -48,6 +49,8 @@
from Gui.python.SimplifiedMainWidget import SimplifiedMainWidget
# from icicle.icicle.instrument_cluster import BadStatusForOperationError, InstrumentCluster
from icicle.icicle.instrument_cluster import InstrumentCluster
from icicle.icicle.f4t_temperature_chamber import F4TTempChamber




Expand Down Expand Up @@ -761,6 +764,38 @@ def createMain(self):
self.ReviewModuleEdit.setEchoMode(QLineEdit.Normal)
self.ReviewModuleEdit.setPlaceholderText("Enter Module ID")

self.ThermalTestButton = QPushButton("&Thermal Test")
self.ThermalTestButton.setEnabled(True)
self.AbortThermalTestButton = QPushButton("&Abort thermal test")
self.AbortThermalTestButton.setEnabled(True)

# To avoid people trying to push the button without a configured
# chamber, check if the resource is defined in siteConfig first.
# Maybe catching an error isn't the prettiest way to do this
# If it is not, disable the button
try:
site_settings.temp_chamber_resource
except AttributeError:
self.ThermalTestButton.setEnabled(False)
self.AbortThermalTestButton.setEnabled(False)


self.AbortThermalTestButton.setMinimumWidth(kMinimumWidth)
self.AbortThermalTestButton.setMaximumWidth(kMaximumWidth)
self.AbortThermalTestButton.setMinimumHeight(kMinimumHeight)
self.AbortThermalTestButton.setMaximumHeight(kMaximumHeight)
self.AbortThermalTestButton.clicked.connect(self.abortThermalTest)

self.ThermalTestButton.setMinimumWidth(kMinimumWidth)
self.ThermalTestButton.setMaximumWidth(kMaximumWidth)
self.ThermalTestButton.setMinimumHeight(kMinimumHeight)
self.ThermalTestButton.setMaximumHeight(kMaximumHeight)
self.ThermalTestButton.clicked.connect(self.runThermalTest)

self.ThermalProfileEdit = QLineEdit("")
self.ThermalProfileEdit.setEchoMode(QLineEdit.Normal)
self.ThermalProfileEdit.setPlaceholderText("Enter Profile Number")

self.PeltierCooling = Peltier(100)
self.PeltierBox = QGroupBox("Peltier Controller", self)
self.PeltierLayout = QGridLayout()
Expand All @@ -778,11 +813,16 @@ def createMain(self):
layout.addWidget(ReviewLabel, 2, 1, 1, 2)
layout.addWidget(self.ReviewModuleButton, 3, 0, 1, 1)
layout.addWidget(self.ReviewModuleEdit, 3, 1, 1, 2)


self.ChillerOption = QGroupBox("Chiller", self)
self.ChillerLayout = QGridLayout()
self.ChillerOption.setLayout(self.ChillerLayout)

layout.addWidget(self.ThermalTestButton, 4, 0, 1, 1)
layout.addWidget(self.ThermalProfileEdit, 4, 1, 1, 1)
layout.addWidget(self.AbortThermalTestButton, 5, 0, 1, 1)

####################################################
# Functions for expert mode
####################################################
Expand Down Expand Up @@ -1039,6 +1079,57 @@ def destroyMain(self):
self.mainLayout.removeWidget(self.LogoGroupBox)
QApplication.closeAllWindows()

def abortThermalTest(self):
"""Stop the current profile running on thermal chamber"""
temp_chamber = F4TTempChamber(resource = site_settings.temp_chamber_resource)
with temp_chamber:
temp_chamber.set('CONTROL_PROFILE', 'STOP')
message_box = QMessageBox()
message_box.setText("Profile Aborted")
message_box.setStandardButtons(QMessageBox.Ok)
message_box.exec()

def runThermalTest(self):
# Verify input of input data:
profile_number = self.ThermalProfileEdit.text()

# Check if this value is an int
try:
profile_number = int(profile_number)
except ValueError:
QMessageBox.information(
None, "Error", "Please enter a valid profile number"
". It must be an integer", QMessageBox.Ok
)
return
# Import icicle module for temperature chamber
print(site_settings.temp_chamber_resource)
temp_chamber = F4TTempChamber(resource = site_settings.temp_chamber_resource)

#
with temp_chamber:
temp_chamber.set('SELECT_PROFILE', profile_number)
profile_name = temp_chamber.query('SELECT_PROFILE')

message_box = QMessageBox()
message_box.setText("Temperature chamber"
f"profile \"{profile_name}\" has been chosen")
message_box.setInformativeText("Is this the correct profile?")
message_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
message_box.setDefaultButton(QMessageBox.Yes)
response = message_box.exec()

if response == QMessageBox.Yes:
with temp_chamber:
temp_chamber.set('CONTROL_PROFILE', 'START')

if response == QMessageBox.No:
return





def openNewProductionTest(self):
self.ProdTestPage = QtProductionTestWindow(
self, instrumentCluster=self.instruments
Expand Down
12 changes: 7 additions & 5 deletions Gui/QtGUIutils/QtRunWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import threading
import time
import logging
import Gui.siteSettings as site_settings

from Gui.GUIutils.DBConnection import checkDBConnection
from Gui.GUIutils.guiUtils import isActive, isCompositeTest
Expand Down Expand Up @@ -66,12 +67,13 @@ def __init__(self, master, info, firmware):

# Add TestProcedureHandler
self.testHandler = TestHandler(self, master, info, firmware)
assert self.master.instruments is not None, logger.error("Unable to setup instruments")
self.testHandler.powerSignal.connect(
lambda: self.master.instruments.off(
hv_delay=0.3, hv_step_size=10, measure=False
if not site_settings.manual_powersupply_control:
assert self.master.instruments is not None, logger.error("Unable to setup instruments")
self.testHandler.powerSignal.connect(
lambda: self.master.instruments.off(
hv_delay=0.3, hv_step_size=10, measure=False
)
)
)

self.GroupBoxSeg = [1, 10, 1]
self.HorizontalSeg = [3, 5]
Expand Down
2 changes: 1 addition & 1 deletion Gui/jsonFiles/instruments_osu_relayboxsldo.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"relay_board": {
"class": "RelayBoard",
"resource": "ASRL/dev/ttyUSB0::INSTR",
"resource": "ASRL/dev/ttyUSB3::INSTR",
"sim": false,
"default_voltage": 0,
"default_current": 0
Expand Down
2 changes: 1 addition & 1 deletion Gui/python/CentralDBInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

def ExtractChipData(chipserial):
#sqlcommand = f"select c.PART_NAME_LABEL, c.VDDA_TRIM_CODE, c.VDDD_TRIM_CODE, c.EFUSE_CODE from trker_cmsr.c18220 c where c.PART_NAME_LABEL = '{chipserial}'" #example of chipserial is N61F26_16E6_45
command = f'''python rhapi.py -nx -u https://cmsdca.cern.ch/trk_rhapi "select c.PART_NAME_LABEL, c.VDDA_TRIM_CODE, c.VDDD_TRIM_CODE, c.EFUSE_CODE from trker_cmsr.c13420 c where c.PART_NAME_LABEL like '%{chipserial}%'"'''
command = f'''python rhapi.py -nx -u https://cmsdca.cern.ch/trk_rhapi1 "select c.PART_NAME_LABEL, c.VDDA_TRIM_CODE, c.VDDD_TRIM_CODE, c.EFUSE_CODE from trker_cmsr.c13420 c where c.PART_NAME_LABEL like '%{chipserial}%'"'''
#chipdata = os.popen(command).read()
chipdataoutput = os.popen(command).read()
chipdataoutput = chipdataoutput.split('\n')
Expand Down
9 changes: 4 additions & 5 deletions Gui/python/SLDOScanHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
self.moduleType = moduleType
self.PIN_MAPPINGS = {
'DEFAULT': AdcBoard.DEFAULT_PIN_MAP,
'CROC 1x2': {
'DOUBLE': {
# 0: 'VDDA_ROC2',
# 1: 'VDDA_ROC3',
# 2: 'VDDD_ROC2',
Expand All @@ -62,7 +62,7 @@ def __init__(
# 15: 'TP7A', #VOFS OUT
# 16: 'TP7B', #VOFS OUT
},
'CROC Quad': {
'QUAD': {
0: 'VDDA_ROC2',
1: 'VDDA_ROC3',
2: 'VDDD_ROC2',
Expand Down Expand Up @@ -147,7 +147,7 @@ def runWithADC(self) -> None:
Currents_Down = [res[5] for res in data_down]


for index, pin in self.PIN_MAPPINGS[self.moduleType].items():
for index, pin in self.PIN_MAPPINGS[self.moduleType.split(" ")[-1].replace("1x2","DOUBLE").upper()].items():

ADC_Voltage_Up = [res[6][index] for res in data_up]
result_up = np.array([Currents_Up, LV_Voltage_Up, ADC_Voltage_Up])
Expand Down Expand Up @@ -180,7 +180,7 @@ def runWithRelayDMM(self) -> None:
self.instruments.lv_off()
self.multimeter.set("SYSTEM_MODE","REM")
logger.info('turned off the lv and hv')
for key in self.relayboard.PIN_MAP[self.moduleType].keys():
for key in self.relayboard.PIN_MAP[self.moduleType.split(" ")[-1].replace("1x2","DOUBLE").upper()].keys():
if "VDD" in key:
self.pin_list.append(key)
print('adding {0} to pin_list'.format(key))
Expand All @@ -204,7 +204,6 @@ def runWithRelayDMM(self) -> None:
measure_args={},
set_property="current",
)

self.determineLVIndex(results)
results = results[self.LV_index][1]

Expand Down
18 changes: 9 additions & 9 deletions Gui/python/SimplifiedMainWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ def setupUI(self):
self.StartLayout = QHBoxLayout()
self.TestGroup = QGroupBox()
self.TestGroupLayout = QVBoxLayout()
self.ProductionButton = QRadioButton("&Full Test")
self.QuickButton = QRadioButton("&Quick Test")
self.QuickButton.setChecked(True)
self.TestGroupLayout.addWidget(self.QuickButton)
self.TestGroupLayout.addWidget(self.ProductionButton)
self.FunctionTestButton = QRadioButton("&Functional Test")
self.AssemblyTestButton = QRadioButton("&Assembly QC Test")
self.AssemblyTestButton.setChecked(True)
self.TestGroupLayout.addWidget(self.AssemblyTestButton)
self.TestGroupLayout.addWidget(self.FunctionTestButton)

self.TestGroup.setLayout(self.TestGroupLayout)
logger.debug("Added Boxes/Layouts to Simplified GUI")
Expand Down Expand Up @@ -352,10 +352,10 @@ def runNewTest(self):
)
return

if self.ProductionButton.isChecked():
self.info = "ROCTune"
else:
self.info = "QuickTest"
if self.FunctionTestButton.isChecked():
self.info = "TFPX_Functional_Test"
elif self.AssemblyTestButton.isChecked():
self.info = "TFPX_Assembly_QC"
self.runFlag = True
self.RunTest = QtRunWindow(self.master, self.info, self.firmwareDescription)
self.RunButton.setDisabled(True)
Expand Down
48 changes: 35 additions & 13 deletions Gui/python/TestHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,22 @@ def runSingleTest(self, testName):
self.info_process.setWorkingDirectory(
os.environ.get("PH2ACF_BASE_DIR") + "/test/"
)
self.info_process.start(
"echo",
[
"Running COMMAND: CMSITminiDAQ -f CMSIT.xml -c {}".format(
Test_to_Ph2ACF_Map[self.currentTest]
)
],
)
if self.currentTest == "CommunicationTest":
self.info_process.start(
"echo",
[
"Running COMMAND: CMSITminiDAQ -f CMSIT.xml -p"
],
)
else:
self.info_process.start(
"echo",
[
"Running COMMAND: CMSITminiDAQ -f CMSIT.xml -c {}".format(
Test_to_Ph2ACF_Map[self.currentTest]
)
],
)
self.info_process.waitForFinished()

self.run_process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
Expand Down Expand Up @@ -527,10 +535,21 @@ def runSingleTest(self, testName):
"{0}/test/CMSIT.xml".format(os.environ.get("PH2ACF_BASE_DIR")), "DoNSteps"
)

self.run_process.start(
"CMSITminiDAQ",
["-f", "CMSIT.xml", "-c", "{}".format(Test_to_Ph2ACF_Map[self.currentTest])],
)
if self.currentTest == "CommunicationTest":
self.run_process.start(
"CMSITminiDAQ",
["-f", "CMSIT.xml", "-p"],
)
else:
self.run_process.start(
"CMSITminiDAQ",
["-f", "CMSIT.xml", "-c", "{}".format(Test_to_Ph2ACF_Map[self.currentTest])],
)

#self.run_process.start(
# "CMSITminiDAQ",
# ["-f", "CMSIT.xml", "-c", "{}".format(Test_to_Ph2ACF_Map[self.currentTest])],
#)
if Test_to_Ph2ACF_Map[self.currentTest] == "threqu":
self.isTDACtuned = True

Expand Down Expand Up @@ -717,7 +736,8 @@ def on_readyReadStandardOutput(self):

except Exception as err:
logger.info("Error occures while parsing running time, {0}".format(err))

if '@@@ End of CMSIT miniDAQ @@@' in textStr:
self.ProgressingMode = "Summary"
if self.ProgressingMode == "Perform":
if "Progress:" in textStr:
try:
Expand Down Expand Up @@ -854,6 +874,8 @@ def check_for_end_of_test(self, textStr):
return True
elif "New injection delay" in textStr:
return True
elif "CommunicationTest" == self.currentTest:
return True
return False

# Reads data that is normally printed to the terminal and saves it to the output file
Expand Down
4 changes: 2 additions & 2 deletions Gui/python/TestValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def ResultGrader(felis, outputDir, testName, testIndexInSequence, runNumber, mod
module_name = module_data['module'].getModuleName()
module_type = module_data['module'].getModuleType()
module_version = module_data['module'].getModuleVersion()
if 'IVCurve' in testName or 'SLDOScan' in testName:
explanation = 'No grading currently available for IVCurve or SLDOScan.'
if 'IVCurve' in testName or 'SLDOScan' in testName or 'CommunicationTest' in testName:
explanation = 'No grading currently available for IVCurve, SLDOScan, or CommunicationTest.'
return {module_name:(True, explanation)}

root_file_name = testName.split('_')[0]
Expand Down
6 changes: 6 additions & 0 deletions Gui/siteConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
defaultPeltierWarningTemp = 40
#################################

# Temperature Chamber Variables
# Only UIC and OSU should be setting this variable. This is to control
# the f4t thermal chamber (this is NOT the same as the UIC coldbox used for standard
# module testing!)
#temp_chamber_resource = "TCPIP::128.146.33.179::5025::SOCKET"

# Icicle variables

# Set this variable to use your powersupplies manually
Expand Down
2 changes: 1 addition & 1 deletion InnerTrackerTests
Submodule InnerTrackerTests updated from f1f829 to 1df224
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,23 @@ In Gui/jsonFiles, there are example files written that may be modified to suit y
Returning to Gui/siteConfig.py, you should also scroll down to the "FC7List" and edit the fc7.board.* listed there to match the IP addresses of your FC7 device(s).

If you scroll down a little further, you will see a dictionary titled "CableMapping." This serves as a mapping of the cable ID you see when adding modules in the simplified GUI to a physical port on your FC7(s). Each cable ID is associated with a dictionary detailing the path to a port. The first key, "FC7," specifies which FC7 that you want that cable ID to be connected to. The FC7 you list should be in the FC7List above. Next, you can name the "FMCID," representing which FMC on the FC7 you wish to use. The possible values for this are "L8" if the FMC is on the left or "L12" if the FMC is on the right. Finally, you can specify which port on that FMC you want to connect to. The leftmost port is "0" and the rightmost port is "3."

#### Temperature Chamber
This section only applies to UIC and OSU who have the f4t thermal
chamber for thermal cycling of the modules (This is NOT the same thing
as the UIC coldbox used for standard module testing!). You can add
control of the thermal chamber to the GUI by adding in
temp_chamber_resource to the siteConfig.py file.

``` python
temp_chamber_resource = "TCPIP::<ip_address>::SOCKET"
```
where ip_address is the ip address of your thermal chamber which can
be obtained through the settings menu on the f4t controller on the
thermal chamber. This will allow you to select your thermal profile
from the GUI and to stop the running of the profile from the GUI as
well. A thermal profile must be loaded on the thermal chamber prior
to using it with the GUI.

3. Start the docker container:
```
cd ..
Expand Down Expand Up @@ -198,3 +214,4 @@ run the command
```
xhost +local:
```
* If the GUI doens't launch and an error stating a QT plugin could not be used even though it was found, reboot your computer. This seems to be an issue with the QT framework that the GUI is written with and we have yet to determine a fix.
2 changes: 1 addition & 1 deletion icicle
Submodule icicle updated from 22a716 to 2dc0fa

0 comments on commit 043a8b7

Please sign in to comment.