added more raw files
This commit is contained in:
40
raw/moench03/copy_frames.py
Normal file
40
raw/moench03/copy_frames.py
Normal file
@ -0,0 +1,40 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
header_size = 112
|
||||
frame_size = 400**2*2
|
||||
|
||||
n_frames = 1000
|
||||
|
||||
|
||||
# base = Path('/mnt/sls_det_storage/matterhorn_data/aare_test_data/')
|
||||
# f = File(base/'Moench03new/cu_half_speed_master_4.json')
|
||||
findex = 4
|
||||
for base_name in ['cu_half_speed',]:
|
||||
|
||||
src = Path(f'/mnt/sls_det_storage/matterhorn_data/aare_test_data/Moench03new/{base_name}_d0_f0_{findex}.raw')
|
||||
dst = Path('/home/l_msdetect/erik/data/aare-test-data/raw/moench03')/src.name
|
||||
|
||||
print(f'src: {src}')
|
||||
print(f'dst: {dst}')
|
||||
|
||||
# Copy data
|
||||
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
|
||||
for i in range(n_frames):
|
||||
data = fsrc.read(header_size+frame_size)
|
||||
fdst.write(data)
|
||||
|
||||
# Copy master file and rewrite the number of frames in the file
|
||||
msrc = src.parent/f'{base_name}_master_{findex}.json'
|
||||
mdst = dst.parent/f'{base_name}_master_{findex}.json'
|
||||
|
||||
print(f'msrc: {msrc}')
|
||||
print(f'mdst: {mdst}')
|
||||
|
||||
with open(msrc) as m_fsrc, open(mdst, 'w') as m_fdst:
|
||||
for line in m_fsrc:
|
||||
if "Total Frames" in line:
|
||||
line = f'\t"Total Frames": {n_frames},\n'
|
||||
if "Frames in File" in line:
|
||||
line = f'\t"Frames in File": {n_frames},\n'
|
||||
m_fdst.write(line)
|
Reference in New Issue
Block a user