added missing utils folder
This commit is contained in:
parent
5eeeaf681a
commit
96452488bf
43
utils/write_test_data.py
Normal file
43
utils/write_test_data.py
Normal file
@ -0,0 +1,43 @@
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
from creader import cluster_dt
|
||||
|
||||
#[int32 frame_number][int32 n_clusters][clusters....]
|
||||
# typedef struct {
|
||||
# int16_t x;
|
||||
# int16_t y;
|
||||
# int32_t data[9];
|
||||
# } Cluster ;
|
||||
|
||||
|
||||
path = Path('/mnt/sls_det_storage/moench_data/cluster_reader_test/')
|
||||
|
||||
data = np.zeros(1, cluster_dt())
|
||||
data['x'] = 1
|
||||
data['y'] = 200
|
||||
data['data'] = np.arange(9)
|
||||
#Write 10 frames with increadsing number of clusters
|
||||
header = np.array((135,97), dtype = np.int32)
|
||||
with open(path/'single_frame_97_clustrers.clust', 'wb') as f:
|
||||
header.tofile(f)
|
||||
for i in range(97):
|
||||
print(data)
|
||||
data.tofile(f)
|
||||
data['x'] += 1
|
||||
data['y'] += 1
|
||||
data['data'] = np.arange((i+1)*9,(i+2)*9)
|
||||
|
||||
|
||||
header = np.array((135,5), dtype = np.int32)
|
||||
with open(path/'37frames_with_5_clusters.clust', 'wb') as f:
|
||||
for i in range(37):
|
||||
header.tofile(f)
|
||||
header[0] += 1
|
||||
for j in range(5):
|
||||
data['x'] = j+1
|
||||
data['y'] = j+1
|
||||
data['data'] = np.arange(j,j+9)
|
||||
print(data)
|
||||
data.tofile(f)
|
||||
|
Reference in New Issue
Block a user