Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
69 changes: 33 additions & 36 deletions Gui/GUIutils/guiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime, timedelta
from subprocess import Popen, PIPE
import traceback
import shutil

from Gui.GUIutils.settings import (
updatedGlobalValue,
Expand Down Expand Up @@ -144,20 +145,18 @@

def SetupXMLConfig(Input_Dir, Output_Dir, BeBoardName=""):
try:
os.system(
"cp {0}/CMSIT_{2}.xml {1}/CMSIT_2.xml".format(
Input_Dir, Output_Dir, BeBoardName
)
)
shutil.copyfile("{0}/CMSIT_{2}.xml".format(Input_Dir, BeBoardName),

Check failure on line 148 in Gui/GUIutils/guiUtils.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F524)

Gui/GUIutils/guiUtils.py:148:25: F524 `.format` call is missing argument(s) for placeholder(s): 2
"{1}/CMSIT_2.xml".format(Output_Dir))


except OSError as e:
logger.error(f"Failed to copy XML file: {e}")
logger.error(traceback.format_exc())
try:
os.system(
"cp {0}/CMSIT_{2}.xml {1}/test/CMSIT_{2}.xml".format(
Output_Dir, os.environ.get("PH2ACF_BASE_DIR"), BeBoardName
)
)
shutil.copyfile( "{0}/CMSIT_{2}.xml".format(Output_Dir, BeBoardName),

Check failure on line 156 in Gui/GUIutils/guiUtils.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F524)

Gui/GUIutils/guiUtils.py:156:26: F524 `.format` call is missing argument(s) for placeholder(s): 2
"{1}/test/CMSIT_{2}.xml".format(os.environ.get("PH2ACF_BASE_DIR"), BeBoardName)

Check failure on line 157 in Gui/GUIutils/guiUtils.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F524)

Gui/GUIutils/guiUtils.py:157:21: F524 `.format` call is missing argument(s) for placeholder(s): 2

Check failure on line 157 in Gui/GUIutils/guiUtils.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F523)

Gui/GUIutils/guiUtils.py:157:21: F523 `.format` call has unused arguments at position(s): 0
)

logger.info("Copied XML file to test directory")
except OSError as e:
logger.error(f"Failed to copy XML file to test directory: {e}")
Expand Down Expand Up @@ -273,18 +272,19 @@
logger.error(traceback.format_exc())

try:
os.system("cp {0} {1}/CMSIT_{2}.xml".format(InputFile, Output_Dir, BeBoardName)) # FIXME
shutil.copyfile(InputFile,
os.path.join(Output_Dir, f"CMSIT_{BeBoardName}.xml"))

except OSError:
print("Can not copy the XML files {0} to {1}".format(InputFile, Output_Dir))
print(traceback.format_exc())
try:
os.system(
"cp {0}/CMSIT_{1}.xml {2}/test/CMSIT_{1}.xml".format(
Output_Dir, BeBoardName, os.environ.get("PH2ACF_BASE_DIR")
shutil.copyfile("{0}/CMSIT_{1}.xml".format(Output_Dir, BeBoardName),
"{0}/test/CMSIT_{1}.xml".format(os.environ.get("PH2ACF_BASE_DIR"), BeBoardName)
)
)
except OSError:
print(
logger.error(
"Can not copy {0}/CMSIT_{1}.xml to {2}/test/CMSIT_{1}.xml".format(
Output_Dir, BeBoardName, os.environ.get("PH2ACF_BASE_DIR")
)
Expand All @@ -300,26 +300,25 @@
for key in RD53Dict.keys():
try:
print("Doing the copy thing in guiUtils")
os.system(
"cp {0}/CMSIT_RD53_{1}_OUT.txt {2}/CMSIT_RD53_{1}_IN.txt".format(
Input_Dir, key, Output_Dir
)
shutil.copyfile(
"{0}/CMSIT_RD53_{1}_OUT.txt".format(Input_Dir, key),
"{0}/CMSIT_RD53_{1}_IN.txt".format(Output_Dir, key)
)
except OSError:
print(
logger.error(
"Can not copy the RD53 configuration files to {0} for RD53 ID: {1}".format(
Output_Dir, key
)
)
print(traceback.format_exc())
try:
os.system(
"cp {0}/CMSIT_RD53_{1}_IN.txt {2}/test/CMSIT_RD53_{1}.txt".format(
Output_Dir, key, os.environ.get("PH2ACF_BASE_DIR")
shutil.copyfile(
"{0}/CMSIT_RD53_{1}_IN.txt".format(Output_Dir, key),
"{1}/test/CMSIT_RD53_{0}.txt".format(key, os.environ.get("PH2ACF_BASE_DIR")
)
)
except OSError:
print(
logger.error(
"Can not copy {0}/CMSIT_RD53_{1}_IN.txt to {2}/test/CMSIT_RD53_{1}.txt".format(
Output_Dir, key, os.environ.get("PH2ACF_BASE_DIR")
)
Expand All @@ -334,26 +333,24 @@
def SetupRD53ConfigfromFile(InputFileDict, Output_Dir):
for key in InputFileDict.keys():
try:
os.system(
"cp {0} {1}/CMSIT_RD53_{2}_IN.txt".format(
InputFileDict[key], Output_Dir, key
)
shutil.copyfile(
InputFileDict[key],
"{0}/CMSIT_RD53_{1}_IN.txt".format(Output_Dir, key)
)
except OSError:
print(
logger.error(
"Can not copy the XML files {0} to {1}".format(
InputFileDict[key], Output_Dir
)
)
print(traceback.format_exc())
try:
os.system(
"cp {0}/CMSIT_RD53_{1}_IN.txt {2}/test/CMSIT_RD53_{1}.txt".format(
Output_Dir, key, os.environ.get("PH2ACF_BASE_DIR")
)
)
shutil.copyfile(
os.path.join(Output_Dir, f"CMSIT_RD53_{key}_IN.txt"),
os.path.join(os.environ.get("PH2ACF_BASE_DIR"), "test", f"CMSIT_RD53_{key}.txt")
)
except OSError:
print(
logger.error(
"Can not copy {0}/CMSIT_RD53_{1}_IN.txt to {2}/test/CMSIT_RD53.txt".format(
Output_Dir, key, os.environ.get("PH2ACF_BASE_DIR")
)
Expand Down
7 changes: 4 additions & 3 deletions Gui/QtGUIutils/QtApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
from Gui.python.logging_config import get_logger
logger = get_logger(__name__)


class QtApplication(QWidget):
globalStop = pyqtSignal()
errorMessageBoxSignal = pyqtSignal(str)
Expand Down Expand Up @@ -589,7 +588,7 @@ def createMain(self):
if not site_settings.manual_powersupply_control:
HVDevices = []
for device_name, device in site_settings.icicle_instrument_setup[
"instrument_dict"
'instrument_dict'
].items():
if "hv" in device_name:
HVDevices.append(device)
Expand Down Expand Up @@ -972,7 +971,8 @@ def connect_devices(self):
if self.expertMode:
if not self.default_checkbox.isChecked():
for key, value in self.connected_device_information.items():
self.device_settings[key] = value
self.device_settings[key] = value

try:
try:
self.instruments = InstrumentCluster(**self.device_settings)
Expand Down Expand Up @@ -1009,6 +1009,7 @@ def connect_devices(self):
self.ArduinoGroup.setBaudRate(site_settings.defaultSensorBaudRate)
self.ArduinoGroup.setArduinoPanel()


def disable_instrument_widgets(self):
"""
Use to disable the groupbox of LV, HV, relay board, and multimeter
Expand Down
2 changes: 1 addition & 1 deletion Gui/QtGUIutils/QtStartWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
from Gui.GUIutils.settings import firmware_image, ModuleLaneMap
from Gui.siteSettings import (
FC7List,
json_setup,
ModuleCurrentMap,
icicle_instrument_setup,
WorkingChannels,
json_setup,
cooler
)
from icicle.icicle.instrument_cluster import DummyInstrument
Expand Down
6 changes: 6 additions & 0 deletions Gui/jsonFiles/instruments_osu_adcboardsldo.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,11 @@
"lv": {"instrument":"lv_1", "channel":1},
"hv": {"instrument":"hv", "channel":1}
}
},

"fc7_address_dict":{
"fc7.board.1" : "192.168.1.80",
"fc7.board.2" : "192.168.1.81",
"fc7.board.3" : "192.168.1.82"
}
}
8 changes: 7 additions & 1 deletion Gui/jsonFiles/instruments_osu_auto.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,11 @@
"cb": {"instrument":"cb", "channel":8},
"hv": {"instrument":"hv", "channel":1}
}
},

"fc7_address_dict":{
"fc7.board.1" : "192.168.1.80",
"fc7.board.2" : "192.168.1.81",
"fc7.board.3" : "192.168.1.82"
}
}
}
63 changes: 40 additions & 23 deletions Gui/python/TestHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ def copyMostRecentRootFile(self, RunNumber, base_dir, output_dir, test):
logger.debug(
f"Copying {latest_file} to {output_dir}/{fc7_in_use}_{file_name}"
)
os.system(f"cp {latest_file} {output_dir}/{fc7_in_use}_{file_name}")
shutil.copyfile(latest_file, f"{output_dir}/{fc7_in_use}_{file_name}")

def saveTest(self, processIndex: int, process: QProcess):
logger.debug("Inside saveTest")
Expand All @@ -1224,39 +1224,56 @@ def saveTest(self, processIndex: int, process: QProcess):
)
)

if self.RunNumber == "-1":
os.system(
"cp {0}/test/Results/Run000000*.root {1}/".format(
if self.RunNumber == "-1":
dest_dir = os.path.join(self.output_dir,
self.firmware[processIndex].getBoardname()
)

for file_path in glob.glob(
os.path.join(
os.environ.get("PH2ACF_BASE_DIR"),
os.path.join(
self.output_dir, self.firmware[processIndex].getBoardName()
),
"test",
"Results",
"Run000000*.root"
)
)
):
try:
shutil.copy(file_path, dest_dir)
except (shutil.Error, IOError) as e:
logger.error(f"Error copying {file_path}: {e}")


elif "IVCurve" in self.currentTest or "IREF_GADC" in self.currentTest:
print("copying MonitorDQM.root file to output directory")

current_fc7: str = self.firmware[processIndex].getBoardName()
os.system(
"cp {0}/test/Results/Run{1}_MonitorDQM_Board_{2}*.root {3}/".format(
os.environ.get("PH2ACF_BASE_DIR"),
self.RunNumber,
self.firmware[processIndex].getBoardID(),
os.path.join(
self.output_dir, current_fc7
),
)
)
os.system(
"cp {0}/test/Results/Run{1}_CMSIT_{2}.xml {3}/".format(

for file_path in glob.glob(
os.path.join(
os.environ.get("PH2ACF_BASE_DIR"),
"test",
"Results",
"Run{0}_MonitorDQM_Board_{1}*.root".format(
self.RunNumber, self.firmware[processIndex].getBoardID()))
):
shutil.copyfile(
file_path,
os.path.join(
self.output_dir,
current_fc7,
os.path.basename(file_path)
)
)

shutil.copyfile(
"{0}/test/Results/Run{1}_CMSIT_{2}.xml".format(os.environ.get("PH2ACF_BASE_DIR"),
self.RunNumber,
current_fc7,
current_fc7),
os.path.join(
self.output_dir, current_fc7
),
)
)
)

else:
ph2_acf_base_dir: str | None = os.environ.get("PH2ACF_BASE_DIR")
if ph2_acf_base_dir is None:
Expand Down
22 changes: 22 additions & 0 deletions Gui/python/TestValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,28 @@ def ResultGrader(
f"{testIndexInSequence:02d}_{testName}",
"sldo",
)
elif "IREF" in testName:
relevant_files = [
outputDir + "/" + os.fsdecode(file) for file in os.listdir(outputDir) if module_name in file or file.endswith(".xml")
]
dqmpattern = re.compile(rf"_Hybrid_{module_hybridID}\.root$")
relevant_files.extend([outputDir + "/" + os.fsdecode(file) for file in os.listdir(outputDir) if dqmpattern.search(file)])


print("relevant_files:", relevant_files)
_1, _2 = felis.set_module(
module_name,
module_type.split(" ")[0],
module_type.split(" ")[2].replace("Quad", "2x2"),
module_version.strip("v"),
True,
)
status, message, sanity, explanation = felis.set_result(
relevant_files,
module_name,
f"{testIndexInSequence:02d}_{testName}",
"irefgadc",
)
elif "CommunicationTest" in testName:
module_name = module_data["module"].getModuleName()
comm_result = communicationTestResults.get(module_name)
Expand Down
24 changes: 15 additions & 9 deletions Gui/siteConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
defaultArduino = "Arduino SA Uno R3 (CDC ACM) ACM0"

#Coldbox variables
cooler = "Tessie" # "Peltier" or "Manual" or "Tessie".
cooler = "Manual" # "Peltier" or "Manual" or "Tessie".
usePeltier = False #The "cooler" variable will be used in the future, but this line is needed for the current version of the GUI

tessie_url = "http://coldbox:3000/"
Expand Down Expand Up @@ -64,9 +64,8 @@

# Load instrument setup from json file
# If the json filename contains 'auto', channels will be automatically assigned as listed in Working Channels
json_setup = 'jsonFiles/instruments_osu_auto.json'
with open(json_setup, 'r') as file:
icicle_instrument_setup = json.load(file)



#Set peak voltage for bias scan. Make sure this value is negative or it could damage the sensor.
IVcurve_range = {
Expand Down Expand Up @@ -119,12 +118,19 @@

forward_bias_voltage = 0.5 #positive voltage used to run a forward-reverse bias bump bond test


## Update this dictionary for the IP addreses of your FC7 devices ##
FC7List = {
'fc7.board.1' : '192.168.1.80',
'fc7.board.2' : '192.168.1.81',
'fc7.board.3' : '192.168.1.82',
}

try:
json_setup = 'jsonFiles/instruments_osu_adcboardsldo.json'
with open(json_setup, 'r') as file:
icicle_instrument_setup = json.load(file)
except FileNotFoundError:
print("Error: 'data.json' not found.")
exit()

FC7List = icicle_instrument_setup['fc7_address_dict']
icicle_instrument_setup.pop('fc7_address_dict')

## Update this list with all working TEC channels in your coldbox
## Channel assignments will follow this list sequentially per number of modules entered in the GUI
Expand Down
Loading