Skip to content

Commit

Permalink
Added time width error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Dec 6, 2017
1 parent 9c9d8a1 commit 790f4e8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
<br /><br />
HOVSR</h1>
<p align="center">Matlab application that finds main frecuency from seismic timeseries acceleration data using H/V Stockwell Transform/Nakamura method</p>
<p align="center">Matlab application that finds main frecuency from seismic timeseries acceleration data using SH/SV Stockwell Transform/Nakamura method</p>
<div align="center"><a href="http://ppizarror.com"><img alt="@ppizarror" src="http://ppizarror.com/badges/author.svg" /></a>
<a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"><img alt="GPL V2.0" src="http://ppizarror.com/badges/licensegpl2.svg" /></a>
</div><br />
Expand Down
2 changes: 1 addition & 1 deletion config.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

%% App config
APP_SOUNDS = true;
LANGUAGE = 2; % 1: English, 2: Spanish
LANGUAGE = 1; % 1: English, 2: Español

%% Transform/Smooth numerical method type
% (1) Stockwell Transform (S-transform), window with all data
Expand Down
12 changes: 6 additions & 6 deletions load_lang.m
Original file line number Diff line number Diff line change
Expand Up @@ -220,20 +220,20 @@
list{62, 1} = 'Window width (s)';
list{62, 2} = 'Tamaño ventana (s)';

list{63, 1} = 'Enter window width (s)';
list{63, 2} = 'Ingrese el tamaño de la ventana (s)';
list{63, 1} = 'Enter window width, max: %.2f (s)';
list{63, 2} = 'Ingrese el tamaño de la ventana, máximo: %.2f (s)';

list{64, 1} = 'Bad STRANSFORM_TYPE config value';
list{64, 2} = 'Error en configuración STRANSFORM_TYPE no conocida';
list{64, 1} = 'Bad STRANSFORM_TYPE config value.';
list{64, 2} = 'Error en configuración STRANSFORM_TYPE no conocida.';

list{65, 1} = 'Average and standard deviation';
list{65, 2} = 'Promedio y desviación estándar';

list{66, 1} = 'Median and percentile (min-10-20-40-60-80-90-max)';
list{66, 2} = 'Mediana y percentiles (min-10-20-40-60-80-90-max)';

list{67, 1} = '';
list{67, 2} = '';
list{67, 1} = 'Window width cant be greater than timeseries width.';
list{67, 2} = 'El tamaño de la ventana no puede superar el máximo del registro.';

list{68, 1} = '';
list{68, 2} = '';
Expand Down
2 changes: 1 addition & 1 deletion readme.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"SHOW": true
}
},
"DESCRIPTION": "Matlab application that finds main frecuency from seismic timeseries acceleration data using H/V Stockwell Transform/Nakamura method",
"DESCRIPTION": "Matlab application that finds main frecuency from seismic timeseries acceleration data using SH/SV Stockwell Transform/Nakamura method",
"BADGES": {
"0": {
"IMAGE": "http://ppizarror.com/badges/author.svg",
Expand Down
9 changes: 7 additions & 2 deletions start_process.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ function start_process(handles, lang)
[m, ~] = size(M);

% Request window time
data = inputdlg({lang{63}}, lang{62}, [1, 50], {num2str(min(STRANSFORM_DEFAULT_WINDOW_WIDTH, round(max(ns_t))))});
data = inputdlg({sprintf(lang{63}, max(ns_t))}, lang{62}, [1, 50], ...
{num2str(min(STRANSFORM_DEFAULT_WINDOW_WIDTH, round(max(ns_t))))});
try
T = data{1};
catch
Expand All @@ -138,6 +139,10 @@ function start_process(handles, lang)
disp_error(handles, 22, 11, lang);
return;
end
if T > max(ns_t)
disp_error(handles, 67, 11, lang);
return;
end
fi = ceil(STRANSFORM_F_MIN*T);
ff = ceil(STRANSFORM_F_MAX*T);

Expand Down Expand Up @@ -450,7 +455,7 @@ function start_process(handles, lang)
plot(1:1:itr, max_freqs(1:itr), STYLE_MAX_F);
xlim([1, max(itr, 2)]);
lims = get(gca, 'ylim');
ylim([0, lims(2)]);
ylim([0, lims(2) * 1.2]);
yaxis_linspace(5);
hold off;
grid on;
Expand Down

0 comments on commit 790f4e8

Please sign in to comment.