-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotNimsReadOutput.m
More file actions
83 lines (69 loc) · 2.43 KB
/
plotNimsReadOutput.m
File metadata and controls
83 lines (69 loc) · 2.43 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
% Version of TSplot.m for plotting NIMSread output *.bin files
% return full data set (no decimation);scale into
% physical units (but no other filter corrections applied)
decFac = 1;
scale = 1; %if scale == 1 data are returned with units of nT and mV
% note: not divided by dipole length!
% tUnits = time units for labeling time series plots
% other choices are 'Seconds','Minutes','Days'
tUnits = 'Hours';
% Number of Hours (more generally, tUnits) to plot on one pag3e
nTunits = 6;
% Assumed sampling rate (used to calculate number of points in
% the plotting window only ... should recompute after reading file)
dt = 1;
% initialize structure "plotStart"
[plotStart] = plotSetup(tUnits,nTunits,dt);
% this program just reads one file, obtained by browsing
% load one NIMS data ...
if ~exist('TSplotFile','var') || ~exist('TSplotPath','var')
[filename, pathname, filterindex] = ...
uigetfile({'*.bin','NIMS bin files'; ...
'*.dbn','decimated NIMS bin files';...
'*.mat', 'mat files'}, ...
'Data File to Plot');
TSplotFile = filename;
TSplotPath = pathname;
end
FileNames{1} = TSplotFile;
cd (TSplotPath);
% new version of readTSnims can now handle mat files also ...
[y,SysTF,dt,t0,ch,sta,error] = readTSnims(FileNames,decFac,scale);
% 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/dt);
plotStart.nPw = nPw;
% Initialize cell arrays for data, time series metadata,
% window metadata, etc.
TSc = {};
TSp = {};
TSd = {};
TSw = {};
TSdata = {};
TSfigInd = zeros(100,1);
% set up TSd
TSd1 = setTSd(y,t0,dt,ch,sta,SysTF);
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 = TSplotPath;
TSd1.arrayID = '';
% copy into cell arrays
iA = 1;
TSdata{iA} = y;
TSd{iA} = TSd1;
[hTSw,TSw1] = plotTSwin(TSd{1},plotStart);
TSfigInd(hTSw.Number) = 1;
i0 = TSw1.i0; i1 = TSw1.i1; di = TSw1.di;
yFac = TSw1.yFac;
ddt = TSd{1}.dt/TSw1.tFac;
t0 = (TSd{1}.t0)*(1-TSw1.t0Eq0)/TSw1.tFac;
I = (i0:di:i1);
[TSw1] = plotPage(ddt*I+t0,...
yFac*TSdata{1}(:,I),...
TSw1,TSd{1},1);
TSw{1} = TSw1;