EASY passing linter checks

This commit is contained in:
2024-07-27 12:09:09 -04:00
parent d77711acb7
commit 78d5e26d71
10 changed files with 810 additions and 772 deletions

View File

@@ -538,11 +538,11 @@ easy() {
export SCANS_DIR PROJECT_DATE EASY_DIR PROJECT_USER PROJECT_PREFIX EASY_SUFFIX EASY_RESULTS_DIR MASTER_PLATE_FILE DRUG_MEDIA_FILE export SCANS_DIR PROJECT_DATE EASY_DIR PROJECT_USER PROJECT_PREFIX EASY_SUFFIX EASY_RESULTS_DIR MASTER_PLATE_FILE DRUG_MEDIA_FILE
echo "Hit enter to use the default EASY results directory $SCANS_DIR/Results_${PROJECT_PREFIX}_($PROJECT_SUFFIX)" echo "Hit enter to use the default EASY results directory $SCANS_DIR/Results_${PROJECT_PREFIX}_($PROJECT_SUFFIX)"
(( YES )) || read -r -p "Or enter a custom suffix: " suffix (( YES )) || read -r -p "Or enter a custom suffix: " suffix
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${Ssuffix:-$PROJECT_SUFFIX}" EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${suffix:-$PROJECT_SUFFIX}"
while [[ -d $EASY_RESULTS_DIR ]]; do while [[ -d $EASY_RESULTS_DIR ]]; do
count=1 count=1
if [[ $count -eq 1 ]] && ask "$EASY_RESULTS_DIR already exists, increment dir name (y) or overwrite (N)?"; then if [[ $count -eq 1 ]] && ask "$EASY_RESULTS_DIR already exists, increment dir name (y) or overwrite (N)?"; then
EASY_SUFFIX="${Ssuffix:-$PROJECT_SUFFIX}.$((count++))" EASY_SUFFIX="${suffix:-$PROJECT_SUFFIX}.$((count++))"
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}" EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}"
else else
EASY_SUFFIX=${suffix:-$PROJECT_SUFFIX} EASY_SUFFIX=${suffix:-$PROJECT_SUFFIX}

View File

@@ -2,12 +2,12 @@
% Updated 240724 Bryan C Roessler to improve file operations and portability % Updated 240724 Bryan C Roessler to improve file operations and portability
% %
global scansDir global scansDir
global easyResultsDir
global matFile global matFile
global defImParMat global defImParMat
global printResultsDir global printResultsDir
global fotosResultsDir global fotosResultsDir
global pointMapsFile global pointMapsFile
global pointMapsResultsDir
ln=1; ln=1;
@@ -52,6 +52,7 @@ end
% localscansDir=scansDir; % localscansDir=scansDir;
% end % end
% TODO this seems weird
expNm=scansDir(max(strfind(scansDir,'/'))+1:end); expNm=scansDir(max(strfind(scansDir,'/'))+1:end);
drivePos=min(strfind(scansDir,'/')); drivePos=min(strfind(scansDir,'/'));
drive=scansDir(1:(drivePos-1)); drive=scansDir(1:(drivePos-1));
@@ -85,9 +86,9 @@ drgCnt=0;
medCnt=0; medCnt=0;
try try
load(fullfile(easyResultsDir,'Fotos','Nbdg')) % Convolute scan array data into plates load(fullfile(fotosResultsDir,'Nbdg')) % Convolute scan array data into plates
catch catch
load(fullfile(easyResultsDir,'PTmats','Nbdg')) % Convolute scan array data into plates load(fullfile(pointMapsResultsDir,'Nbdg')) % Convolute scan array data into plates
end end
for s=1:size(scan,2) for s=1:size(scan,2)
@@ -102,14 +103,14 @@ for s=1:size(scan,2)
for p=1:size((scan(s).plate),2) for p=1:size((scan(s).plate),2)
totPlCnt=totPlCnt+1; totPlCnt=totPlCnt+1;
if destPerMP>1 && rem(totPlCnt,destPerMP)==1 if destPerMP>1 && rem(totPlCnt,destPerMP)==1
mpCnt=mpCnt+1 mpCnt=mpCnt+1;
end end
if destPerMP==1 if destPerMP==1
mpCnt=mpCnt+1 mpCnt=mpCnt+1;
end end
pertCnt=rem(totPlCnt,destPerMP); pertCnt=rem(totPlCnt,destPerMP);
if pertCnt==0 if pertCnt==0
pertCnt=destPerMP pertCnt=destPerMP;
end end
pert=strcat('Perturb_',num2str(pertCnt)); pert=strcat('Perturb_',num2str(pertCnt));
s % TODO seems wrong s % TODO seems wrong
@@ -424,8 +425,8 @@ try
asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384)); asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
aucEndPt= strcat('AUC',num2str(asd(9))); aucEndPt= strcat('AUC',num2str(asd(9)));
end end
fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene') fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene');
fprintf(fid, '\t %s',aucEndPt) fprintf(fid, '\t %s',aucEndPt);
fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd'); %17_0629 MinBaseIntens update for MedianBase label fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd'); %17_0629 MinBaseIntens update for MedianBase label
end end
clear outTseries clear outTseries
@@ -438,7 +439,7 @@ try
outIntens=[]; outIntens=[];
RawIntens=[]; RawIntens=[];
RawIntens=scan(s).plate(p).intens; RawIntens=scan(s).plate(p).intens;
RawIntensSize= size(RawIntens,2) RawIntensSize=size(RawIntens,2);
clear Ag; %Ag is Growth Area clear Ag; %Ag is Growth Area
Ag=scan(s).plate(p).Ag; Ag=scan(s).plate(p).Ag;
AgSize= size(Ag); AgSize= size(Ag);

View File

@@ -20,6 +20,7 @@ function varargout = EASYconsole(varargin)
global mpdmFile global mpdmFile
global userName global userName
global srchRange global srchRange
global searchRangeFile
% Initialize some variables from matlab % Initialize some variables from matlab
easyPath=which(mfilename); easyPath=which(mfilename);
@@ -115,7 +116,7 @@ function varargout = EASYconsole(varargin)
else else
% Try to find MasterPlate_ file on our own % Try to find MasterPlate_ file on our own
mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx')); mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx'));
if exist(mp, 'file')) if exist(mp, 'file')
masterPlateFile=mp; masterPlateFile=mp;
disp(strcat('Using drug media file: ', masterPlateFile, ' from internal logic')) disp(strcat('Using drug media file: ', masterPlateFile, ' from internal logic'))
else else
@@ -129,7 +130,7 @@ function varargout = EASYconsole(varargin)
else else
% Try to find MasterPlate_ file on our own % Try to find MasterPlate_ file on our own
dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx')); dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx'));
if exist(mp, 'file')) if exist(mp, 'file')
drugMediaFile=dm; drugMediaFile=dm;
disp(strcat('Using drug media file: ', drugMediaFile, ' from internal logic')) disp(strcat('Using drug media file: ', drugMediaFile, ' from internal logic'))
else else
@@ -147,16 +148,16 @@ function varargout = EASYconsole(varargin)
fotosResultsDir=fullfile(easyResultsDir,'Fotos'); fotosResultsDir=fullfile(easyResultsDir,'Fotos');
figsResultsDir=fullfile(easyResultsDir,'figs'); figsResultsDir=fullfile(easyResultsDir,'figs');
pointMapsResultsDir=fullfile(easyResultsDir,'PTmats'); pointMapsResultsDir=fullfile(easyResultsDir,'PTmats');
pointMapsFile=fullfile(pointMapsResultsDir,'NImParameters.mat') pointMapsFile=fullfile(pointMapsResultsDir,'NImParameters.mat');
oldPointMapsFile=fullfile(pointMapsResultsDir,'ImParameters.mat') oldPointMapsFile=fullfile(pointMapsResultsDir,'ImParameters.mat');
CSearchRangeFile=fullfile(fotosResultsDir,'CSearchRange.mat'); searchRangeFile=fullfile(fotosResultsDir,'CSearchRange.mat');
mpdmFile=fullfile(matDir,'MPDM.mat'); mpdmFile=fullfile(matDir,'MPDM.mat');
% This can be removed, I think it should add the previous search range? % This can be removed, I think it should add the previous search range?
% Might be nice feature but can remove if it causes issues % Might be nice feature but can remove if it causes issues
% We are using searchRangeNum to hold old CSrchRange value(s) % We are using searchRangeNum to hold old CSrchRange value(s)
if exist(CSearchRangeFile, 'file') if exist(searchRangeFile, 'file')
searchRangeNum=load(CSearchRangeFile); searchRangeNum=load(searchRangeFile);
end end
% Add easyDir to the MATLAB path % Add easyDir to the MATLAB path
% I have not idea if this is necessary or works but theoretically should % I have not idea if this is necessary or works but theoretically should
@@ -212,7 +213,6 @@ end
% varargin--input arguments to EASYconsole (see VARARGIN) % varargin--input arguments to EASYconsole (see VARARGIN)
function EASYconsole_OpeningFcn(hObject, ~, handles, varargin) function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
global fhconsole global fhconsole
global easyResultsDir
% Choose default command line output for EASYconsole % Choose default command line output for EASYconsole
handles.output=hObject; handles.output=hObject;
@@ -371,7 +371,7 @@ function LoadDatFile_Callback(~, ~, ~)
end end
% Create supporting dirs % Create supporting dirs
dirs={'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'} dirs={'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'};
for i=1:length(dirs) for i=1:length(dirs)
d=dirs{i}; d=dirs{i};
if ~exist(fullfile(easyResultsDir, d), 'dir') if ~exist(fullfile(easyResultsDir, d), 'dir')

View File

@@ -22,7 +22,7 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
% Spot (cultures) loop % Spot (cultures) loop
for ii=1:384 % startSpot:numCultures for ii=1:384 % startSpot:numCultures
ii; %%%db print out the culture number ii; % db print out the culture number
timepts=[]; timepts=[];
currValues=[]; currValues=[];
currSpotAreas=[]; currSpotAreas=[];
@@ -48,7 +48,7 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
currNormIntens=currValues/currSpotArea; currNormIntens=currValues/currSpotArea;
tmpx=find(currNormIntens>5); %15jh % 2.3); tmpx=find(currNormIntens>5); %15jh % 2.3);
validSpot=true; validSpot=true;
if(isempty(tmpx) || (length(tmpx)<3)) if(isempty(tmpx) || length(tmpx)<3)
validSpot=false; validSpot=false;
normIntens=currNormIntens; normIntens=currNormIntens;
filterTimes=timepts; %filterTimes; %currTimes; filterTimes=timepts; %filterTimes; %currTimes;
@@ -102,7 +102,7 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
% NCLoIntstdTrim % NCLoIntstdTrim
% NCLoSstdTrim.m called by NCfilImCF and NCfil.m % NCLoSstdTrim.m called by NCfilImCF and NCfil.m
flg1=0; flg1=0;
loScurvLim=stdLoIntLim; % loScurvLim=stdLoIntLim;
loStimeN=1; loStimeN=1;
last2n=1; last2n=1;
stdDev=[]; stdDev=[];
@@ -115,7 +115,8 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
if (loStimeN-2)>0 if (loStimeN-2)>0
dataMatrix(3,1:(n-2))=2; % add to lowIntensity cull flags, the pre S cull data dataMatrix(3,1:(n-2))=2; % add to lowIntensity cull flags, the pre S cull data
else else
dataMatrix(3,1:n)=2;end dataMatrix(3,1:n)=2;
end
dataMatrix(3,1:(n-2))=2; dataMatrix(3,1:(n-2))=2;
last2n=n; last2n=n;
end end
@@ -127,8 +128,8 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
loStimeN=n; loStimeN=n;
end end
if stdDev(n)>6 if stdDev(n)>6
flg1=1 flg1=1;
end % detect S curve rise->stop stdLoInt detection end
end end
end end
@@ -142,14 +143,14 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
qcutoff=2; qcutoff=2;
qind=find(normIntens>2); %,:,'first'); qind=find(normIntens>2); %,:,'first');
if ~isempty(qind(3)) if ~isempty(qind(3))
qcutoff=qind(3) qcutoff=qind(3);
end end
[minInt,I]=min(normIntens(2:qcutoff)); [minInt,I]=min(normIntens(2:qcutoff));
bl=minInt; bl=minInt;
minTime=dataMatrix(1,I); %diagnostic output only minTime=dataMatrix(1,I);
if (length(qind)>5)&&I>1 if (length(qind)>5)&&I>1
dataMatrix(3,1:(I-1))=5 dataMatrix(3,1:(I-1))=5;
end end
tGT2Flg=0; tGT2Flg=0;
@@ -157,7 +158,7 @@ function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanInte
dataMatrix(4,n)=normIntens(n)-bl; dataMatrix(4,n)=normIntens(n)-bl;
if n>I && dataMatrix(4,n)>=2 && tGT2Flg==0 if n>I && dataMatrix(4,n)>=2 && tGT2Flg==0
thresGT2=n;thresGT2Tm=dataMatrix(1,n);tGT2Flg=1; thresGT2=n;thresGT2Tm=dataMatrix(1,n);tGT2Flg=1;
end %diagnostic output only end
end end
resMat(18)=bl; resMat(18)=bl;

View File

@@ -86,7 +86,7 @@ function [resMatStd, resMat, selTimesStd, selIntensStd, FiltTimesELr, NormIntens
if(isnan(Klow)||isnan(Kup)||isnan(llow)||isnan(lup)||isnan(rlow)||isnan(rup)) if(isnan(Klow)||isnan(Kup)||isnan(llow)||isnan(lup)||isnan(rlow)||isnan(rup))
NANcond=1; stdNANcond=1; % stdNANcond added to relay not to attempt ELr as there is no curve to find critical point NANcond=1; stdNANcond=1; % stdNANcond added to relay not to attempt ELr as there is no curve to find critical point
end end
catch ME catch
% if no data is given, return zeros % if no data is given, return zeros
AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0; AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0;
rlow=0;rup=0;lup=0;llow=0; rlow=0;rup=0;lup=0;llow=0;
@@ -222,7 +222,7 @@ function [resMatStd, resMat, selTimesStd, selIntensStd, FiltTimesELr, NormIntens
GrowthELr=K ./ (1 + exp(-r.* (t - l ))); GrowthELr=K ./ (1 + exp(-r.* (t - l )));
fitblELr=min(GrowthELr); %jh diag fitblELr=min(GrowthELr); %jh diag
end end
catch ME catch
% if no data is given, return zeros % if no data is given, return zeros
AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0; AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0;
rlow=0;rup=0;lup=0;llow=0; %normIntens=[]; rlow=0;rup=0;lup=0;llow=0; %normIntens=[];
@@ -290,7 +290,7 @@ function [resMatStd, resMat, selTimesStd, selIntensStd, FiltTimesELr, NormIntens
resMat(19)=fitblStd; % only applicable to Std curve Fit; ELr superceeds and makes meaningless resMat(19)=fitblStd; % only applicable to Std curve Fit; ELr superceeds and makes meaningless
resMat(20)=minTime; % only applicable to Std curve Fit; ELr superceeds and makes meaningless resMat(20)=minTime; % only applicable to Std curve Fit; ELr superceeds and makes meaningless
end % if r3>r1 end % if r3>r1
catch ME catch
% if no data is given, return zeros % if no data is given, return zeros
AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0; AUC=0;MSR=0;K=0;r=0;l=0;rsquare=0;Klow=0;Kup=0;
rlow=0;rup=0;lup=0;llow=0; % normIntens=[]; rlow=0;rup=0;lup=0;llow=0; % normIntens=[];

View File

@@ -21,6 +21,7 @@ function NImParamRadiusGui(scansDir)
global numCols global numCols
global scanSize global scanSize
global scanMax global scanMax
global searchRangeFile
% Ncode ImRobot adaptation % Ncode ImRobot adaptation
% TODO this code block and variables needs explanation % TODO this code block and variables needs explanation
@@ -38,17 +39,17 @@ function NImParamRadiusGui(scansDir)
selScan=1; selScan=1;
SWgrowthArea=1; SWgrowthArea=1;
if exist(pointMapsFile) if exist(pointMapsFile, 'file')
load(pointMapsFile); load(pointMapsFile);
else else
load(fullfile(PTmats,'NImParameters')) % hardcoded default load(fullfile(PTmats,'NImParameters')) % hardcoded default
disp('WARNING: Using hardcoded NImParameters.mat') disp('WARNING: Using hardcoded NImParameters.mat')
end end
ImParMat ImParMat;
% if ~exist('searchRangeNum','var') || isempty(searchRangeNum) % if ~exist('searchRangeNum','var') || isempty(searchRangeNum)
if exist(CSearchRangeFile), 'file') if exist(searchRangeFile, 'file')
load(CSearchRangeFile); load(searchRangeFile);
CSearchRange; CSearchRange; % TODO, might be an issue, figure out what this is doing
end end
% yInitPos=0.30; % yInitPos=0.30;
@@ -117,6 +118,8 @@ function NImParamRadiusGui(scansDir)
btnNumber=7; btnNumber=7;
yPos=0.85-(btnNumber-1)*(btnHt+spacing); yPos=0.85-(btnNumber-1)*(btnHt+spacing);
btnPos=[xPos yPos-spacing btnWid btnHt]; btnPos=[xPos yPos-spacing btnWid btnHt];
% TODO, I don't think these are defined?
try try
srchRange=ImParMat(12); srchRange=ImParMat(12);
catch % Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14. catch % Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
@@ -164,7 +167,6 @@ function NImParamRadiusGui(scansDir)
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20]) 'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
function load_listbox(source,~) function load_listbox(source,~)
global
userIndx=(get(source,'value')); userIndx=(get(source,'value'));
userStr=(get(source,'string')); userStr=(get(source,'string'));
%scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', ''))) %scLstIndx=str2num(char(strrep(userStr(userIndx), 'Scan', '')))
@@ -239,7 +241,7 @@ function NImParamRadiusGui(scansDir)
searchRangeNum; searchRangeNum;
save(pointMapsFile, 'ImParMat'); save(pointMapsFile, 'ImParMat');
save(CSearchRangeFile,'searchRangeNum'); save(searchRangeFile,'searchRangeNum');
close close
return return

View File

@@ -10,6 +10,7 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
searchIntens=[];intensMax=[];detMaxPos=[];scIntens=[];areaOfIntensAboveBG=[];BkgrdMat=[]; searchIntens=[];intensMax=[];detMaxPos=[];scIntens=[];areaOfIntensAboveBG=[];BkgrdMat=[];
% TODO needs explanation
if Fflg==1 if Fflg==1
% Preallocation % Preallocation
tPtLength=length(tifFileLst); tPtLength=length(tifFileLst);
@@ -169,7 +170,7 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
testPosC=PTrefPt(2) + shiftPosC; testPosC=PTrefPt(2) + shiftPosC;
a=[testPosR,testPosC]; %testPos(r,c)={testPosR,testPosC}; a=[testPosR,testPosC]; %testPos(r,c)={testPosR,testPosC};
testPos(r,c)={a}; testPos(r,c)={a};
doCircle doCircle;
TestmapOnesDbl(testPosR:(testPosR+(diaExt-1)),testPosC:(testPosC+(diaExt-1)))=cirMask; %optCirMask; TestmapOnesDbl(testPosR:(testPosR+(diaExt-1)),testPosC:(testPosC+(diaExt-1)))=cirMask; %optCirMask;
end end
end end
@@ -303,7 +304,7 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
end end
% detPos=lastDetMaxPos; % detPos=lastDetMaxPos;
detPos=MaxPos; detPos=MaxPos;
end %if length(tifFileLst) >2 end
% Preallocation for speed on 2019_1121 *** % Preallocation for speed on 2019_1121 ***
scIntens=zeros(24,16,length(tifFileLst)); scIntens=zeros(24,16,length(tifFileLst));
@@ -521,9 +522,6 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
% NIgenBkGrdDataPar4Fnc(ImParMat, tifFileLst, lastDetMaxPos, numRows, numCols, fullsc, tPt, BGthres, doCircle, cirPixA, diaExt, cirMask, BGTav) % NIgenBkGrdDataPar4Fnc(ImParMat, tifFileLst, lastDetMaxPos, numRows, numCols, fullsc, tPt, BGthres, doCircle, cirPixA, diaExt, cirMask, BGTav)
% Called by NIscanIntensBG.m % Called by NIscanIntensBG.m
% global easyResultsDir
global matFile
% global pixsAboveBG
MPnum=ImParMat(1); MPnum=ImParMat(1);
destPerMP=ImParMat(2); destPerMP=ImParMat(2);
spotThres=ImParMat(4)/100; %selScan=ImParMat(4); spotThres=ImParMat(4)/100; %selScan=ImParMat(4);
@@ -610,7 +608,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
%{ %{
lineSum(1)=sum((fullsc(refBG(1),refBG(2):refBG(4)-1))); %mean across top rt lineSum(1)=sum((fullsc(refBG(1),refBG(2):refBG(4)-1))); %mean across top rt
lineSum(2)=sum((fullsc(refBG(1):refBG(3)-1,refBG(2)))); %mean down lf lineSum(2)=sum((fullsc(refBG(1):refBG(3)-1,refBG(2)))); %mean down lf
@@ -707,7 +709,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
%{ %{
lineSum(1)=sum((fullsc(refBG(1),refBG(2):refBG(4)-1))); %mean across top rt lineSum(1)=sum((fullsc(refBG(1),refBG(2):refBG(4)-1))); %mean across top rt
lineSum(2)=sum((fullsc(refBG(1):refBG(3)-1,refBG(2)))); %mean down lf lineSum(2)=sum((fullsc(refBG(1):refBG(3)-1,refBG(2)))); %mean down lf
@@ -753,7 +759,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(lineSum(1)+lineSum(2)+lineSum(4))./ ... % meanBkgrd=(lineSum(1)+lineSum(2)+lineSum(4))./ ...
% ((2*(refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); %divby 2*across+1*down % ((2*(refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); %divby 2*across+1*down
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
else else
% clear('lineV') %3 % clear('lineV') %3
lineV=fullsc(refBG(1):refBG(3)-1,refBG(4)); %mean down rt lineV=fullsc(refBG(1):refBG(3)-1,refBG(4)); %mean down rt
@@ -763,7 +773,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); % meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1))));
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
end end
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
end end
@@ -814,7 +828,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); % meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1))));
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
else else
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
@@ -871,7 +889,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(lineSum(1)+lineSum(2)+lineSum(4))./ ... % meanBkgrd=(lineSum(1)+lineSum(2)+lineSum(4))./ ...
% ((2*(refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); % divby 2*across+1*down % ((2*(refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); % divby 2*across+1*down
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
elseif refBGrExt>(botLim-botNotchOffset) && ... elseif refBGrExt>(botLim-botNotchOffset) && ...
refBGcExt>(rtLim-cushion)%if intens area too close to bottom edge only refBGcExt>(rtLim-cushion)%if intens area too close to bottom edge only
% clear('lineV') %3 % clear('lineV') %3
@@ -905,7 +927,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1)))); % meanBkgrd=(sum(lineSum(1:4)))./ (2*((refBG(4)-refBG(2))+(refBG(3)-refBG(1))));
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
end end
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
end end
@@ -1011,7 +1037,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
% meanBkgrd=(sum(lineSum(1:4)))./ ((2*(refBG(4)-refBG(2))+ 2*(refBG(3)-refBG(1)))); % meanBkgrd=(sum(lineSum(1:4)))./ ((2*(refBG(4)-refBG(2))+ 2*(refBG(3)-refBG(1))));
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
end end
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
end end
@@ -1056,7 +1086,11 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4))); meanBkgrd=(sum(lineSum(1:4)))./ (sum(pixCnt(1:4)));
if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end if tPt==1 || tPt==lstTpt,rwm(r,c)=floor(mean(rw));end
if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end if sum(pixCnt(1:4))==0, meanBkgrd=double(BGthres(r,c));end
if doCircle==1, totBkgrd(r,c)=meanBkgrd* cirPixA; else totBkgrd(r,c)=meanBkgrd* width^2; end if doCircle==1
totBkgrd(r,c)=meanBkgrd* cirPixA;
else
totBkgrd(r,c)=meanBkgrd* width^2;
end
end end
% Determine the actual number of pixels(area) of growth above the background % Determine the actual number of pixels(area) of growth above the background
@@ -1187,5 +1221,5 @@ function [Tmpsbdg2, scanIntens, F_spots, bmtp, optomizedPos, TmpexpScanIntens2,
TmpFexpScanBMtp2=TmpFexpScanBMtp1; TmpFexpScanBMtp2=TmpFexpScanBMtp1;
TmpanlZoneRefs2=TmpanlZoneRefs1; TmpanlZoneRefs2=TmpanlZoneRefs1;
Tmpsbdg2=Tmpsbdg1; Tmpsbdg2=Tmpsbdg1;
end
end end

View File

@@ -40,7 +40,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
fFail=((fullfile(printResultsDir,'ImageFileReadFailure.txt'))); fFail=((fullfile(printResultsDir,'ImageFileReadFailure.txt')));
fid=fopen(fFail,'a'); %create,open and append fid=fopen(fFail,'a'); %create,open and append
% fprintf(fid,'%s \n',char(tifFile)) % fprintf(fid,'%s \n',char(tifFile))
fclose(fid) fclose(fid);
nndx=nndx-1; nndx=nndx-1;
swCatch=1; swCatch=1;
rep=getReport(ME, 'basic'); rep=getReport(ME, 'basic');
@@ -294,7 +294,7 @@ function [p4L2, TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneR
p4L1{16}=selScan; p4L1{16}=selScan;
p4L1{17}=cirPixA; p4L1{17}=cirPixA;
p4L1{18}=datestr((now),31); p4L1{18}=datestr((now),31); % TODO this seems bad
p4L2=p4L1; p4L2=p4L1;
end end

View File

@@ -100,9 +100,9 @@ NIcircle
lastPlateOnLastScan=1; % Ncode lastPlateOnLastScan=1; % Ncode
if size(scLst,1)==1 if size(scLst,1)==1
SWsingleSc=1 SWsingleSc=1;
else else
SWsingleSc=0 SWsingleSc=0;
end end
dvec=datevec(datestr(floor(now))); %method to get current offset year '01-Jan-"currentyr"' dvec=datevec(datestr(floor(now))); %method to get current offset year '01-Jan-"currentyr"'
@@ -220,10 +220,10 @@ end
% Save data in .mat files % Save data in .mat files
save(matFile,'scan'); save(matFile,'scan');
% save((fullfile(easyResultsDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time % save((fullfile(easyResultsDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time
save((fullfile(easyResultsDir,'Fotos','Nbdg')), 'sbdg'); save((fullfile(fotosResultsDir,'Nbdg')), 'sbdg');
save((fullfile(easyResultsDir,'Fotos','Coordinates')),'FexpScanSpots') %Saves frames at each tPt save((fullfile(fotosResultsDir,'Coordinates')),'FexpScanSpots') %Saves frames at each tPt
save((fullfile(easyResultsDir,'Fotos','BGatTpts')),'FexpScanBMtp') save((fullfile(fotosResultsDir,'BGatTpts')),'FexpScanBMtp')
save((fullfile(easyResultsDir,'Fotos','anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt save((fullfile(fotosResultsDir,'anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt
% Print FitResults % Print FitResults
fileExt='.txt'; fileExt='.txt';