added 16bit 1 counter and 16bit 4 counters

This commit is contained in:
froejdh_e
2026-01-28 15:13:15 +01:00
parent e519633e16
commit c3c3970f19
6 changed files with 73 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
import logging
from functools import partial
import pyctbgui.utils.pixelmap as pm
import random
from pathlib import Path
@@ -415,13 +416,26 @@ class PlotTab(QtWidgets.QWidget):
self.mainWindow.read_timer.start(Defines.Time_Plot_Refresh_ms)
def setPixelMap(self):
if self.view.comboBoxPlot.currentText() == "Matterhorn":
self.mainWindow.nTransceiverRows = Defines.Matterhorn.nRows
self.mainWindow.nTransceiverCols = Defines.Matterhorn.nCols
if self.view.comboBoxPlot.currentText() == "Matterhorn02":
print("Setting pixel map for Matterhorn02")
self.mainWindow.nTransceiverRows = Defines.Matterhorn02.nRows
self.mainWindow.nTransceiverCols = Defines.Matterhorn02.nCols
self.mainWindow.pixel_map = pm.matterhorn_transceiver()
elif self.view.comboBoxPlot.currentText() == "Matterhorn1_16bit_1_counter":
print("Setting pixel map for Matterhorn1")
self.mainWindow.nTransceiverRows = Defines.Matterhorn1.nRows
self.mainWindow.nTransceiverCols = Defines.Matterhorn1.nCols
self.mainWindow.pixel_map = pm.matterhorn1_transceiver_16bit_1_counter()
elif self.view.comboBoxPlot.currentText() == "Matterhorn1_16bit_4_counters":
print("Setting pixel map for Matterhorn1 with 4 counters")
self.mainWindow.nTransceiverRows = Defines.Matterhorn1.nRows
self.mainWindow.nTransceiverCols = Defines.Matterhorn1.nCols
self.mainWindow.pixel_map = pm.matterhorn1_transceiver_16bit_4_counters()
elif self.view.comboBoxPlot.currentText() == "Moench04":
self.mainWindow.nAnalogRows = Defines.Moench04.nRows
self.mainWindow.nAnalogCols = Defines.Moench04.nCols
def showPatternViewer(self, enable):
if enable:
self.mainWindow.framePatternViewer.show()

View File

@@ -133,7 +133,10 @@ class TransceiverTab(QtWidgets.QWidget):
nbitsPerDBit += (8 - (dSamples % 8))
transceiverOffset += nDBitEnabled * (nbitsPerDBit // 8)
trans_array = np.array(np.frombuffer(data, offset=transceiverOffset, dtype=np.uint16))
return decoder.decode(trans_array, pm.matterhorn_transceiver())
print(f'{trans_array.shape=}')
tmp = decoder.decode(trans_array, self.mainWindow.pixel_map)
print(f'{tmp.shape=}')
return tmp
def processImageData(self, data, dSamples):
"""

View File

@@ -165,7 +165,17 @@
</property>
<item>
<property name="text">
<string>Matterhorn</string>
<string>Matterhorn02</string>
</property>
</item>
<item>
<property name="text">
<string>Matterhorn1_16bit_4_counters</string>
</property>
</item>
<item>
<property name="text">
<string>Matterhorn1_16bit_1_counter</string>
</property>
</item>
<item>

View File

@@ -49,3 +49,4 @@ def matterhorn(trans_buffer):
offset += nSamples
return transceiver_frame

View File

@@ -50,7 +50,7 @@ class Defines:
Matterhorn = 0
Moench04 = 1
class Matterhorn:
class Matterhorn02:
nRows = 48
nHalfCols = 24
nCols = 48
@@ -58,6 +58,14 @@ class Defines:
tranceiverEnable = 0x3
nPixelsPerTransceiver = 4
class Matterhorn1:
nRows = 256
nHalfCols = 24
nCols = 256
nTransceivers = 2
tranceiverEnable = 0x3
nPixelsPerTransceiver = 4
class Moench04:
nRows = 400
nCols = 400

View File

@@ -59,3 +59,34 @@ def matterhorn_transceiver():
offset += nSamples
return out
def matterhorn1_transceiver_16bit_1_counter():
pixel_map = np.zeros((256,256), np.uint32)
n_cols = 256
n_rows = 256
for row in range(n_rows):
col = 0
for offset in range(0,64,4):
for pkg in range(offset,256,64):
for pixel in range(4):
pixel_map[row, col] = pixel+pkg+row*n_cols
col += 1
return pixel_map
def matterhorn1_transceiver_16bit_4_counters():
n_counters = 4
n_cols = 256
n_rows = 256
pixel_map = np.zeros((n_rows*n_counters,n_cols,n_counters), np.uint32)
for row in range(n_rows):
for counter in range(n_counters):
col = 0
for offset in range(0,64,4):
for pkg in range(offset,256,64):
for pixel in range(4):
pixel_map[row+n_rows*counter, col] = pixel+pkg+row*n_cols*n_counters+n_cols*counter
col += 1
return pixel_map