Reorganize EASY module

This commit is contained in:
2024-07-31 22:37:23 -04:00
parent 0fe61b1db7
commit 54f375face
2 changed files with 31 additions and 32 deletions

View File

@@ -273,7 +273,7 @@ function NewExpDat_Callback(~, ~, ~)
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[inputFile,inputPath]=uiputfile('.mat');
inputFileName=strrep(inputFile,'.mat','');
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
% easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
% Set paths
scansDir=fullfile(inputPath);

View File

@@ -588,32 +588,19 @@ easy() {
EOF
declare -gx EASY_DIR="$APPS_DIR/matlab/easy"
declare -gx EASY_RESULTS_DIR="$EASY_OUT_DIR/$PROJECT_PREFIX"
script="$EASY_DIR/EASYconsole.m"
# Copy templates
# Prompt user for suffix
echo "Default EASY results directory: $EASY_RESULTS_DIR"
read -r -p "Enter a custom suffix and/or hit enter to use the default (no suffix): " EASY_SUFFIX
[[ -n $EASY_SUFFIX ]] && EASY_RESULTS_DIR+="_$EASY_SUFFIX"
# Add EASY directory to the Matlab path
# If this does not work we can try changing the -sd argument and if that fails then pushing/popping
debug "Adding EASY directory to the Matlab path"
hash matlab &>/dev/null &&
matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_DIR')"
# Ask the user to launch EASYconsole.m in MATLAB
# MATLAB doesn't support passing args to scripts se we have to use ENV VARS instead
# These are proably already set in our scope but be explicit just in case so we don't have to export?
# 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
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
# export PROJECT_SCANS_DIR PROJECT_DATE PROJECT_USER PROJECT
# export EASY_DIR EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR
# export MASTER_PLATE_FILE DRUG_MEDIA_FILE
declare -gx DRUG_MEDIA_FILE="$EASY_RESULTS_DIR/DrugMedia_$PROJECT.xls"
declare -gx MASTER_PLATE_FILE="$EASY_RESULTS_DIR/MasterPlate_$PROJECT.xls"
# Backup and create EASY results dirs
[[ -d $EASY_RESULTS_DIR ]] && backup "$EASY_RESULTS_DIR"
[[ -d $EASY_RESULTS_DIR ]] || mkdir -p "$EASY_RESULTS_DIR"
# Make EASY dirs
debug "mkdir -p $EASY_RESULTS_DIR"
mkdir -p "$EASY_RESULTS_DIR"
dirs=('PrintResults' 'CFfigs' 'Fotos')
for d in "${dirs[@]}"; do
if [[ ! -d $EASY_RESULTS_DIR/$d ]]; then
@@ -622,9 +609,21 @@ easy() {
fi
done
# Copy templates
# Copy Templates
declare -gx DRUG_MEDIA_FILE="$EASY_RESULTS_DIR/DrugMedia_$PROJECT.xls"
declare -gx MASTER_PLATE_FILE="$EASY_RESULTS_DIR/MasterPlate_$PROJECT.xls"
rsync -a "$EASY_DIR"/{figs,PTmats} "$EASY_RESULTS_DIR"
# Ask the user to launch EASYconsole.m in MATLAB
# MATLAB doesn't support passing args to scripts se we have to use ENV VARS instead
# 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
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
# Add EASY directory to the Matlab path
# If this does not work we can try changing the -sd argument and if that fails then pushing/popping
debug "Adding EASY directory to the Matlab path"
hash matlab &>/dev/null &&
matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_DIR')"
# Launch matlab
# matlab -nosplash -sd "$PROJECT_SCANS_DIR" -r "run $script"
matlab -nosplash -r "run $script"
@@ -1577,7 +1576,7 @@ main() {
declare -gx QHTCP_TEMPLATE_DIR="$TEMPLATES_DIR/qhtcp"
declare -gx STUDY_TEMPLATE_DIR="$TEMPLATES_DIR/exp"
declare -gx STUDY_INFO_FILE="$QHTCP_PROJECT_DIR/StudyInfo.csv"
declare -gx EASY_RESULTS_DIR="$QHTCP_PROJECT_DIR/easy"
declare -gx EASY_OUT_DIR="$QHTCP_PROJECT_DIR/easy"
if ((DEBUG)); then
declare -p SCANS_DIR OUT_DIR TEMPLATES_DIR APPS_DIR \
PROJECTS PROJECT \