eiger control scripts improvements

This commit is contained in:
lhdamiani
2021-07-15 16:53:15 +02:00
parent 8097bf06ea
commit c0574fbc09
5 changed files with 45 additions and 31 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ if (( ${ASSEMBLER} == 1 )); then
fi
if (( ${WRITER} == 1 )); then
echo "Killing assembler..."
echo "Killing writer..."
ps aux | grep mpiexec | awk 'NR > 1 { print prev } { prev = $2 }' | xargs -I{} kill {}
fi
@@ -1,28 +0,0 @@
#!/bin/bash
ENDPOINT="http://127.0.0.1:5000"
SYNC="/write_sync"
ASYNC="/write_async"
KILL="/kill"
HEADER="Content-Type:application/json"
N_IMAGES=500
SOURCES="eiger"
# Define a timestamp function
timestamp() {
date +"%T" # current time
}
generate_post_data()
{
cat <<EOF
{"n_images": 5, "output_file": "$OUTPUT_FILE", "sources": "eiger"}
EOF
}
for((i=1;i<=100;i+=1)); do
TIMESTAMP=$(date +%d-%m-%Y_%H-%M-%S)
echo "[${TIMESTAMP}] Starting Request ${i}..."
OUTPUT_FILE="/home/hax_l/tests/"${TIMESTAMP}"_"${i}".h5"
# echo "$(generate_post_data)"
curl -X POST -H ${HEADER} --data "$(generate_post_data)" ${ENDPOINT}${SYNC}
done
+42
View File
@@ -0,0 +1,42 @@
from datetime import datetime
import requests
import time
import json
# writer agent endpoint
URL = "http://127.0.0.1:5000"
# type of write request
SYNC = "/write_sync"
ASYNC = "/write_async"
KILL = "/write_kill"
# details of request
n_images = 10
n_acquisitions = 2
headers = {'Content-type': 'application/json'}
print("Performing sync aquisitions...")
for i in range(0,n_acquisitions):
output_file ='/home/hax_l/tests/eiger_sync_%s_%s.h5' % (datetime.now().strftime("%H%M%S"), i)
data = {'sources':'eiger', 'n_images':n_images, 'output_file':output_file}
print("REQUEST: ", i)
print("DATA: ", data)
r = requests.post(url = "http://127.0.0.1:5000/write_sync", json=data, headers=headers)
print("RESPONSE FROM REQUEST: ", r.text)
data = None
time.sleep(1)
# time.sleep(3)
# print("Performing async aquisitions...")
# for i in range(0,n_acquisitions):
# output_file ='/home/hax_l/tests/eiger_async_%s_%s.h5' % (datetime.now().strftime("%H%M%S"), i)
# data = {'sources':'eiger', 'n_images':n_images, 'output_file':output_file}
# print("REQUEST: ", i)
# print("DATA: ", data)
# r = requests.post(url = "http://127.0.0.1:5000/write_async", json=data, headers=headers)
# data = None
# time.sleep(1)
# #//TODO print("Testing kill aquisitions...")
+2 -2
View File
@@ -8,10 +8,10 @@ plt.ion()
dacs = np.array([ 0, 2480, 2900, 1400, 4000, 2556, 898, 848, 0, 855, 1100,
1100, 982, 895, 2000, 1550, 570, 0], dtype=np.int32)
tb = np.zeros((256,1024), dtype = np.int32)
tb = np.zeros((512,1024), dtype = np.int32)
# Create the desired pattern
for row in range(0,256,64):
for row in range(0,512,64):
for col in range(0,1024,64):
print(f'{row}, {col}')
tb[row:row+32, col:col+32] = 63
Binary file not shown.