From 49bf9940defa27f038e42f3bcebba78f185c7ed9 Mon Sep 17 00:00:00 2001 From: Dmitry Ozerov Date: Mon, 14 Aug 2023 13:53:55 +0200 Subject: [PATCH] further polishing --- scripts/ap.sh | 7 +++++ scripts/ave-resolution | 47 +++++++++++++++++++++++++++++++ scripts/env_setup.sh | 16 ++++++----- scripts/re-insert-spearsheet.2.sh | 1 + scripts/re-insert-spearsheet.sh | 1 + 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100755 scripts/ave-resolution diff --git a/scripts/ap.sh b/scripts/ap.sh index 99910da..edc3e2b 100755 --- a/scripts/ap.sh +++ b/scripts/ap.sh @@ -2,6 +2,13 @@ . ./env_setup.sh +if [ -e STOP ] +then + echo "STOP file present - exiting AP now" + echo "to run AP, remove STOP file with rm STOP" + exit +fi + while true do echo "Running "`date` diff --git a/scripts/ave-resolution b/scripts/ave-resolution new file mode 100755 index 0000000..22e8db0 --- /dev/null +++ b/scripts/ave-resolution @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Find mean diffracting resolution +# +# Copyright © 2014-2017 Deutsches Elektronen-Synchrotron DESY, +# a research centre of the Helmholtz Association. +# +# Author: +# 2014-2017 Thomas White +# 2018 D. Ozerov (protected against zero indexed patterns, for sf-daq_ap) +# + +import sys +import numpy +import matplotlib.pyplot as plt + +if sys.argv[1] == '-': + f = sys.stdin +else: + f = open(sys.argv[1]) + +a = [] + +while True: + fline = f.readline() + if not fline: + break + if fline.find("diffraction_resolution_limit") != -1: + res = float(fline.split('= ')[1].split(' ')[0].rstrip("\r\n")) + a.append(res) + continue + +f.close() + +if len(a) > 0: + b = numpy.array(a) + print(" Mean: {:.2} nm^-1 = {:.4} A".format(numpy.mean(b),10.0/numpy.mean(b))) + print(" Best: {:.2} nm^-1 = {:.4} A".format(numpy.max(b),10.0/numpy.max(b))) + print("Worst: {:.2} nm^-1 = {:.4} A".format(numpy.min(b),10.0/numpy.min(b))) + print("Std deviation: {:.2} nm^-1".format(numpy.std(b))) +else: + print(" Mean: {:.2} nm^-1 = nan A") + print(" Best: {:.2} nm^-1 = nan A") + print("Worst: {:.2} nm^-1 = nan A") + print("Std deviation: nan") + diff --git a/scripts/env_setup.sh b/scripts/env_setup.sh index e3b028c..5debfe1 100755 --- a/scripts/env_setup.sh +++ b/scripts/env_setup.sh @@ -2,14 +2,9 @@ export PGROUP= -export BEAMLINE=alvra +export BEAMLINE= # Choice: alvra bernina cristallina furka maloja -BASEDIR=/sf/${BEAMLINE}/data/${PGROUP}/res - -source /sf/jungfrau/applications/miniconda3/etc/profile.d/conda.sh -conda activate sf-dap - export DETECTOR_NAME= # Possible choice: JF06T08V04 JF06T32V04 JF17T16V01 @@ -20,6 +15,13 @@ export GEOM_FILE=${DETECTOR_NAME}.geom # edit run_index.*.sh file(s) for (more) indexing options export THRESHOLD_INDEXING= -LOGBOOK= +export LOGBOOK= # Possible choice: None (if no google logbook feeling) +# + +export BASEDIR=/sf/${BEAMLINE}/data/${PGROUP}/res + +source /sf/jungfrau/applications/miniconda3/etc/profile.d/conda.sh +conda activate sf-dap + diff --git a/scripts/re-insert-spearsheet.2.sh b/scripts/re-insert-spearsheet.2.sh index 82c80da..6cbb035 100755 --- a/scripts/re-insert-spearsheet.2.sh +++ b/scripts/re-insert-spearsheet.2.sh @@ -18,6 +18,7 @@ do chmod +x a ./a > $f fi + rm -rf a fi fi done diff --git a/scripts/re-insert-spearsheet.sh b/scripts/re-insert-spearsheet.sh index 7e1926a..339c5d6 100755 --- a/scripts/re-insert-spearsheet.sh +++ b/scripts/re-insert-spearsheet.sh @@ -29,6 +29,7 @@ do mv b $f mv a re-try/run00${i}.`date +%s`.sh fi + rm -rf a fi fi done