function [qual,sncal]=bft(Bl10,F,T,T0,T1,F1,F2,F3,F4) % [qual,sncal]=bft(Bl10,F,T,T0,T1,F1,F2,F3,F4) % % Analyses the time-dependent spectral density of a data segment, % calculated by SPECTROGRAM, to come up with a quality indicator % of the selection % % INPUT: % % Bl10 10*log10 of the spectral density Ba(UNIT^2/Hz) % F Frequency axis (Hz) % T Time axis (s) % T0 Triggered time (s) % T1 Detriggered time (s) % F1,... Frequency-domain boxes given as FN=[f14 % Time-domain boxes are calculated from the time picks. % % OUTPUT: % % qual 0 Definitely not a good selection % 1 Clear waveform, low noise % 2 Might be a good selection, but not great % sncal Estimate of the signal-to-noise ratio % % SEE ALSO: BST. % % Last modified by fjsimons-at-alum.mit.edu, 05/24/2010 % Intercept undefined time picks (SAC defaults) if T0==-12345 | T1==-12345 qual=NaN; sncal=0; return end BOR=Bl10; defval('F1',[0.3 3]); defval('F2',[ 3 5]); defval('F3',[ 5 7]); defval('F4',[ 7 10]); TB1=find(T>T0 & TT1 & T<(T1+(T1-T0))); TB3=find(T<(T1+(T1-T0)) & T<(T1+2*(T1-T0))); TB4=find(T>(T0-(T1-T0)) & TF1(1) & FF1(1) & FF2(1) & FF3(1) & FF4(1) & Fbmean(1) ... & bmean(3)>bmean(1) ... & bmean(4)>bmean(1)) bmean=0; else % This might be a positive identification if (bmean(6)<=bmean(2) & bmean(6)<=bmean(1) ... & bmean(6)<=bmean(5) & bmean(8)<=bmean(7)) % But if the onset is unclear, don't take it if (bmean(9)>=bmean(1)) bmean=0; else bmean=1; end else % Call this the second quality event bmean=2; end end qual=bmean;