From 5cd2912b16631e2603f74b4d373d09d8b7649779 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 5 Apr 2022 21:06:50 -0700 Subject: [PATCH 01/13] ENH: Added the options to start and stop acquiring images from the command line --- scripts/camViewer | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 5274588b..a42c33cb 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -158,7 +158,8 @@ OPTIONS: -H|--hutch : use a specific hutches camviewer config file -e|--enable : enable camera ioc -d|--disable : disable camera ioc - +-a|--aquire : start acquiring images +-s|--stop : stop acquiring images EOF } @@ -179,9 +180,11 @@ REBOOT=0 ENABLE=0 DISABLE=0 MAINSCREEN=0 +ACQUIRE=0 +STOP=0 -OPTIONS=$(getopt -o lmredc:w:u:H: --long list,main,reboot,enable,disable,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") +OPTIONS=$(getopt -o lmredasc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -226,6 +229,14 @@ do DISABLE=1 shift ;; + -a|--acquire) + ACQUIRE=1 + shift + ;; + -s|--stop) + STOP=1 + shift + ;; ?) usage break @@ -336,6 +347,19 @@ if [ $DISABLE -gt 0 ]; then exit fi +if [ $ACQUIRE -gt 0 ]; then + echo "Acquiring images for ${CAMNAME}" + caput -n "$CAMPVFULL":Acquire 1 + exit +fi + +if [ $STOP -gt 0 ]; then + caput -n "$CAMPVFULL":Acquire 0 + echo "Done acquiring images for ${CAMNAME}" + exit +fi + + IS_ACQUIRING=$(caget -t -n "$CAMPVFULL":Acquire_RBV) if isNum "$IS_ACQUIRING"; then if [ "$IS_ACQUIRING" -eq 0 ]; then From c0be753750bdf2226a4c32205935a461fbfef5c9 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 5 Apr 2022 21:18:38 -0700 Subject: [PATCH 02/13] STY: Fixed spelling mistake --- scripts/camViewer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/camViewer b/scripts/camViewer index a42c33cb..43b750d5 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -158,7 +158,7 @@ OPTIONS: -H|--hutch : use a specific hutches camviewer config file -e|--enable : enable camera ioc -d|--disable : disable camera ioc --a|--aquire : start acquiring images +-a|--acquire : start acquiring images -s|--stop : stop acquiring images EOF } From 4b2fa9bdb8a90ab789a370cf8854e9713a60147f Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 5 Apr 2022 21:19:04 -0700 Subject: [PATCH 03/13] ENH: Updated camviewer options list --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4c247eb4..4d046d90 100644 --- a/README.md +++ b/README.md @@ -69,15 +69,17 @@ usage: /reg/g/pcds/engineering_tools/latest/scripts/camViewer options
start the viewer for controls cameras

OPTIONS:
- -c camera name as in camera list or gige #
- -m bring up the edm screen
- -r reboot the IOC
- -l print list of cameras
- -w # (wait for # hours to ask to renew, default 2 and 12 for GIGEs)
- -u # update rate limit (default 5)
- -H hutch: use a specific hutches camviewer config file
- -e enable camera ioc
- -d disable camera ioc
+ -c|--cam camera name as in camera list or gige #
+ -m|--main bring up the edm screen
+ -r|--reboot reboot the IOC
+ -l|--list print list of cameras
+ -w|--wait # (wait for # hours to ask to renew, default 2 and 12 for GIGEs)
+ -u|--update # update rate limit (default 5)
+ -H|--hutch: use a specific hutches camviewer config file
+ -e|--enable disable camera ioc
+ -d|--disable disable camera ioc
+ -a|--acquire start acquiring images
+ -s|--stop stop acquiring images
From cf585d2c088c41a38dd310c11acaf73e84046813 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Mon, 18 Apr 2022 16:38:14 -0700 Subject: [PATCH 04/13] Added cycle option and updated README --- README.md | 1 + scripts/camViewer | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d046d90..3b364a10 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ usage: /reg/g/pcds/engineering_tools/latest/scripts/camViewer options
-d|--disable disable camera ioc
-a|--acquire start acquiring images
-s|--stop stop acquiring images
+ --cycle cycles acquisition (first stops then starts)
diff --git a/scripts/camViewer b/scripts/camViewer index 43b750d5..6bc00eb6 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -158,8 +158,9 @@ OPTIONS: -H|--hutch : use a specific hutches camviewer config file -e|--enable : enable camera ioc -d|--disable : disable camera ioc --a|--acquire : start acquiring images +-a|--acquire : start acquiring images -s|--stop : stop acquiring images +--cycle : cycles acquistion (first stops then starts) EOF } @@ -182,9 +183,9 @@ DISABLE=0 MAINSCREEN=0 ACQUIRE=0 STOP=0 +CYCLE=0 - -OPTIONS=$(getopt -o lmredasc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") +OPTIONS=$(getopt -o lmredasc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cycle,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -237,6 +238,10 @@ do STOP=1 shift ;; + --cycle) + CYCLE=1 + shift + ;; ?) usage break @@ -358,6 +363,13 @@ if [ $STOP -gt 0 ]; then echo "Done acquiring images for ${CAMNAME}" exit fi + +if [ $CYCLE -gt 0 ]; then + caput -n "$CAMPVFULL":Acquire 0 + sleep 2 + caput -n "$CAMPVFULL":Acquire 1 + exit +fi IS_ACQUIRING=$(caget -t -n "$CAMPVFULL":Acquire_RBV) From 3221bbc2161bd6b9422eb31148f86ad20d1a485f Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Fri, 22 Apr 2022 17:20:21 -0700 Subject: [PATCH 05/13] Added short option for cycling acquisition --- scripts/camViewer | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 6bc00eb6..2c6ee174 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -160,7 +160,7 @@ OPTIONS: -d|--disable : disable camera ioc -a|--acquire : start acquiring images -s|--stop : stop acquiring images ---cycle : cycles acquistion (first stops then starts) +-n|--cycle : cycles acquistion (first stops then starts) EOF } @@ -185,7 +185,7 @@ ACQUIRE=0 STOP=0 CYCLE=0 -OPTIONS=$(getopt -o lmredasc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cycle,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") +OPTIONS=$(getopt -o lmredasnc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cycle,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -238,7 +238,7 @@ do STOP=1 shift ;; - --cycle) + -n|--cycle) CYCLE=1 shift ;; From 95dacd54b04a1edd3e0d0bc460b73759d1cde415 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Fri, 22 Apr 2022 17:24:30 -0700 Subject: [PATCH 06/13] Changed readout messages --- scripts/camViewer | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 2c6ee174..e8342e6c 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -264,14 +264,18 @@ if [ $# -ge 1 ]; then exit 1 fi - -if [ "$hutch" == "" ]; then - hutch=$(get_info --gethutch) +hutch_check() { +hutch=$(get_info --gethutch) if [ "$hutch" == unknown_hutch ]; then echo 'unknown hutch, specify using -H option' + echo 'To start/stop acquisition, you must be on the hutch specific machine' usage exit 1 fi +} + +if [ "$hutch" == "" ]; then + hutch_check fi @@ -353,18 +357,22 @@ if [ $DISABLE -gt 0 ]; then fi if [ $ACQUIRE -gt 0 ]; then - echo "Acquiring images for ${CAMNAME}" + hutch_check + echo "Starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 1 exit fi if [ $STOP -gt 0 ]; then + hutch_check + echo "Stopping acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 - echo "Done acquiring images for ${CAMNAME}" exit fi if [ $CYCLE -gt 0 ]; then + hutch_check + echo "Stopping and starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 sleep 2 caput -n "$CAMPVFULL":Acquire 1 From bb2b3e1ff53011b5d38ac8c0f8528b4abb0dd3ae Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Fri, 22 Apr 2022 17:26:01 -0700 Subject: [PATCH 07/13] Updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b364a10..0d656897 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ usage: /reg/g/pcds/engineering_tools/latest/scripts/camViewer options
-d|--disable disable camera ioc
-a|--acquire start acquiring images
-s|--stop stop acquiring images
- --cycle cycles acquisition (first stops then starts)
+ -n|--cycle cycles acquisition (first stops then starts)
From 266a354228bc77fe72d491435675cfcf488ea0c2 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Wed, 27 Apr 2022 18:16:51 -0700 Subject: [PATCH 08/13] Updated readme and options to include nudge rewrite. --- scripts/camViewer | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index e8342e6c..949f6627 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -143,7 +143,7 @@ iocinfo() { usage() { cat << EOF -usage: $0 options +usage: $0 [options] start the viewer for controls cameras @@ -160,7 +160,7 @@ OPTIONS: -d|--disable : disable camera ioc -a|--acquire : start acquiring images -s|--stop : stop acquiring images --n|--cycle : cycles acquistion (first stops then starts) +-n|--nudge : cycles acquistion (first stops then starts) EOF } @@ -183,9 +183,9 @@ DISABLE=0 MAINSCREEN=0 ACQUIRE=0 STOP=0 -CYCLE=0 +NUDGE=0 -OPTIONS=$(getopt -o lmredasnc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,cycle,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") +OPTIONS=$(getopt -o lmredasnc:w:u:H: --long list,main,reboot,enable,disable,acquire,stop,nudge,cam:,wait:,rate:,hutch: -n \'$0\' -- "$@") if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -238,8 +238,8 @@ do STOP=1 shift ;; - -n|--cycle) - CYCLE=1 + -n|--nudge) + NUDGE=1 shift ;; ?) From f81f29740e5bf78c8355c88e93ea0dd3e69dd78b Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Wed, 27 Apr 2022 18:18:39 -0700 Subject: [PATCH 09/13] Added new function to check for valid hutch --- scripts/camViewer | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 949f6627..65368a07 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -264,20 +264,26 @@ if [ $# -ge 1 ]; then exit 1 fi +VH="/reg/g/pcds/epics-dev/spencera/engineering_tools/scripts/verify-hutch" + hutch_check() { -hutch=$(get_info --gethutch) - if [ "$hutch" == unknown_hutch ]; then - echo 'unknown hutch, specify using -H option' - echo 'To start/stop acquisition, you must be on the hutch specific machine' - usage - exit 1 + hutch=$1 + if [[ "$hutch" == "" ]]; then + hutch=$(get_info --gethutch) + if [[ "$hutch" == unknown_hutch ]]; then + if [[ $NUDGE -gt 0 ]]; then + echo 'To start/stop acquisition, you must be on the hutch specific machine' + exit 1 + else + echo 'unknown hutch, specify using -H option' + usage + exit 1 + fi + fi fi } -if [ "$hutch" == "" ]; then - hutch_check -fi - +hutch_check $hutch EXE="/reg/g/pcds/pyps/config/$hutch/camviewer/run_viewer.csh" @@ -357,21 +363,21 @@ if [ $DISABLE -gt 0 ]; then fi if [ $ACQUIRE -gt 0 ]; then - hutch_check + #hutch_check echo "Starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 1 exit fi if [ $STOP -gt 0 ]; then - hutch_check + #hutch_check echo "Stopping acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 exit fi -if [ $CYCLE -gt 0 ]; then - hutch_check +if [ $NUDGE -gt 0 ]; then + #hutch_check echo "Stopping and starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 sleep 2 From 983f4670d81bb9b31ca638ede627f9d50d29c68e Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Wed, 27 Apr 2022 18:21:25 -0700 Subject: [PATCH 10/13] ENH: Updated MAINSCREEN option --- scripts/camViewer | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/camViewer b/scripts/camViewer index 65368a07..f6ddbc2d 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -327,16 +327,29 @@ fi export EPICS_CA_MAX_ARRAY_BYTES=24000000 echo working with camera of name: $CAMNAME - name_to_pv "$CAMNAME" "$hutch" if [ $MAINSCREEN -gt 0 ]; then + tmp=/tmp/cv.$$ + list_cams $hutch >$tmp + c=$(wc <$tmp | grep "$CAMNAME" $tmp | awk '{print $1}') + if [ "$c" == '' ]; then + echo "Camera name not found in hutch. To see which cameras you can access from your current machine use the '-l/--list' option." + sleep 3 + elif [ "$c" == "$CAMNAME" ] && [ "$hutch" != "$(get_info --gethutch)" ] ; then + echo "To use camera controls, you must be on the same hutch machine as your camera." + echo "Opening read-only main screen..." + sleep 3 + + rm -f $tmp + fi echo 'try to get the main screen for: ' $CAMNAME echo 'start the main screen for camera base PV: ' "$CAMPVFULL" cmdName=$(caget -St "$CAMPVFULL":LAUNCH_EDM) echo calling edm main screen from: "$cmdName" $cmdName exit + fi if [ $REBOOT -gt 0 ]; then From c712f8d1ebdc0d6f02974cd0b0e5d1cd58d97b99 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 9 May 2023 20:01:33 -0700 Subject: [PATCH 11/13] Fixed long option for 'reboot' --- scripts/camViewer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/camViewer b/scripts/camViewer index f6ddbc2d..71ebc5e5 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -218,7 +218,7 @@ do MAINSCREEN=1 shift ;; - -r|--rate) + -r|--reboot) REBOOT=1 shift ;; From 40fa5f60415a6ac01b3d334757c359225c300c39 Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 9 May 2023 20:12:38 -0700 Subject: [PATCH 12/13] Removed hutch_check function and placed with verify-hutch --- scripts/camViewer | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 71ebc5e5..8f5c0e43 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -264,26 +264,7 @@ if [ $# -ge 1 ]; then exit 1 fi -VH="/reg/g/pcds/epics-dev/spencera/engineering_tools/scripts/verify-hutch" - -hutch_check() { - hutch=$1 - if [[ "$hutch" == "" ]]; then - hutch=$(get_info --gethutch) - if [[ "$hutch" == unknown_hutch ]]; then - if [[ $NUDGE -gt 0 ]]; then - echo 'To start/stop acquisition, you must be on the hutch specific machine' - exit 1 - else - echo 'unknown hutch, specify using -H option' - usage - exit 1 - fi - fi - fi -} - -hutch_check $hutch +verify-hutch "$hutch" EXE="/reg/g/pcds/pyps/config/$hutch/camviewer/run_viewer.csh" From 90b9f610c08002142b1c46e9d22aa13d43045c6b Mon Sep 17 00:00:00 2001 From: Aalayah I Spencer Date: Tue, 9 May 2023 20:17:48 -0700 Subject: [PATCH 13/13] Style and format fixes --- scripts/camViewer | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/scripts/camViewer b/scripts/camViewer index 8f5c0e43..70e8ecf6 100755 --- a/scripts/camViewer +++ b/scripts/camViewer @@ -285,7 +285,7 @@ fi -if [ $CAMNUM -eq 0 ]; then +if [ "$CAMNUM" -eq 0 ]; then if [ "$hutch" = "tmo" ]; then CAMNAME=IM2K0 elif [ "$hutch" = "rix" ]; then @@ -302,17 +302,15 @@ if [ $CAMNUM -eq 0 ]; then CAMNAME=xcs_yag2 fi - fi - export EPICS_CA_MAX_ARRAY_BYTES=24000000 -echo working with camera of name: $CAMNAME +echo working with camera of name: "$CAMNAME" name_to_pv "$CAMNAME" "$hutch" if [ $MAINSCREEN -gt 0 ]; then tmp=/tmp/cv.$$ - list_cams $hutch >$tmp + list_cams "$hutch" >$tmp c=$(wc <$tmp | grep "$CAMNAME" $tmp | awk '{print $1}') if [ "$c" == '' ]; then echo "Camera name not found in hutch. To see which cameras you can access from your current machine use the '-l/--list' option." @@ -324,17 +322,16 @@ if [ $MAINSCREEN -gt 0 ]; then rm -f $tmp fi - echo 'try to get the main screen for: ' $CAMNAME + echo 'try to get the main screen for: ' "$CAMNAME" echo 'start the main screen for camera base PV: ' "$CAMPVFULL" cmdName=$(caget -St "$CAMPVFULL":LAUNCH_EDM) echo calling edm main screen from: "$cmdName" $cmdName exit - fi if [ $REBOOT -gt 0 ]; then - echo 'reboot IOC for camera: ' $CAMNAME + echo 'reboot IOC for camera: ' "$CAMNAME" edmcmdName=$(caget -St "$CAMPVFULL":LAUNCH_EDM) IOCPV=$(grep 'export IOC_PV' "$edmcmdName" | awk '{print $2 "\n" }' | sed s/IOC_PV=/''/g) echo 'restart IOC last started on: ' "$(caget -t "$IOCPV":STARTTOD)" @@ -342,48 +339,44 @@ if [ $REBOOT -gt 0 ]; then exit fi -if [ $ENABLE -gt 0 ]; then +if [ $ENABLE -gt 0 ]; then echo "Enabling ${CAMNAME}" iocinfo - imgr "$ioc" --hutch "$iochutch" --enable + imgr "$ioc" --hutch "$iochutch" --enable exit fi if [ $DISABLE -gt 0 ]; then echo "Disabling ${CAMNAME}" iocinfo - imgr "$ioc" --hutch "$iochutch" --disable + imgr "$ioc" --hutch "$iochutch" --disable exit fi if [ $ACQUIRE -gt 0 ]; then - #hutch_check echo "Starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 1 exit fi if [ $STOP -gt 0 ]; then - #hutch_check - echo "Stopping acquisition for ${CAMNAME}" + echo "Stopping acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 exit fi if [ $NUDGE -gt 0 ]; then - #hutch_check echo "Stopping and starting acquisition for ${CAMNAME}" caput -n "$CAMPVFULL":Acquire 0 sleep 2 caput -n "$CAMPVFULL":Acquire 1 exit fi - IS_ACQUIRING=$(caget -t -n "$CAMPVFULL":Acquire_RBV) if isNum "$IS_ACQUIRING"; then if [ "$IS_ACQUIRING" -eq 0 ]; then - echo 'start acquiring for camera ' $CAMNAME + echo 'start acquiring for camera ' "$CAMNAME" caput -n "$CAMPVFULL":Acquire 1 fi else