forked from MarineBioAcousticsRC/Triton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_timeseries.m
99 lines (86 loc) · 2.7 KB
/
plot_timeseries.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
function plot_timeseries
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% plot_timeseries.m
%
% plots the timeseries to the main window
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global DATA HANDLES PARAMS REMORA
% get which figures plotted
savalue = get(HANDLES.display.ltsa,'Value');
tsvalue = get(HANDLES.display.timeseries,'Value');
spvalue = get(HANDLES.display.spectra,'Value');
sgvalue = get(HANDLES.display.specgram,'Value');
MultiCh_On = get(HANDLES.mc.on, 'Value');
% total number of plots in window
m = savalue + tsvalue + spvalue + sgvalue;
% DATA length
if savalue && MultiCh_On
PARAMS.ch = PARAMS.ch - 1;
end
% ellipical filter
if PARAMS.filter
[b,a] = ellip(4,0.1,40,[PARAMS.ff1 PARAMS.ff2]*2/PARAMS.fs);
DATA(:,PARAMS.ch) = filter(b,a,DATA(:,PARAMS.ch));
end
len = length(DATA(:,PARAMS.ch));
% time series only
HANDLES.subplt.timeseries = subplot(HANDLES.plot.now);
HANDLES.plt.timeseries = plot((0:len-1)/PARAMS.fs,DATA(:,PARAMS.ch));
% check to see if time series plot goes past end of data, if so,
% correct it
v = axis;
if PARAMS.auto.amp
if v(2) > (len-1)/PARAMS.fs
v(2) = (len-1)/PARAMS.fs;
axis(v)
end
else
axis([v(1) v(2) PARAMS.ts.min PARAMS.ts.max])
end
% plot red line if plot figure crosses RawFile boundary & delimit button on
% & not a wav file
if PARAMS.ftype ~=1 && PARAMS.delimit.value && length(PARAMS.raw.delimit_time) ~= 1
for r=1:length(PARAMS.raw.delimit_time)
y = [v(3),v(4)];
x = [PARAMS.raw.delimit_time(r), PARAMS.raw.delimit_time(r)];
HANDLES.delimit.tsline(r) = line(x,y,'Color','r','LineWidth',4);
end
end
%labels
ylabel('Amplitude [counts]')
xlabel('Time [seconds]')
% text positions
tx = [0 0.70 0.85]; % x
ty = [-0.05 -0.125 -0.175 -0.25]; % y upper left&right
ty2 = [-0.075 -0.175 -0.25 -0.35]; % y lower right
MultiCh_On = get(HANDLES.mc.on, 'Value');
if ~spvalue
% put window start time on bottom plot only:
if MultiCh_On
else
text('Position',[0 ty(m)],'Units','normalized',...
'String',timestr(PARAMS.plot.dnum,1));
end
end
% plot title on top plot
if ~sgvalue
if MultiCh_On
%left blank to not write in text under each individual graph, text
%written in plot_triton.m under the last graph
else
if PARAMS.filter == 1
title([PARAMS.inpath,PARAMS.infile,' CH=',num2str(PARAMS.ch),...
' Band Pass Filter ',num2str(PARAMS.ff1),' Hz to ',...
num2str(PARAMS.ff2),' Hz'])
else
title([PARAMS.inpath,PARAMS.infile,' CH=',num2str(PARAMS.ch)])
end
end
end
if isfield(REMORA,'ltsa_plot_lVis_lab')
if tsvalue
REMORA.ltsa_plot_lVis_lab{3}();
end
end