mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-23 20:07:59 +02:00
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:
BIN
data/jungfrau/jungfrau_double_d0_f0_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d0_f0_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d0_f1_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d0_f1_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d0_f2_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d0_f2_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d0_f3_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d0_f3_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d1_f0_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d1_f0_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d1_f1_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d1_f1_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d1_f2_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d1_f2_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_double_d1_f3_0.raw
Normal file
BIN
data/jungfrau/jungfrau_double_d1_f3_0.raw
Normal file
Binary file not shown.
47
data/jungfrau/jungfrau_double_master_0.json
Normal file
47
data/jungfrau/jungfrau_double_master_0.json
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"Version": 7.2,
|
||||
"Timestamp": "Tue Feb 20 08:29:19 2024",
|
||||
"Detector Type": "Jungfrau",
|
||||
"Timing Mode": "auto",
|
||||
"Geometry": {
|
||||
"x": 1,
|
||||
"y": 2
|
||||
},
|
||||
"Image Size in bytes": 524288,
|
||||
"Pixels": {
|
||||
"x": 1024,
|
||||
"y": 256
|
||||
},
|
||||
"Max Frames Per File": 3,
|
||||
"Frame Discard Policy": "nodiscard",
|
||||
"Frame Padding": 1,
|
||||
"Scan Parameters": "[disabled]",
|
||||
"Total Frames": 10,
|
||||
"Receiver Roi": {
|
||||
"xmin": 4294967295,
|
||||
"xmax": 4294967295,
|
||||
"ymin": 4294967295,
|
||||
"ymax": 4294967295
|
||||
},
|
||||
"Exptime": "10us",
|
||||
"Period": "1ms",
|
||||
"Number of UDP Interfaces": 2,
|
||||
"Number of rows": 512,
|
||||
"Frames in File": 10,
|
||||
"Frame Header Format": {
|
||||
"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/jungfrau/jungfrau_single_d0_f0_0.raw
Normal file
BIN
data/jungfrau/jungfrau_single_d0_f0_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_single_d0_f1_0.raw
Normal file
BIN
data/jungfrau/jungfrau_single_d0_f1_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_single_d0_f2_0.raw
Normal file
BIN
data/jungfrau/jungfrau_single_d0_f2_0.raw
Normal file
Binary file not shown.
BIN
data/jungfrau/jungfrau_single_d0_f3_0.raw
Normal file
BIN
data/jungfrau/jungfrau_single_d0_f3_0.raw
Normal file
Binary file not shown.
47
data/jungfrau/jungfrau_single_master_0.json
Normal file
47
data/jungfrau/jungfrau_single_master_0.json
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"Version": 7.2,
|
||||
"Timestamp": "Tue Feb 20 08:28:24 2024",
|
||||
"Detector Type": "Jungfrau",
|
||||
"Timing Mode": "auto",
|
||||
"Geometry": {
|
||||
"x": 1,
|
||||
"y": 1
|
||||
},
|
||||
"Image Size in bytes": 1048576,
|
||||
"Pixels": {
|
||||
"x": 1024,
|
||||
"y": 512
|
||||
},
|
||||
"Max Frames Per File": 3,
|
||||
"Frame Discard Policy": "nodiscard",
|
||||
"Frame Padding": 1,
|
||||
"Scan Parameters": "[disabled]",
|
||||
"Total Frames": 10,
|
||||
"Receiver Roi": {
|
||||
"xmin": 4294967295,
|
||||
"xmax": 4294967295,
|
||||
"ymin": 4294967295,
|
||||
"ymax": 4294967295
|
||||
},
|
||||
"Exptime": "10us",
|
||||
"Period": "1ms",
|
||||
"Number of UDP Interfaces": 1,
|
||||
"Number of rows": 512,
|
||||
"Frames in File": 10,
|
||||
"Frame Header Format": {
|
||||
"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"
|
||||
}
|
||||
}
|
48
data/jungfrau/read_frame.py
Normal file
48
data/jungfrau/read_frame.py
Normal file
@ -0,0 +1,48 @@
|
||||
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
|
||||
rows = 512
|
||||
cols = 1024
|
||||
frames = 3
|
||||
|
||||
data = np.zeros((frames,rows,cols), dtype = np.uint16)
|
||||
header = np.zeros(frames, dtype = header_dt)
|
||||
for file_id in range(4):
|
||||
file_name = 'jungfrau_single_d0_f{}_0.raw'.format(file_id)
|
||||
print("Reading file:", file_name)
|
||||
with open(file_name) as f:
|
||||
for i in range(frames if file_id != 3 else 1):
|
||||
header[i] = np.fromfile(f, dtype=header_dt, count = 1)
|
||||
data[i] = np.fromfile(f, dtype=np.uint16,count = rows*cols).reshape(rows,cols)
|
||||
|
||||
|
||||
for i in range(frames if file_id != 3 else 1 ):
|
||||
print("frame:",i)
|
||||
print(data[i][0,0],data[i][0,1],data[i][1,0],data[i][rows-1,cols-1])
|
||||
print("")
|
||||
|
||||
|
||||
#fig, ax = plt.subplots()
|
||||
#im = ax.imshow(data[0])
|
||||
#im.set_clim(2000,4000)
|
80
data/jungfrau/read_multiport.py
Normal file
80
data/jungfrau/read_multiport.py
Normal 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)
|
Reference in New Issue
Block a user