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')); 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'); [inputFile,inputPath]=uiputfile('.mat');
inputFileName=strrep(inputFile,'.mat',''); inputFileName=strrep(inputFile,'.mat','');
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName); % easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',inputFileName);
% Set paths % Set paths
scansDir=fullfile(inputPath); scansDir=fullfile(inputPath);

View File

@@ -588,43 +588,42 @@ easy() {
EOF EOF
declare -gx EASY_DIR="$APPS_DIR/matlab/easy" declare -gx EASY_DIR="$APPS_DIR/matlab/easy"
declare -gx EASY_RESULTS_DIR="$EASY_OUT_DIR/$PROJECT_PREFIX"
script="$EASY_DIR/EASYconsole.m" 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 # Backup and create EASY results dirs
# If this does not work we can try changing the -sd argument and if that fails then pushing/popping [[ -d $EASY_RESULTS_DIR ]] && backup "$EASY_RESULTS_DIR"
debug "Adding EASY directory to the Matlab path" [[ -d $EASY_RESULTS_DIR ]] || mkdir -p "$EASY_RESULTS_DIR"
hash matlab &>/dev/null &&
matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_DIR')" # Make EASY dirs
dirs=('PrintResults' 'CFfigs' 'Fotos')
for d in "${dirs[@]}"; do
if [[ ! -d $EASY_RESULTS_DIR/$d ]]; then
debug "mkdir $EASY_RESULTS_DIR/$d"
mkdir "$EASY_RESULTS_DIR/$d"
fi
done
# 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 # 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 # 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) # 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 # Add EASY directory to the Matlab path
# export EASY_DIR EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR # If this does not work we can try changing the -sd argument and if that fails then pushing/popping
# export MASTER_PLATE_FILE DRUG_MEDIA_FILE debug "Adding EASY directory to the Matlab path"
hash matlab &>/dev/null &&
declare -gx DRUG_MEDIA_FILE="$EASY_RESULTS_DIR/DrugMedia_$PROJECT.xls" matlab -nodisplay -nosplash -nodesktop -nojvm -batch "addpath('$EASY_DIR')"
declare -gx MASTER_PLATE_FILE="$EASY_RESULTS_DIR/MasterPlate_$PROJECT.xls"
# 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
debug "mkdir $EASY_RESULTS_DIR/$d"
mkdir "$EASY_RESULTS_DIR/$d"
fi
done
# Copy templates
rsync -a "$EASY_DIR"/{figs,PTmats} "$EASY_RESULTS_DIR"
# Launch matlab # Launch matlab
# 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"
@@ -1577,7 +1576,7 @@ main() {
declare -gx QHTCP_TEMPLATE_DIR="$TEMPLATES_DIR/qhtcp" declare -gx QHTCP_TEMPLATE_DIR="$TEMPLATES_DIR/qhtcp"
declare -gx STUDY_TEMPLATE_DIR="$TEMPLATES_DIR/exp" declare -gx STUDY_TEMPLATE_DIR="$TEMPLATES_DIR/exp"
declare -gx 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" declare -gx EASY_OUT_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 \