Improve EASY result parsing to supersede portion of ExpFrontend.m
This commit is contained in:
@@ -1,57 +1,55 @@
|
||||
%Frontend240417.m
|
||||
%augmented ExpFrontend to provide a quick text archive and a robust
|
||||
%database ammenable archive
|
||||
%FrontEnd utility to copy source result sheet into Exp_ folders of
|
||||
%StudiesQHTCP/StudyName/Exp1(2,3,4). This allow the automation of path
|
||||
%capture to the StudiesDataArchieve.txt study log.
|
||||
%Select, copy and Capture Study Exp_ details to study log
|
||||
% FrontEnd utility to copy source result sheet into Exp_ folders of
|
||||
% StudiesQHTCP/StudyName/Exp1(2,3,4). This allow the automation of path
|
||||
% capture to the StudiesDataArchieve.txt study log.
|
||||
% Select, copy and Capture Study Exp_ details to study log
|
||||
|
||||
%Exp meta data collection
|
||||
W=pwd;
|
||||
|
||||
% Set path variables
|
||||
wCodeDir=pwd;
|
||||
Wstudy=fullfile('../', wCodeDir);
|
||||
studyDate=datetime('now');
|
||||
|
||||
%Load results file meta data into workspace
|
||||
try
|
||||
ExpLabel= strcat('Exp',W(end))
|
||||
questdlg('\fontsize{20} Select the !!Results File','File Selection','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[resFile,resPath]= uigetfile('*.txt')
|
||||
copyfile((fullfile(resPath,resFile)),fullfile(W))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match'))
|
||||
cd ..
|
||||
Wstudy= pwd
|
||||
studyDate= datetime('now');
|
||||
S.sDate(1) = {studyDate};
|
||||
if ispc
|
||||
lastSep=max(strfind(Wstudy,'\'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
else
|
||||
lastSep=max(strfind(Wstudy,'/'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
end
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
questdlg('\fontsize{20} Select the !!Results File','File Selection','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[resFile,resPath]= uigetfile('*.txt')
|
||||
copyfile((fullfile(resPath,resFile)),fullfile(wCodeDir))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match'))
|
||||
cd ..
|
||||
|
||||
S.sDate(1)= {studyDate};
|
||||
S.sName(1)= {studyName}
|
||||
S.sPath(1)= {Wstudy}
|
||||
S.ELabel(1)= {ExpLabel}
|
||||
S.EresDate(1)= {resDate}
|
||||
S.EresFile(1)= {resFile}
|
||||
S.EresPath(1)= {resPath}
|
||||
|
||||
cd ..
|
||||
if ispc
|
||||
lastSep=max(strfind(Wstudy,'\'))
|
||||
studyName=Wstudy((lastSep+1):end)
|
||||
else
|
||||
lastSep=max(strfind(Wstudy,'/'))
|
||||
studyName=Wstudy((lastSep+1):end)
|
||||
end
|
||||
|
||||
fid = fopen('StudiesDataArchive.txt','a');
|
||||
fprintf(fid,'StudyDate\tStudyName\tStudyPath\tExpNum\tExpDate\tExpPath\tResultFile\n');
|
||||
fprintf(fid, '%s\t %s\t %s\t %s\t %s\t %s\t %s \n',S.sDate{1},S.sName{1},S.sPath{1},S.ELabel{1},S.EresDate{1},S.EresPath{1},S.EresFile{1});
|
||||
fclose(fid);
|
||||
fclose('all');
|
||||
% Build the study info array
|
||||
S.sDate(1)= {studyDate};
|
||||
S.sName(1)= {studyName}
|
||||
S.sPath(1)= {Wstudy}
|
||||
S.ELabel(1)= {ExpLabel}
|
||||
S.EresDate(1)= {resDate}
|
||||
S.EresFile(1)= {resFile}
|
||||
S.EresPath(1)= {resPath}
|
||||
|
||||
cd ..
|
||||
|
||||
fid = fopen('StudiesDataArchive.txt','a');
|
||||
fprintf(fid,'StudyDate\tStudyName\tStudyPath\tExpNum\tExpDate\tExpPath\tResultFile\n');
|
||||
fprintf(fid, '%s\t %s\t %s\t %s\t %s\t %s\t %s \n',S.sDate{1},S.sName{1},S.sPath{1},S.ELabel{1},S.EresDate{1},S.EresPath{1},S.EresFile{1});
|
||||
fclose(fid);
|
||||
fclose('all');
|
||||
|
||||
catch
|
||||
cd(W)
|
||||
cd(wCodeDir)
|
||||
disp('Error: Unable to Execute ExpFrontend.m')
|
||||
end
|
||||
|
||||
cd(W)
|
||||
pwd
|
||||
|
||||
|
||||
cd(wCodeDir)
|
||||
|
||||
%*************************************************************************************
|
||||
%*************************************************************************************
|
||||
@@ -66,12 +64,12 @@ nowNumFNm= strcat((int2str(now)),'.mat') % from previous section incase the /Stu
|
||||
%capture the /StudiesQHTCP directory for storing log data
|
||||
cd ../..
|
||||
logPath= pwd %is /.../Exp_
|
||||
cd(W)
|
||||
cd(wCodeDir)
|
||||
%Try to load an existing data set from previous Frontend calls
|
||||
try %end ~ln121
|
||||
load(fullfile(logPath,'.studyLog.mat')) %load(fullfile('../../','studyLog.mat'))
|
||||
catch %If no studyLog.mat found [Initial First Entry]
|
||||
ExpLabel= strcat('Exp',W(end))
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match'))
|
||||
cd .. %move up to current study folder from ../Exp_ folder;
|
||||
%Study meta data collection
|
||||
@@ -102,7 +100,7 @@ catch %If no studyLog.mat found [Initial First Entry]
|
||||
S.EresFile(1)= {resFile}
|
||||
S.EresPath(1)= {resPath}
|
||||
|
||||
cd(W)
|
||||
cd(wCodeDir)
|
||||
|
||||
logFiletxt= fullfile(logPath,'StudiesDataArchive4DB.txt') %relative .txt path
|
||||
%Initialize the StudiesDataArchive.txt file with the First row of meta data
|
||||
@@ -127,7 +125,7 @@ end %end for try for the First entry only
|
||||
|
||||
|
||||
%Begin routine for all Entries After the Initial data entry****************
|
||||
ExpLabel= strcat('Exp',W(end))
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match')) %Capture date from !!Results file
|
||||
|
||||
cd .. %Move to the current study folder
|
||||
@@ -203,12 +201,12 @@ end
|
||||
fclose('all');
|
||||
|
||||
catch
|
||||
cd(W) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
cd(wCodeDir) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
fclose('all');
|
||||
clear S %clear data structure variable 'S.'
|
||||
end
|
||||
|
||||
cd(W) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
cd(wCodeDir) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
clear all %clear workspace variables
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env R
|
||||
# Based on InteractionTemplate.R which is based on Sean Santos's Interaction_V5 script
|
||||
#
|
||||
# Updated 2024 Bryan C Roessler to improve file operations and portability
|
||||
# NOTE: The script now has 1 REQUIRED argument and 4 OPTIONAL arguments:
|
||||
# Updated 240723 Bryan C Roessler to improve file operations and portability
|
||||
# NOTE: The script now has 4 additional OPTIONAL arguments:
|
||||
# 1. Path to input file
|
||||
# 2. /output/ directory
|
||||
# 3. Path to StudyInfo.csv
|
||||
@@ -80,7 +80,6 @@ expNumber <- as.numeric(sub("^.*?(\\d+)$", "\\1", getwd()))
|
||||
Labels[expNumber,3] <- delBGFactor
|
||||
write.csv(Labels,file=studyInfo,row.names = FALSE)
|
||||
|
||||
|
||||
###############################################################################
|
||||
################### BEGIN USER DATA SELECTION SECTION #########################
|
||||
###############################################################################
|
||||
|
||||
Reference in New Issue
Block a user