reading raw moench files (PR#3) (#32)

* reading moench and raw files

* read mythen3 files

* read multiport mythen3

* delete .vscode and .env.dev

---------

Co-authored-by: Bechir <bechir.brahem420@gmail.com>
This commit is contained in:
Bechir Braham
2024-03-27 08:58:43 +01:00
committed by GitHub
parent 937acd1138
commit bf216f55c6
54 changed files with 483 additions and 412 deletions

View File

@ -0,0 +1,80 @@
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
header_dt = np.dtype(
[
("Frame Number", "u8"),
("SubFrame Number/ExpLength", "u4"),
("Packet Number", "u4"),
("Bunch ID", "u8"),
("Timestamp", "u8"),
("Module Id", "u2"),
("Row", "u2"),
("Column", "u2"),
("Reserved", "u2"),
("Debug", "u4"),
("Round Robin Number", "u2"),
("Detector Type", "u1"),
("Header Version", "u1"),
("Packets caught mask", "8u8")
]
)
# Read three frames from a jungfrau file with a single interface
frames = 1
parts = 2
frame_cols = 1024
frame_rows = 512
part_cols = 1024
part_rows = 256
parts_data = np.zeros((frames,parts,part_rows,part_cols), dtype = np.uint16)
data = np.zeros((frames,frame_rows,frame_cols), dtype = np.uint16)
header = np.zeros((frames,parts), dtype = header_dt)
for frame in range(frames):
for part in range(parts):
file_name = f'jungfrau_double_d{part}_f{frame}_{0}.raw'
print("Reading file:", file_name)
with open(file_name) as f:
header[frame,part] = np.fromfile(f, dtype=header_dt, count = 1)
parts_data[frame,part] = np.fromfile(f, dtype=np.uint16,count = part_rows*part_cols).reshape(part_rows,part_cols)
data[frame] = np.concatenate((parts_data[frame,0],parts_data[frame,1]),axis=0)
# for frame in range(frames):
# print("Frame:", frame)
# print("Data:\n", data[frame])
# print(data[0,0,0])
# print(data[0,0,1])
# print(data[0,0,50])
print(data[0,0,0])
print(data[0,0,1])
print(data[0,255,1023])
print(data[0,511,1023])
# print()
# print(parts_data[0,0,0,0])
# print(parts_data[0,0,0,1])
# print(parts_data[0,0,1,0])
# print(data.shape)
#fig, ax = plt.subplots()
#im = ax.imshow(data[0])
#im.set_clim(2000,4000)

View File

@ -0,0 +1,40 @@
Version : 6.4
TimeStamp : Wed Aug 31 09:08:49 2022
Detector Type : ChipTestBoard
Timing Mode : auto
Geometry : [1, 1]
Image Size : 360000 bytes
Pixels : [96, 1]
Max Frames Per File : 20000
Frame Discard Policy : nodiscard
Frame Padding : 1
Scan Parameters : [disabled]
Total Frames : 100
Exptime : 100us
Period : 4ms
Ten Giga : 1
ADC Mask : 0xffffffff
Analog Flag : 1
Analog Samples : 5000
Digital Flag : 1
Digital Samples : 5000
Dbit Offset : 0
Dbit Bitset : 0
Frames in File : 100
#Frame Header
Frame Number : 8 bytes
SubFrame Number/ExpLength : 4 bytes
Packet Number : 4 bytes
Bunch ID : 8 bytes
Timestamp : 8 bytes
Module Id : 2 bytes
Row : 2 bytes
Column : 2 bytes
Reserved : 2 bytes
Debug : 4 bytes
Round Robin Number : 2 bytes
Detector Type : 1 byte
Header Version : 1 byte
Packets Caught Mask : 64 bytes

BIN
data/mythen/scan242_d0_f0_3.raw Executable file

Binary file not shown.

BIN
data/mythen/scan242_d1_f0_3.raw Executable file

Binary file not shown.

BIN
data/mythen/scan242_d2_f0_3.raw Executable file

Binary file not shown.

BIN
data/mythen/scan242_d3_f0_3.raw Executable file

Binary file not shown.

View File

@ -0,0 +1,40 @@
Version : 6.2
TimeStamp : Mon Sep 14 16:21:09 2020
Detector Type : Mythen3
Timing Mode : auto
Geometry : [4, 1]
Image Size : 5120 bytes
Pixels : [1280, 1]
Max Frames Per File : 10000
Frame Discard Policy : nodiscard
Frame Padding : 1
Scan Parameters : [disabled]
Total Frames : 1
Dynamic Range : 32
Ten Giga : 1
Period : 0ns
Counter Mask : 0x1
Exptime1 : 0.2s
Exptime2 : 0.2s
Exptime3 : 0.2s
GateDelay1 : 0.1s
GateDelay2 : 0.1s
GateDelay3 : 0.1s
Gates : 1
#Frame Header
Frame Number : 8 bytes
SubFrame Number/ExpLength : 4 bytes
Packet Number : 4 bytes
Bunch ID : 8 bytes
Timestamp : 8 bytes
Module Id : 2 bytes
Row : 2 bytes
Column : 2 bytes
Reserved : 2 bytes
Debug : 4 bytes
Round Robin Number : 2 bytes
Detector Type : 1 byte
Header Version : 1 byte
Packets Caught Mask : 64 bytes