mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-03 23:34:14 +02:00
add JF03, copy pedestal files to common place
This commit is contained in:
committed by
Data Backend account
parent
13218459bc
commit
4f69fec838
@@ -0,0 +1,44 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import datetime
|
||||
from shutil import copyfile
|
||||
|
||||
PEDESTAL_DIRECTORY="/sf/jungfrau/data/pedestal"
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("file_pedestal", type=str)
|
||||
parser.add_argument("json_run", type=str)
|
||||
parser.add_argument("detector", type=str)
|
||||
parser.add_argument("json_stream", type=str)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.json_run, "r") as run_file:
|
||||
data = json.load(run_file)
|
||||
|
||||
request_time=datetime.datetime.strptime(data["request_time"], '%Y-%m-%d %H:%M:%S.%f')
|
||||
|
||||
if not os.path.isdir(f'{PEDESTAL_DIRECTORY}/{args.detector}'):
|
||||
os.mkdir(f'{PEDESTAL_DIRECTORY}/{args.detector}')
|
||||
|
||||
out_name = f'{PEDESTAL_DIRECTORY}/{args.detector}/{request_time.strftime("%Y%m%d_%H%M%S")}.h5'
|
||||
copyfile(args.file_pedestal, out_name)
|
||||
|
||||
print(f'Copied resulting pedestal file {args.file_pedestal} to {out_name}')
|
||||
|
||||
if not os.path.exists(args.json_stream):
|
||||
print(f'stream file {args.json_stream} does not exists, exiting')
|
||||
exit()
|
||||
|
||||
with open(args.json_stream, "r") as stream_file:
|
||||
det = json.load(stream_file)
|
||||
|
||||
print(f'Changing in stream file {args.json_stream} pedestal from {det["pedestal_file"]} to {out_name}')
|
||||
|
||||
det["pedestal_file"] = out_name
|
||||
|
||||
with open(args.json_stream, "w") as write_file:
|
||||
json.dump(det, write_file, indent=4)
|
||||
|
||||
@@ -59,6 +59,10 @@ case ${DETECTOR} in
|
||||
NM=1
|
||||
DET_CONFIG_FILE=/gpfs/photonics/swissfel/buffer/config/stream-JF04.json
|
||||
;;
|
||||
'JF03T01V01')
|
||||
NM=1
|
||||
DET_CONFIG_FILE=/gpfs/photonics/swissfel/buffer/config/stream-JF03.json
|
||||
;;
|
||||
'JF06T32V02')
|
||||
NM=32
|
||||
DET_CONFIG_FILE=/gpfs/photonics/swissfel/buffer/config/stream-JF06.json
|
||||
@@ -196,6 +200,10 @@ then
|
||||
time taskset -c ${coreAssociatedConversion} python /home/dbe/git/sf_daq_buffer/scripts/jungfrau_create_pedestals.py --filename ${OUTFILE_RAW} --directory ${dir_name} --verbosity DEBUG
|
||||
fi
|
||||
|
||||
PEDESTAL_FILE=`echo ${OUTFILE_RAW} | sed 's/.h5/.res.h5/'`
|
||||
|
||||
taskset -c ${coreAssociatedConversion} python /home/dbe/git/sf_daq_buffer/scripts/copy_pedestal_file.py ${PEDESTAL_FILE} ${RUN_FILE} ${DETECTOR} ${DET_CONFIG_FILE}
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -222,7 +230,7 @@ else
|
||||
conda deactivate
|
||||
conda activate sf-daq
|
||||
|
||||
taskset -c ${coreAssociatedConversion} python /home/dbe/git/sf_daq_buffer/scripts/export_file.py ${OUTFILE_RAW} ${OUTFILE} ${RUN_FILE} ${DET_CONFIG_FILE}
|
||||
time taskset -c ${coreAssociatedConversion} python /home/dbe/git/sf_daq_buffer/scripts/export_file.py ${OUTFILE_RAW} ${OUTFILE} ${RUN_FILE} ${DET_CONFIG_FILE}
|
||||
if [ ${DETECTOR} == "JF06T32V02" ] || [ ${DETECTOR} == "JF06T08V02" ]
|
||||
then
|
||||
taskset -c ${coreAssociatedConversion} python /home/dbe/git/sf_daq_buffer/scripts/make_crystfel_list.py ${OUTFILE} ${RUN_FILE} ${DETECTOR}
|
||||
|
||||
Reference in New Issue
Block a user