Repository navigation
Expand file tree
/
Copy pathTSplot4TS.m
More file actions
92 lines (81 loc) · 2.77 KB
/
Copy pathTSplot4TS.m
File metadata and controls
92 lines (81 loc) · 2.77 KB
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
function [hTSw,TSdata1,TSw1,TSd1,TSc1,TSp1] = TSplot4TS(tsObj,varargin)
% takes TS object as input, and initializes TS plotting window
% Usage: [hTSw,TSdata1,TSw1,TSd1,TSc1,TSp1] = plotTS(tsObj,varargin)
%
% set up and TSplot window, plot first section, return all structures
% needed for managing TSplot
tUnits = 'Days';
% tUnits = initial time units for labeling time series plots
% other choices are 'Seconds','Minutes','Days'
nTunits = 1;
% Number of Hours (more generally, tUnits) to plot on one page
% set up dummy unit system response
freq = [1,1e-6]./tsObj.dt;
[SysTF] = setUnitSysTF(tsObj.NCh,freq);
% set up default channel labels
switch tsObj.NCh
case 3
ch = ['Hx';'Hy';'Hz'];
case 5
ch = ['Hx';'Hy';'Hz';'Ex';'Ey'];
otherwise
ch = [];
for ich = 1:tsObj.NCh
ch = [ ch ; 'ch' num2str(ich)];
end
end
n = length(varargin);
if mod(n,2)
error('Optional arguments must occur in pairs')
end
for k = 1:2:n
option = lower(varargin{k});
switch option
case 'tunits'
tUnits = varargin{k+1};
case 'ntunits'
nTunits = varargin{k+1};
case 'systf'
SysTF = varargin{k+1};
case 'ch'
ch = varargin{k+1};
end
end
% initialize structure "plotStart"
[plotStart] = plotSetup(tUnits,nTunits,tsObj.dt);
sta = [];
for k = 1:tsObj.NCh
sta = [sta; tsObj.name];
end
% reset nPw (# of points to plot initially on one page) now
% that dt has been read from data file (NOTE: dt returned
% by readTSnims accounts for subsampling by a factor of decFac)
nPw = fix(plotStart.tFac*plotStart.nTunits/tsObj.dt);
nPw = min(nPw,tsObj.npts);
plotStart.nPw = nPw;
% set up TSd
t0 = datenum(tsObj.startTime)-datenum(tsObj.zeroTime);
t0 = round(t0*24*3600/tsObj.dt);
zeroTimeStr = datestr(tsObj.zeroTime);
TSd1 = setTSd(tsObj.data,t0,tsObj.dt,ch,sta,SysTF,zeroTimeStr);
TSd1.sta = char(TSd1.sta);
TSdata0 = (TSd1.range(:,1)+TSd1.range(:,2))/2;
rng = (TSd1.range(:,2)-TSd1.range(:,1))/2;
rng = plotStart.rangeScale*rng;
TSd1.range(:,1:2) = [ TSdata0-rng TSdata0+rng];
% are these needed???
TSd1.DataDir = './';
TSd1.arrayID = '';
TSdata1 = tsObj.data;
[hTSw,TSw1] = plotTSwin(TSd1,plotStart);
i0 = TSw1.i0; i1 = TSw1.i1; di = TSw1.di;
yFac = TSw1.yFac;
ddt = TSd1.dt/TSw1.tFac;
t0 = (TSd1.t0)*(1-TSw1.t0Eq0)/TSw1.tFac;
I = i0:di:i1;
[TSw1] = plotPage(ddt*I+t0,...
yFac*TSdata1(:,I),...
TSw1,TSd1,1);
TSc1 = [];
TSp1 = [];
end