Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions scripts/get_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
parser.add_argument("--exp", help="get experiment name", action='store_true')
parser.add_argument("--live", help="ongoing?", action='store_true')
parser.add_argument("--ended", help="ended", action='store_true')
parser.add_argument("--daq", help="get DAQ type", action='store_true')
parser.add_argument("--hutch", help="get experiment for hutch xxx")
parser.add_argument("--station", help="optional station for hutch with two daqs, e.g. cxi and mfx")
parser.add_argument("--getHutch", help="get hutch (uppercase)", action='store_true')
Expand Down Expand Up @@ -115,8 +116,12 @@
hutch = 'LFE' # because we have so many names for the same subnet.
foundHutch = True
if not foundHutch:
# then ask.....outside of python
print('unknown_hutch')
if args.setExp:
hutch = args.setExp[:3].upper()
foundHutch = True
else:
# then ask.....outside of python
print('unknown_hutch')
sys.exit()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this sys.exit() need to be in the else block so that we don't return if we get the hutch from args.setExp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoot, yes!

if args.getHutch:
print(hutch.upper())
Expand Down Expand Up @@ -203,6 +208,22 @@
logger.exception("No runs?")
print('No runs taken yet')

if args.daq:
if args.setExp:
exp = args.setExp
else:
resp = requests.get(ws_url + "/lgbk/ws/activeexperiment_for_instrument_station",
{"instrument_name": hutch, "station": station})
exp = resp.json().get("value", {}).get("name")

r = requests.get(ws_url + "/lgbk/" + exp + "/ws"
+ "/file_counts_by_extension")
r.raise_for_status()
if "xtc2" in r.json()["value"]:
print('LCLS2')
else:
print('LCLS1')

if args.files_for_run or args.nfiles_for_run:
if args.files_for_run:
run = int(args.files_for_run)
Expand Down
4 changes: 2 additions & 2 deletions scripts/makepeds
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ else
HUTCH=${EXP:0:3}
fi

LCLS2_HUTCHES="rix, tmo, txi, ued, mfx"
if echo "$LCLS2_HUTCHES" | grep -iw "$HUTCH" > /dev/null; then
DAQ=$(get_info --daq --setExp $EXP)
if [[ $DAQ == 'LCLS2' ]]; then
echo "This is a LCLS-II experiment"
MAKEPEDSEXE=makepeds_psana2
else
Expand Down
65 changes: 57 additions & 8 deletions scripts/makepeds_psana2
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,11 @@ ls -ltr "$XTCDIR"/*r"$RUNSTR"*s*xtc*
echo Check detectors:

detnames -r exp="${EXP}",run="${RUN}",dir="${XTCDIR}" > /tmp/detnames_"$EXP"_"$CREATE_TIME"
if $?; then
if [ $? -ne 0 ]; then
echo 'detnames failed'
exit 8
fi

#running local
echo "-----------------------"
echo 'XTC files contain:'
Expand Down Expand Up @@ -479,6 +480,30 @@ if [[ $HAVE_ARCHON -ge 1 ]]; then
done
fi

HAVE_AXIS_SVLS=$(grep -c axis_svls /tmp/detnames_"$EXP"_"$CREATE_TIME")
if [[ $HAVE_AXIS_SVLS -ge 1 ]]; then
DETNAMES=$(grep axis_svls /tmp/detnames_"$EXP"_"$CREATE_TIME" | grep raw | awk 'BEGIN { FS = "|"}; {print $1}' | paste -d " " -s)
DETTYPES=$(grep axis_svls /tmp/detnames_"$EXP"_"$CREATE_TIME" | grep raw | awk 'BEGIN { FS = "|"}; {print $2}' | paste -d " " -s)
for i in "${!DETNAMES[@]}"; do
LOCARG=$ARG' -o '$CALIBDIR
if [[ -v VALSTR ]]; then
LOCARG=$LOCARG' -t '$VALSTR
fi
if [[ -v NRECS1 ]]; then
LOCARG=$LOCARG' --nrecs1 '$NRECS1
fi

MYDET="${DETNAMES[i]// /}"
MYDETTYPE="${DETTYPES[i]// /}"
if [ "$MYDETTYPE" = 'pv' ]; then
echo 'now calibrate...'$MYDET
CMD="det_dark_proc -d $MYDET -k exp=$EXP,run=$RUN,dir=$XTCDIR -L INFO $LOCARG"
echo "$CMD"
$CMD
fi
done
fi

####
# epixquad for UED
####
Expand Down Expand Up @@ -621,18 +646,26 @@ if [[ $HAVE_JUNGFRAU -ge 1 ]]; then
NSEG=99
if [[ $JUNGFRAU =~ "16M" ]]; then
NSEG=32;
elif [[ $JUNGFRAU =~ "4M" ]]; then
NSEG=8;
elif [[ $JUNGFRAU =~ "1M" ]]; then
NSEG=2;
elif [[ $EXP =~ "mfx" ]]; then #note that this is a hotfix!
NSEG=32;
fi
for calibcycle in {0..2}; do
nextcycle=$(( calibcycle + 1 ))
CMD="jungfrau_dark_proc $LOCARG -d $JUNGFRAU -k exp=$EXP,run=$RUN,dir=$XTCDIR --stepnum $calibcycle --stepmax $nextcycle -L INFO"
echo "---------------JUNGFRAU PEDESTALS FOR CYCLE $calibcycle --------------------"
if [[ $RUNLOCAL != 1 ]]; then
for ((segment=0; segment<$NSEG; segment++)); do
if [ $NSEG -lt 99 ]; then
CMDS=$CMD' --idx '$segment
else
CMDS=$CMD
fi
CMDS=$CMD
#commenting this out as MFX currently only uses 4 of the 32 segments
#if [ $NSEG -lt 99 ]; then
# CMDS=$CMD' --idx '$segment
#else
# CMDS=$CMD
#fi
tmpScript=$(mktemp -p $WORKDIR jungfrau_pedestals_tmpXXXXX.sh)
#trap "rm -f $tmpScript" EXIT
chmod u+x "$tmpScript"
Expand All @@ -651,6 +684,10 @@ if [[ $HAVE_JUNGFRAU -ge 1 ]]; then
if [ "$NSEG" -eq 99 ]; then
break
fi
#this here is while we don't have a 32 segment jungfrau available - this belong w/ the --idx section
if [ "$NSEG" -eq 32 ]; then
break
fi
done
else
echo "$CMD"
Expand Down Expand Up @@ -687,6 +724,12 @@ if [[ $HAVE_JUNGFRAU -ge 1 ]]; then
fi

if [ "$DEPLOY" == 1 ]; then
if [[ $RUNLOCAL == 1 ]]; then
read -r -p "Did all jobs succeed and do you want to deploy now (y/n)"
if [ "$REPLY" != "y" ];then
exit 1
fi
fi
echo "---------------JUNGFRAU PEDESTALS CALCULATED NOW DEPLOY --------------------"
if [ $NFAILEDJOBS -gt 0 ]; then
read -r -p "$NFAILEDJOBS of the calibration tasks failed, do you want to continue anyways (y/n)?"
Expand All @@ -698,15 +741,21 @@ if [[ $HAVE_JUNGFRAU -ge 1 ]]; then
for i in "${!DETNAMES[@]}"; do
JUNGFRAU="${DETNAMES[i]// /}"
#for JUNGFRAU in $DETNAMES; do
CMD="jungfrau_deploy_constants -D -d $JUNGFRAU -k exp=$EXP,run=$RUN,dir=$XTCDIR -L INFO -o $CALIBDIR -p psrnx -N1"
echo "****"
echo $(which jungfrau_deploy_constants)
echo "****"
CMD="jungfrau_deploy_constants -D -d $JUNGFRAU -k exp=$EXP,run=$RUN,dir=$XTCDIR -L INFO -o $CALIBDIR -p psrnx"
if [ -v "$VALSTR" ]; then
echo 'setting validity....'"$VALSTR"
CMD=$CMD' -t '$VALSTR
fi
if [ $NSEG -lt 99 ]; then
CMD=$CMD' -N '$NSEG
fi
echo "$CMD"
if ! $CMD; then
echo 'deployment failed'
return 1
exit 1
fi
done

Expand Down
7 changes: 6 additions & 1 deletion scripts/takepeds
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ if [[ "$(daqutils isdaqmgr)" = "true" || ${HUTCH} =~ 'ued' ]]; then
elif [[ ${HUTCH} =~ 'mfx' ]]; then
source $SIT_ENV_DIR/setup_env.sh
jungfrau_pedestal_scan --record 1 --hutch ${HUTCH} -p 0 -g 1 -v -t 10000 -C drp-srcf-cmp014
elif [[ ${HUTCH} =~ 'rix' ]]; then
echo "Running LCLS2 RIX specific pedestal acquisition..."
source /cds/group/pcds/dist/pds/rix/scripts/setup_env.sh
timed_run --duration="60" --config="/cds/group/pcds/dist/pds/rix/scripts/rix.py" --record
fi
else
echo "This is an LCLS-I experiment"
Expand All @@ -46,6 +50,8 @@ else
fi

if [ $? -eq 0 ]; then
echo 'Finished taking the pedestals, now posting to the elog'
echo 'Please call: makepeds -q milano -r '`get_lastRun`' -u <userID>'
elogMessage="DARK"
source pcds_conda
PYCMD=LogBookPost
Expand All @@ -54,7 +60,6 @@ if [ $? -eq 0 ]; then
echo $PYCMD -i "${HUTCH^^}" -u `whoami` -e "$EXP" -t DARK -r $RUN -m "$elogMessage"
$PYCMD -i "${HUTCH^^}" -u `whoami` -p pcds -e "$EXP" -t DARK -r $RUN -m "$elogMessage"&

echo 'Please call: makepeds -q milano -r '`get_lastRun`' -u <userID>'
else
echo 'takepeds failed, make sure the DAQ is setup appropriately!'
fi
Loading