-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from nikitinvv/master
merging latest from 7-BM and 2-BM
- Loading branch information
Showing
24 changed files
with
1,866 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
TOP = ../.. | ||
include $(TOP)/configure/CONFIG | ||
#ARCH = windows-x64-static | ||
ARCH = linux-x86_64 | ||
TARGETS = envPaths dllPath.bat | ||
include $(TOP)/configure/RULES.ioc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
file "tomoStream.req", P=$(P), R=$(R) | ||
file "tomoStream_settings.req", P=$(P), R=$(R) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
### save_restore setup | ||
# | ||
# The rest this file does not require modification for standard use, but... | ||
# If you want save_restore to manage its own NFS mount, specify the name and | ||
# IP address of the file server to which save files should be written. | ||
# This currently is supported only on vxWorks. | ||
#save_restoreSet_NFSHost("oxygen", "164.54.52.4") | ||
|
||
# Debug-output level | ||
save_restoreSet_Debug(0) | ||
|
||
# Ok to save/restore save sets with missing values (no CA connection to PV)? | ||
save_restoreSet_IncompleteSetsOk(1) | ||
# Save dated backup files? | ||
save_restoreSet_DatedBackupFiles(1) | ||
|
||
# Number of sequenced backup files to write | ||
save_restoreSet_NumSeqFiles(3) | ||
# Time interval between sequenced backups | ||
save_restoreSet_SeqPeriodInSeconds(300) | ||
|
||
# specify where save files should be | ||
set_savefile_path(".", "autosave") | ||
|
||
# specify what save files should be restored. Note these files must be | ||
# in the directory specified in set_savefile_path(), or, if that function | ||
# has not been called, from the directory current when iocInit is invoked | ||
set_pass0_restoreFile("auto_settings.sav") | ||
set_pass1_restoreFile("auto_settings.sav") | ||
|
||
# specify directories in which to to search for included request files | ||
# Note cdCommands defines 'startup', but envPaths does not | ||
set_requestfile_path(".", "") | ||
set_requestfile_path(".", "autosave") | ||
set_requestfile_path($(AUTOSAVE), "db") | ||
set_requestfile_path($(TOP), "db") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
< envPaths | ||
|
||
epicsEnvSet("P", "7bmtomo:") | ||
epicsEnvSet("R", "EncoderStream:") | ||
|
||
## Register all support components | ||
|
||
# Use these lines to run the locally built tomoStreamApp | ||
dbLoadDatabase "../../dbd/tomoStreamApp.dbd" | ||
tomoStreamApp_registerRecordDeviceDriver pdbbase | ||
|
||
# Use these lines to run the xxx application on APSshare. | ||
#dbLoadDatabase "/APSshare/epics/synApps_6_1/support/xxx-R6-1/dbd/iocxxxLinux.dbd" | ||
#iocxxxLinux_registerRecordDeviceDriver pdbbase | ||
|
||
|
||
dbLoadTemplate("tomoStream.substitutions") | ||
|
||
< save_restore.cmd | ||
save_restoreSet_status_prefix($(P)) | ||
dbLoadRecords("$(AUTOSAVE)/asApp/Db/save_restoreStatus.db", "P=$(P)") | ||
|
||
iocInit | ||
|
||
create_monitor_set("auto_settings.req", 30, "P=$(P),R=$(R)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Use this line to run the locally built tomoStreamApp | ||
../../bin/linux-x86_64/tomoStreamApp st.cmd | ||
|
||
# Use this line to run the xxx application on /APSshare | ||
#/APSshare/epics/synApps_6_1/support/xxx-R6-1/bin/linux-x86_64/xxx st.cmd | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
medm -x -macro "P=7bmtomo:,R=EncoderStream:" ../../tomoStreamApp/op/adl/tomoStream.adl & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# This script creates an object of type TomoStream for doing tomography streaming reconstruction | ||
# To run this script type the following: | ||
# python -i start_tomostream.py | ||
# The -i is needed to keep Python running, otherwise it will create the object and exit | ||
|
||
import sys | ||
sys.path.append('/home/beams/7BMB/solder_beamtime/solder_imaging') | ||
|
||
from tomostream3d import EncoderStream | ||
ts = EncoderStream(["../../db/tomoStream_settings.req","../../db/tomoStream_settings.req"], {"$(P)":"7bmtomo:", "$(R)":"EncoderStream:"}) | ||
|
||
|
||
|
||
|
||
# import vedo | ||
# import matplotlib.pyplot as plt | ||
# from vedo.applications import IsosurfaceBrowser | ||
|
||
# clip_val = 0.3 | ||
# from pdb import set_trace | ||
# from time import sleep | ||
|
||
|
||
# def run_vis(vol_vis): | ||
|
||
# vol_vis = vol_vis < clip_val | ||
# vol = vedo.Volume(vol_vis) | ||
# plt = IsosurfaceBrowser(vol, c='gold') # Plotter instance | ||
# plt.show(axes = 7, bg2 = 'lb').close() | ||
# return | ||
|
||
|
||
# import threading, queue | ||
|
||
# q = queue.Queue(maxsize = 2) | ||
|
||
# def worker(): | ||
# while True: | ||
# if q.qsize() > 2: | ||
# continue | ||
# vol_vis = ts.slv.rec_vol[::2,::2,::2].get() | ||
# q.put(vol_vis) | ||
# q.task_done() | ||
# sleep(2.0) | ||
|
||
|
||
|
||
# sleep(30.0) | ||
|
||
# # turn-on the worker thread | ||
# threading.Thread(target=worker, daemon=True).start() | ||
|
||
|
||
|
||
# while True: | ||
# vol_vis = q.get() | ||
# run_vis(vol_vis) | ||
# sleep(5.0) | ||
|
||
# # block until all tasks are done | ||
# q.join() | ||
# print('All work completed') | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
file "$(TOP)/db/tomoStream.template" | ||
{ | ||
pattern | ||
{ P, R, TOMO_SCAN, IMAGE_P, DARK_PVA, FLAT_PVA, RECON_PVA, THETA_PVA} | ||
{7bmtomo:, EncoderStream:, 7bmtomo:TomoScanStream:, 7bmtomo:TSS:PvaPluginPVPrefix, 7bmtomo:TSS:StreamDarkFields, 7bmtomo:TSS:StreamFlatFields, 7bmtomo:EncoderStream:StreamRecon, 7bmtomo:TSS:StreamTheta} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
#!/bin/sh | ||
# | ||
# description: start/stop/restart an EPICS IOC in a screen session | ||
# | ||
|
||
# Manually set IOC_STARTUP_DIR if 7bm_dau3.sh will reside somewhere other than softioc | ||
IOC_STARTUP_DIR=/home/beams/7BMB/epics/synApps/support/tomostream/iocBoot/iocTomoStream_7BM | ||
IOC_BINARY="python -i" | ||
IOC_NAME=TomoStream_python | ||
# The name of the IOC binary isn't necessarily the same as the name of the IOC | ||
# Change YES to NO in the following line to disable screen-PID lookup | ||
GET_SCREEN_PID=YES | ||
|
||
# Commands needed by this script | ||
ECHO=echo | ||
ID=id | ||
PGREP=pgrep | ||
SCREEN=screen | ||
KILL=kill | ||
BASENAME=basename | ||
DIRNAME=dirname | ||
READLINK=readlink | ||
PS=ps | ||
##################################################################### | ||
|
||
SNAME=${BASH_SOURCE:-$0} | ||
SELECTION=$1 | ||
|
||
IOC_STARTUP_FILE="start_tomostream_7bm.py" | ||
|
||
if [ -z "$IOC_STARTUP_DIR" ] ; then | ||
# If no startup dir is specified, use the script's directory | ||
IOC_STARTUP_DIR=`dirname ${SNAME}` | ||
IOC_CMD="${IOC_BINARY} ${IOC_STARTUP_FILE}" | ||
else | ||
IOC_CMD="${IOC_BINARY} ${IOC_STARTUP_DIR}/${IOC_STARTUP_FILE}" | ||
fi | ||
|
||
##################################################################### | ||
|
||
screenpid() { | ||
if [ -z ${SCREEN_PID} ] ; then | ||
${ECHO} | ||
else | ||
${ECHO} " in a screen session (pid=${SCREEN_PID})" | ||
fi | ||
} | ||
|
||
checkpid() { | ||
MY_UID=`${ID} -u` | ||
# The '\$' is needed in the pgrep pattern to select 7bmLinux, but not 7bmLinux.sh | ||
IOC_PID=`${PGREP} ${IOC_BINARY}\$ -u ${MY_UID}` | ||
#!${ECHO} "IOC_PID=${IOC_PID}" | ||
|
||
if [ "${IOC_PID}" != "" ] ; then | ||
# Assume the IOC is down until proven otherwise | ||
IOC_DOWN=1 | ||
|
||
# At least one instance of the IOC binary is running; | ||
# Find the binary that is associated with this script/IOC | ||
for pid in ${IOC_PID}; do | ||
BIN_CWD=`${READLINK} /proc/${pid}/cwd` | ||
IOC_CWD=`${READLINK} -f ${IOC_STARTUP_DIR}` | ||
|
||
if [ "$BIN_CWD" = "$IOC_CWD" ] ; then | ||
# The IOC is running; the binary with PID=$pid is the IOC that was run from $IOC_STARTUP_DIR | ||
IOC_PID=${pid} | ||
IOC_DOWN=0 | ||
|
||
SCREEN_PID="" | ||
|
||
if [ "${GET_SCREEN_PID}" = "YES" ] ; then | ||
# Get the PID of the parent of the IOC (shell or screen) | ||
P_PID=`${PS} -p ${IOC_PID} -o ppid=` | ||
|
||
# Get the PID of the grandparent of the IOC (sshd, screen, or ???) | ||
GP_PID=`${PS} -p ${P_PID} -o ppid=` | ||
|
||
#!${ECHO} "P_PID=${P_PID}, GP_PID=${GP_PID}" | ||
|
||
# Get the screen PIDs | ||
S_PIDS=`${PGREP} screen` | ||
|
||
for s_pid in ${S_PIDS} ; do | ||
#!${ECHO} ${s_pid} | ||
|
||
if [[ ${s_pid} -eq ${P_PID} ]] ; then | ||
SCREEN_PID=${s_pid} | ||
break | ||
fi | ||
|
||
if [[ ${s_pid} -eq ${GP_PID} ]] ; then | ||
SCREEN_PID=${s_pid} | ||
break | ||
fi | ||
|
||
done | ||
fi | ||
|
||
break | ||
#else | ||
# ${ECHO} "PATHS are different" | ||
# ${ECHO} ${BIN_CWD} | ||
# ${ECHO} ${IOC_CWD} | ||
fi | ||
done | ||
else | ||
# IOC is not running | ||
IOC_DOWN=1 | ||
fi | ||
|
||
return ${IOC_DOWN} | ||
} | ||
|
||
start() { | ||
if checkpid; then | ||
${ECHO} -n "${IOC_NAME} is already running (pid=${IOC_PID})" | ||
screenpid | ||
else | ||
${ECHO} "Starting ${IOC_NAME}" | ||
cd ${IOC_STARTUP_DIR} | ||
# Run 7bmLinux inside a screen session | ||
${SCREEN} -dm -S ${IOC_NAME} -h 5000 ${IOC_CMD} | ||
fi | ||
} | ||
|
||
stop() { | ||
if checkpid; then | ||
${ECHO} "Stopping ${IOC_NAME} (pid=${IOC_PID})" | ||
${KILL} ${IOC_PID} | ||
else | ||
${ECHO} "${IOC_NAME} is not running" | ||
fi | ||
} | ||
|
||
restart() { | ||
stop | ||
start | ||
} | ||
|
||
status() { | ||
if checkpid; then | ||
${ECHO} -n "${IOC_NAME} is running (pid=${IOC_PID})" | ||
screenpid | ||
else | ||
${ECHO} "${IOC_NAME} is not running" | ||
fi | ||
} | ||
|
||
console() { | ||
if checkpid; then | ||
${ECHO} "Connecting to ${IOC_NAME}'s screen session" | ||
# The -r flag will only connect if no one is attached to the session | ||
#!${SCREEN} -r ${IOC_NAME} | ||
# The -x flag will connect even if someone is attached to the session | ||
${SCREEN} -x ${IOC_NAME} | ||
else | ||
${ECHO} "${IOC_NAME} is not running" | ||
fi | ||
} | ||
|
||
run() { | ||
if checkpid; then | ||
${ECHO} -n "${IOC_NAME} is already running (pid=${IOC_PID})" | ||
screenpid | ||
else | ||
${ECHO} "Starting ${IOC_NAME}" | ||
cd ${IOC_STARTUP_DIR} | ||
# Run 7bmLinux outside of a screen session, which is helpful for debugging | ||
${IOC_CMD} | ||
fi | ||
} | ||
|
||
start_medm() { | ||
${IOC_STARTUP_DIR}/../../start_MEDM_7bmLinux | ||
} | ||
|
||
start_caqtdm() { | ||
${IOC_STARTUP_DIR}/../../start_caQtDM_7bmLinux | ||
} | ||
|
||
usage() { | ||
${ECHO} "Usage: $(${BASENAME} ${SNAME}) {start|stop|restart|status|console|run|medm|caqtdm}" | ||
} | ||
|
||
##################################################################### | ||
|
||
if [ ! -d ${IOC_STARTUP_DIR} ] ; then | ||
${ECHO} "Error: ${IOC_STARTUP_DIR} doesn't exist." | ||
${ECHO} "IOC_STARTUP_DIR in ${SNAME} needs to be corrected." | ||
else | ||
case ${SELECTION} in | ||
start) | ||
start | ||
;; | ||
|
||
stop | kill) | ||
stop | ||
;; | ||
|
||
restart) | ||
restart | ||
;; | ||
|
||
status) | ||
status | ||
;; | ||
|
||
console) | ||
console | ||
;; | ||
|
||
run) | ||
run | ||
;; | ||
|
||
medm) | ||
start_medm | ||
;; | ||
|
||
caqtdm) | ||
start_caqtdm | ||
;; | ||
|
||
*) | ||
usage | ||
;; | ||
esac | ||
fi |
Oops, something went wrong.