EASY refactor

This commit is contained in:
2024-07-27 03:14:39 -04:00
parent bce30095aa
commit d77711acb7
2 changed files with 13 additions and 18 deletions

View File

@@ -52,13 +52,8 @@ end
% localscansDir=scansDir; % localscansDir=scansDir;
% end % end
expNm=scansDir(max(strfind(scansDir,'\'))+1:end);
drivePos=min(strfind(scansDir,'\'));
elseif (isunix || ismac)
expNm=scansDir(max(strfind(scansDir,'/'))+1:end); expNm=scansDir(max(strfind(scansDir,'/'))+1:end);
drivePos=min(strfind(scansDir,'/')); drivePos=min(strfind(scansDir,'/'));
end
drive=scansDir(1:(drivePos-1)); drive=scansDir(1:(drivePos-1));
DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles'); DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles');

View File

@@ -50,7 +50,7 @@ function varargout = EASYconsole(varargin)
scansDir=sortedDirs{1}; scansDir=sortedDirs{1};
disp('Beginning in newest project scans directory'); disp('Beginning in newest project scans directory');
disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default')); disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default'));
disp('This usually indicates that we are in stand-alone mode'); disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables');
end end
% If we don't have the EASY_SUFFIX from the module, generate it from scansDir % If we don't have the EASY_SUFFIX from the module, generate it from scansDir
@@ -93,22 +93,22 @@ function varargout = EASYconsole(varargin)
disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default')); disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default'));
end end
if exist('EASY_RESULTS_DIR', 'env') && ~isempty(getenv('EASY_RESULTS_DIR'))
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
else
easyResultsDirName=strcat('Results_',todayStr,'_',easySuffix);
easyResultsDir=fullfile(scansDir,easyResultsDirName);
scansDir=fullfile(parent_dir,'ExpJobs'); % relative to easy script dir
disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
end
if exist('PROJECT_USER', 'env') && ~isempty(getenv('PROJECT_USER')) if exist('PROJECT_USER', 'env') && ~isempty(getenv('PROJECT_USER'))
if get_env('PROJECT_USER') ~= userName % sanity check if get_env('PROJECT_USER') ~= userName % sanity check
disp("WARNING: PROJECT_USER does not match the current namespace"); disp("WARNING: PROJECT_USER does not match the current namespace");
end end
end end
if exist('EASY_RESULTS_DIR', 'env') && ~isempty(getenv('EASY_RESULTS_DIR'))
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using output directory: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR'))
else
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix);
easyResultsDir=fullfile(scansDir,easyResultsDirName);
disp(strcat('Using output directory: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
end
if exist('MASTER_PLATE_FILE', 'env') && ~isempty(getenv('MASTER_PLATE_FILE')) if exist('MASTER_PLATE_FILE', 'env') && ~isempty(getenv('MASTER_PLATE_FILE'))
masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE')); masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE'));
disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE')) disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE'))