Skip to content

Commit

Permalink
make TPWS gui includes species abbreviation
Browse files Browse the repository at this point in the history
make TPWS didn't have the option to put another species abbreviation in the TPWS file name. I adapted the gui to include an option to specify the species name
  • Loading branch information
asolsonaberga committed Feb 11, 2021
1 parent a5333e6 commit ecd196c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 13 deletions.
11 changes: 9 additions & 2 deletions Remoras/SPICE-Detector/sp_dt_mkTPWS.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
siteName = '';% site name wildcard, used to restrict input files
end
fprintf('Wildcard: %s\n', siteName)

if isfield(REMORA.spice_dt.mkTPWS,'spName')
spName = REMORA.spice_dt.mkTPWS.spName;
else
spName = '';% species name specified in TPWS file name
end
fprintf('Species name for TPWS file name: %s\n', spName)

if isfield(REMORA.spice_dt.mkTPWS,'minDBpp')
% minimum RL in dBpp. If detections have RL below this
Expand Down Expand Up @@ -84,7 +91,7 @@
[~,outName] = fileparts(baseDir);
outName = strrep(outName,'_metadata','');

sp_dt_makeTPWS_oneDir(baseDir,letterCode,ppThresh,outDir,outName,maxRows,tsWin)
sp_dt_makeTPWS_oneDir(baseDir,letterCode,ppThresh,outDir,outName,spName,maxRows,tsWin)
disp_msg(sprintf('Done with directory %s',baseDir))

else
Expand All @@ -100,7 +107,7 @@
~strcmp(dirSet(itr0).name,'..')
inDir = fullfile(dirSet(itr0).folder,dirSet(itr0).name);
outName = dirSet(itr0).name;
sp_dt_makeTPWS_oneDir(inDir,letterCode,ppThresh,outDir,outName,maxRows,tsWin)
sp_dt_makeTPWS_oneDir(inDir,letterCode,ppThresh,outDir,outName,spName,maxRows,tsWin)
disp_msg(sprintf('Done with directory %d of %d \n',itr0,length(dirSet)))
drawnow
end
Expand Down
4 changes: 4 additions & 0 deletions Remoras/SPICE-Detector/ui/sp_dt_TPWS_control.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function sp_dt_TPWS_control(action)
filterString = get(REMORA.spice_dt_mkTPWS.filterStringEdTxt,'String');
REMORA.spice_dt.mkTPWS.filterString = filterString;

elseif strcmp(action, 'setTPWSspName')
spName = get(REMORA.spice_dt_mkTPWS.spNameEdTxt,'String');
REMORA.spice_dt.mkTPWS.spName = spName;

elseif strcmp(action, 'setTPWSminRL')
minDBpp = get(REMORA.spice_dt_mkTPWS.minRLEdTxt,'String');
if ~isempty(minDBpp)
Expand Down
6 changes: 3 additions & 3 deletions Remoras/SPICE-Detector/ui/sp_dt_makeTPWS_oneDir.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function sp_dt_makeTPWS_oneDir(inDir,letterCode,ppThresh,outDir,outName,maxRows,tsWin)
function sp_dt_makeTPWS_oneDir(inDir,letterCode,ppThresh,outDir,outName,spName,maxRows,tsWin)

letterFlag = 0; % flag for knowing if a letter should be appended to disk name
% inDir = fullfile(baseDir,dirSet(itr0).name);
Expand Down Expand Up @@ -114,11 +114,11 @@ function sp_dt_makeTPWS_oneDir(inDir,letterCode,ppThresh,outDir,outName,maxRows,


if itr2 == lfs && letterFlag == 0
ttppOutName = [fullfile(outDir,outName),'_Delphin_TPWS1','.mat'];
ttppOutName = [fullfile(outDir,outName),'_',spName,'_TPWS1','.mat'];
subTP = 1;
else

ttppOutName = [fullfile(outDir,outName),char(letterCode(subTP)),'_Delphin_TPWS1','.mat'];
ttppOutName = [fullfile(outDir,outName),char(letterCode(subTP)),'_',spName,'_TPWS1','.mat'];
subTP = subTP+1;
letterFlag = 1;
end
Expand Down
45 changes: 37 additions & 8 deletions Remoras/SPICE-Detector/ui/sp_dt_mkTPWS_gui.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


% Setup variables:
defaultPos = [0.35,0.4,0.25,0.2];
defaultPos = [0.35,0.4,0.25,0.25];
% open and setup figure window

% If window already exists, close
Expand Down Expand Up @@ -161,10 +161,37 @@
'Visible','on',...
'Callback','sp_dt_TPWS_control(''setTPWSFilterString'')');

%% Species name TPWS
labelStr = 'Species name for TPWS file name';
btnPos=[x(1) y(7) w*1.5 dy];
REMORA.spice_dt_mkTPWS.spNameTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','text',...
'Units','normalized',...
'Position',btnPos,...
'HorizontalAlignment','left',...
'String',sprintf(labelStr,'Interpreter','tex'),...
'FontUnits','normalized', ...
'Visible','on');% 'BackgroundColor',bgColor3,...

% Species name Editable Text
if ~isfield(REMORA.spice_dt.mkTPWS, 'spName')
REMORA.spice_dt.mkTPWS.spName = 'Delphin';
end
btnPos=[x(2) y(7) w*.9 dy];
REMORA.spice_dt_mkTPWS.spNameEdTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','edit',...
'Units','normalized',...
'Position',btnPos,...
'BackgroundColor',bgColor,...
'HorizontalAlignment','left',...
'String',REMORA.spice_dt.mkTPWS.spName,...
'FontUnits','normalized', ...
'Visible','on',...
'Callback','sp_dt_TPWS_control(''setTPWSspName'')');

%% Min RL Text
labelStr = 'Min. Recieved Level (dBpp, optional)';
btnPos=[x(1) y(7) w*1.5 dy];
btnPos=[x(1) y(8) w*1.5 dy];
REMORA.spice_dt_mkTPWS.minRLTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','text',...
'Units','normalized',...
Expand All @@ -178,7 +205,7 @@
if ~isfield(REMORA.spice_dt.mkTPWS, 'minDBpp')
REMORA.spice_dt.mkTPWS.minDBpp = '';
end
btnPos=[x(2)+w/2 y(7) w/2*.8 dy];
btnPos=[x(2)+w/2 y(8) w/2*.8 dy];
REMORA.spice_dt_mkTPWS.minRLEdTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','edit',...
'Units','normalized',...
Expand All @@ -192,7 +219,7 @@

%% Max Rows Text
labelStr = 'Max. Detections Per File';
btnPos=[x(1) y(8) w*1.5 dy];
btnPos=[x(1) y(9) w*1.5 dy];
REMORA.spice_dt_mkTPWS.maxRowsTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','text',...
'Units','normalized',...
Expand All @@ -207,7 +234,7 @@
REMORA.spice_dt.mkTPWS.maxRows = 1800000;
end
labelStr = '';
btnPos=[x(2)+w/2 y(8) w/2*.8 dy];
btnPos=[x(2)+w/2 y(9) w/2*.8 dy];
REMORA.spice_dt_mkTPWS.maxRowsEdTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','edit',...
'Units','normalized',...
Expand All @@ -221,7 +248,7 @@

%% Waveform max samples
labelStr = 'Waveform Length (Samples)';
btnPos=[x(1) y(9) w*1.5 dy];
btnPos=[x(1) y(10) w*1.5 dy];
REMORA.spice_dt_mkTPWS.tsWinTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','text',...
'Units','normalized',...
Expand All @@ -235,7 +262,7 @@
if ~isfield(REMORA.spice_dt.mkTPWS, 'tsWin')
REMORA.spice_dt.mkTPWS.tsWin = 200;
end
btnPos=[x(2)+w/2 y(9) w/2*.8 dy];
btnPos=[x(2)+w/2 y(10) w/2*.8 dy];
REMORA.spice_dt_mkTPWS.tsWinEdTxt = uicontrol(REMORA.fig.sp_dt_mkTPWS,...
'Style','edit',...
'Units','normalized',...
Expand All @@ -247,8 +274,10 @@
'Visible','on',...
'Callback','sp_dt_TPWS_control(''setTsWin'')');


%% Run make TPWS file
labelStr = 'Make TPWS Files';
btnPos=[.25 y(11) .5 2*h];
btnPos=[.25 y(11) .5 1*h];
REMORA.spice_dt_mkTPWS.refresh = uicontrol(REMORA.fig.sp_dt_mkTPWS, ...
'Style','pushbutton', ...
'Units','normalized', ...
Expand Down

0 comments on commit ecd196c

Please sign in to comment.