update read frame.py

This commit is contained in:
Bechir Braham 2024-02-22 16:04:27 +01:00
parent 137c29c52e
commit b0ce167471
No known key found for this signature in database
GPG Key ID: 7F511B55FD8E9671
2 changed files with 18 additions and 9 deletions

3
data/.gitignore vendored
View File

@ -1,2 +1 @@
*.raw
*.raw

View File

@ -28,11 +28,21 @@ frames = 3
data = np.zeros((frames,rows,cols), dtype = np.uint16)
header = np.zeros(frames, dtype = header_dt)
with open('jungfrau_single_d0_f0_0.raw') as f:
for i in range(frames):
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 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)
fig, ax = plt.subplots()
im = ax.imshow(data[0])
im.set_clim(2000,4000)
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)