Export more vars on declare
This commit is contained in:
@@ -587,7 +587,7 @@ easy() {
|
|||||||
'NoGrowth_.txt', and 'GrowthOnly_.txt' files will be generated in the 'PrintResults' folder.
|
'NoGrowth_.txt', and 'GrowthOnly_.txt' files will be generated in the 'PrintResults' folder.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
EASY_DIR="$APPS_DIR/matlab/easy"
|
declare -gx EASY_DIR="$APPS_DIR/matlab/easy"
|
||||||
script="$EASY_DIR/EASYconsole.m"
|
script="$EASY_DIR/EASYconsole.m"
|
||||||
|
|
||||||
# Copy templates
|
# Copy templates
|
||||||
@@ -604,14 +604,12 @@ easy() {
|
|||||||
# TODO will need to play with the -sd startup option to see what works (well)
|
# TODO will need to play with the -sd startup option to see what works (well)
|
||||||
# Skip this step altogether in auto mode since it requires graphical interaction
|
# Skip this step altogether in auto mode since it requires graphical interaction
|
||||||
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
|
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
|
||||||
export PROJECT_SCANS_DIR PROJECT_DATE PROJECT_USER PROJECT
|
# export PROJECT_SCANS_DIR PROJECT_DATE PROJECT_USER PROJECT
|
||||||
export EASY_DIR EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR
|
# export EASY_DIR EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR
|
||||||
export MASTER_PLATE_FILE DRUG_MEDIA_FILE
|
# export MASTER_PLATE_FILE DRUG_MEDIA_FILE
|
||||||
|
|
||||||
choose_easy_results_dir
|
declare -gx DRUG_MEDIA_FILE="$EASY_RESULTS_DIR/DrugMedia_$PROJECT.xls"
|
||||||
|
declare -gx MASTER_PLATE_FILE="$EASY_RESULTS_DIR/MasterPlate_$PROJECT.xls"
|
||||||
DRUG_MEDIA_FILE="$EASY_RESULTS_DIR/DrugMedia_$PROJECT.xls"
|
|
||||||
MASTER_PLATE_FILE="$EASY_RESULTS_DIR/MasterPlate_$PROJECT.xls"
|
|
||||||
|
|
||||||
# Make EASY dirs
|
# Make EASY dirs
|
||||||
debug "mkdir -p $EASY_RESULTS_DIR"
|
debug "mkdir -p $EASY_RESULTS_DIR"
|
||||||
@@ -631,9 +629,6 @@ easy() {
|
|||||||
# matlab -nosplash -sd "$PROJECT_SCANS_DIR" -r "run $script"
|
# matlab -nosplash -sd "$PROJECT_SCANS_DIR" -r "run $script"
|
||||||
matlab -nosplash -r "run $script"
|
matlab -nosplash -r "run $script"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use the function return code see if we succeeded
|
|
||||||
# choose_easy_results_dir || (err "No EASY results found in $PROJECT_SCANS_DIR"; return 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -642,18 +637,16 @@ module ezview
|
|||||||
# @description TODO WIP
|
# @description TODO WIP
|
||||||
ezview() {
|
ezview() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
export PROJECT_SCANS_DIR PROJECT_DATE PROJECT_USER EZVIEW_DIR
|
|
||||||
export EASY_RESULTS_DIR
|
|
||||||
|
|
||||||
EZVIEW_DIR="$APPS_DIR/matlab/ezview"
|
declare -gx EZVIEW_DIR="$APPS_DIR/matlab/ezview"
|
||||||
script="$EZVIEW_DIR/EZviewGui.m"
|
script="$EZVIEW_DIR/EZviewGui.m"
|
||||||
|
|
||||||
# Try to load EASY output dir fromENV or easy module
|
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
|
||||||
# Then scan for EASY results
|
|
||||||
[[ -z $EASY_RESULTS_DIR ]] && choose_easy_results_dir
|
|
||||||
|
|
||||||
# Make EZview dirs
|
# Make EZview dirs
|
||||||
|
|
||||||
|
# Start EZview
|
||||||
matlab -nosplash -r "run $script"
|
matlab -nosplash -r "run $script"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1397,57 +1390,57 @@ get_studies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
submodule choose_easy_results_dir #
|
# submodule choose_easy_results_dir #
|
||||||
# @description Chooses an EASY scans directory if the information is undefined
|
# # @description Chooses an EASY scans directory if the information is undefined
|
||||||
# TODO: Standardize EASY output, it's hard to understand
|
# # TODO: Standardize EASY output, it's hard to understand
|
||||||
# TODO eventually we could run this on multiple results dirs simultaneously with some refactoring
|
# # TODO eventually we could run this on multiple results dirs simultaneously with some refactoring
|
||||||
# @exitcode 0 if successfully choose an EASY results dir
|
# # @exitcode 0 if successfully choose an EASY results dir
|
||||||
# @set EASY_RESULTS_DIR string The working EASY output directory
|
# # @set EASY_RESULTS_DIR string The working EASY output directory
|
||||||
choose_easy_results_dir() {
|
# choose_easy_results_dir() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
# debug "Running: ${FUNCNAME[0]}"
|
||||||
|
|
||||||
declare -g EASY_RESULTS_DIR="$QHTCP_PROJECT_DIR/easy"
|
|
||||||
|
|
||||||
# Always backup existing output
|
|
||||||
# This would happen if you ran the same experiment twice in one day, for instance
|
|
||||||
[[ -d $EASY_RESULTS_DIR ]] && backup "$EASY_RESULTS_DIR"
|
|
||||||
|
|
||||||
if [[ ! -d $EASY_RESULTS_DIR ]]; then
|
# # Always backup existing output
|
||||||
debug "mkdir $EASY_RESULTS_DIR"
|
# # This would happen if you ran the same experiment twice in one day, for instance
|
||||||
mkdir "$EASY_RESULTS_DIR"
|
# [[ -d $EASY_RESULTS_DIR ]] && backup "$EASY_RESULTS_DIR"
|
||||||
else
|
|
||||||
err "Could not create $EASY_RESULTS_DIR"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# echo "Hit enter to use the default EASY results directory: $default_easy_results_dir"
|
# if [[ ! -d $EASY_RESULTS_DIR ]]; then
|
||||||
# if ! (( YES )); then
|
# debug "mkdir $EASY_RESULTS_DIR"
|
||||||
# read -r -p "Or enter a custom directory name, example: $PROJECT" dirname
|
# mkdir "$EASY_RESULTS_DIR"
|
||||||
# [[ -z $dirname ]] && EASY_RESULTS_DIR="$default_easy_results_dir" && return 0
|
# else
|
||||||
# fi
|
# err "Could not create $EASY_RESULTS_DIR"
|
||||||
# ((YES)) && return 0
|
# return 0
|
||||||
# # Let's get a little fancy
|
# fi
|
||||||
# shopt -s nullglob
|
|
||||||
# declare -la easy_results_dirs=( "$easy_out_dir/"*/ )
|
# # echo "Hit enter to use the default EASY results directory: $default_easy_results_dir"
|
||||||
# shopt -u nullglob
|
# # if ! (( YES )); then
|
||||||
# # Sort the dirs
|
# # read -r -p "Or enter a custom directory name, example: $PROJECT" dirname
|
||||||
# mapfile -t easy_results_dirs < <(printf '%s\n' "${easy_results_dirs[@]}" | sort)
|
# # [[ -z $dirname ]] && EASY_RESULTS_DIR="$default_easy_results_dir" && return 0
|
||||||
# last_index=$(( ${#easy_results_dirs} - 1 ))
|
# # fi
|
||||||
# ((YES)) && EASY_RESULTS_DIR="${easy_results_dirs[$last_index]}" && return 0
|
# # ((YES)) && return 0
|
||||||
# echo "Multiple EASY results dirs found in $PROJECT_SCANS_DIR"
|
# # # Let's get a little fancy
|
||||||
# echo "Here is a list: "
|
# # shopt -s nullglob
|
||||||
# for i in "${!easy_results_dirs[@]}"; do
|
# # declare -la easy_results_dirs=( "$easy_out_dir/"*/ )
|
||||||
# printf "%d. %s\n" "$((i+1))" "${easy_results_dirs[i]}"
|
# # shopt -u nullglob
|
||||||
# done
|
# # # Sort the dirs
|
||||||
# printf "%s\n" "${easy_results_dirs[@]}"
|
# # mapfile -t easy_results_dirs < <(printf '%s\n' "${easy_results_dirs[@]}" | sort)
|
||||||
# last_index=$(( ${#easy_results_dirs} - 1 ))
|
# # last_index=$(( ${#easy_results_dirs} - 1 ))
|
||||||
# read -r -p "Enter the item number to select EASY results directory, default ($last_index): " response
|
# # ((YES)) && EASY_RESULTS_DIR="${easy_results_dirs[$last_index]}" && return 0
|
||||||
# [[ -z $response ]] && response=$last_index
|
# # echo "Multiple EASY results dirs found in $PROJECT_SCANS_DIR"
|
||||||
# response=$(( response - 1 )) # bash arrays use zero indexing
|
# # echo "Here is a list: "
|
||||||
# EASY_RESULTS_DIR="${easy_results_dirs[$response]}"
|
# # for i in "${!easy_results_dirs[@]}"; do
|
||||||
# EASY_RESULTS_FILES=("$EASY_RESULTS_DIR/"*"/PrintResults/!!"*)
|
# # printf "%d. %s\n" "$((i+1))" "${easy_results_dirs[i]}"
|
||||||
# [[ ${#easy_results_dirs[@]} -gt 0 ]]
|
# # done
|
||||||
}
|
# # printf "%s\n" "${easy_results_dirs[@]}"
|
||||||
|
# # last_index=$(( ${#easy_results_dirs} - 1 ))
|
||||||
|
# # read -r -p "Enter the item number to select EASY results directory, default ($last_index): " response
|
||||||
|
# # [[ -z $response ]] && response=$last_index
|
||||||
|
# # response=$(( response - 1 )) # bash arrays use zero indexing
|
||||||
|
# # EASY_RESULTS_DIR="${easy_results_dirs[$response]}"
|
||||||
|
# # EASY_RESULTS_FILES=("$EASY_RESULTS_DIR/"*"/PrintResults/!!"*)
|
||||||
|
# # [[ ${#easy_results_dirs[@]} -gt 0 ]]
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
submodule documentation
|
submodule documentation
|
||||||
@@ -1575,16 +1568,16 @@ main() {
|
|||||||
|
|
||||||
# Loop over projects
|
# Loop over projects
|
||||||
for PROJECT in "${PROJECTS[@]}"; do
|
for PROJECT in "${PROJECTS[@]}"; do
|
||||||
declare -g PROJECT_SCANS_DIR="$SCANS_DIR/$PROJECT"
|
declare -gx PROJECT_SCANS_DIR="$SCANS_DIR/$PROJECT"
|
||||||
declare -g PROJECT_DATE="${PROJECT%"${PROJECT#????????}"}" # e.g. 20240723
|
declare -gx PROJECT_DATE="${PROJECT%"${PROJECT#????????}"}" # e.g. 20240723
|
||||||
declare -g PROJECT_SUFFIX="${PROJECT#????????_*_}"
|
declare -gx PROJECT_SUFFIX="${PROJECT#????????_*_}"
|
||||||
declare -g PROJECT_USER="${PROJECT#????????_}"; PROJECT_USER="${PROJECT_USER%%_*}"
|
declare -gx PROJECT_USER="${PROJECT#????????_}"; PROJECT_USER="${PROJECT_USER%%_*}"
|
||||||
declare -g STUDIES_ARCHIVE_FILE="$OUT_DIR/StudiesDataArchive.txt"
|
declare -gx STUDIES_ARCHIVE_FILE="$OUT_DIR/StudiesDataArchive.txt"
|
||||||
declare -g QHTCP_PROJECT_DIR="$OUT_DIR/$PROJECT"
|
declare -gx QHTCP_PROJECT_DIR="$OUT_DIR/$PROJECT"
|
||||||
declare -g QHTCP_TEMPLATE_DIR="$TEMPLATES_DIR/qhtcp"
|
declare -gx QHTCP_TEMPLATE_DIR="$TEMPLATES_DIR/qhtcp"
|
||||||
declare -g STUDY_TEMPLATE_DIR="$TEMPLATES_DIR/exp"
|
declare -gx STUDY_TEMPLATE_DIR="$TEMPLATES_DIR/exp"
|
||||||
declare -g STUDY_INFO_FILE="$QHTCP_PROJECT_DIR/StudyInfo.csv"
|
declare -gx STUDY_INFO_FILE="$QHTCP_PROJECT_DIR/StudyInfo.csv"
|
||||||
|
declare -gx EASY_RESULTS_DIR="$QHTCP_PROJECT_DIR/easy"
|
||||||
if ((DEBUG)); then
|
if ((DEBUG)); then
|
||||||
declare -p SCANS_DIR OUT_DIR TEMPLATES_DIR APPS_DIR \
|
declare -p SCANS_DIR OUT_DIR TEMPLATES_DIR APPS_DIR \
|
||||||
PROJECTS PROJECT \
|
PROJECTS PROJECT \
|
||||||
|
|||||||
Reference in New Issue
Block a user