forked from sgarrettroe/data_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload3d.m
138 lines (128 loc) · 2.77 KB
/
load3d.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
function s = load3d(basename)
%LOAD3D load 3d data
% s = struct('freq',[],...
% 'time',[],...
% 't2',[],...
% 't4',[],...
% 't5',[],...
% 'w1',[],...
% 'w3',[],...
% 'w5',[],...
% 'R',[],...
% 'R1',[],...
% 'R2',[],...
% 'R3',[],...
% 'R4',[],...
% 'phase',[],...
% 'R1_noise',[],...
% 'R2_noise',[],...
% 'R3_noise',[],...
% 'R4_noise',[],...
% 'basename',basename,...
% 'undersampling',[],...
% 'centerfreq',[],...
% 'resolution',[],...
% 'zeropad',[],...
% 'time_units',[],...
% 'freq_units',[],...
% 'spec_calib',[],...
% 'comment',[]);
s = construct3d;
if nargin == 0
return
end
s.basename = basename;
temp = load([basename,'_freq.dat']);
s.freq = temp;
s.freq_units = 'cm-1';
temp = load([basename,'_time.dat']);
s.time = temp;
s.time_units = 'fs';
%if a time file is found
if exist([basename,'_t2t4t5.dat']),
temp = load([basename,'_t2t4t5.dat']);
s.t2 = temp(1);
s.t4 = temp(2);
s.t5 = temp(3);
end
n_delays = length(s.time);
n_freq = length(s.freq);
s.R = zeros(n_delays,n_delays,n_freq);
s.R1 = zeros(n_delays,n_delays,n_freq);
s.R2 = zeros(n_delays,n_delays,n_freq);
s.R3 = zeros(n_delays,n_delays,n_freq);
s.R4 = zeros(n_delays,n_delays,n_freq);
s.R1_noise = zeros(n_delays,n_delays,n_freq);
s.R2_noise = zeros(n_delays,n_delays,n_freq);
s.R3_noise = zeros(n_delays,n_delays,n_freq);
s.R4_noise = zeros(n_delays,n_delays,n_freq);
temp = load([basename,'.dat']);
%change order to be consistent with Hamm JCP 2006
count = 0;
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R3(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R4(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R1(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R2(j,i,k) = temp(count);
end
end
end
temp = load([basename,'_noise.dat']);
count = 0;
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R1_noise(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R2_noise(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R3_noise(j,i,k) = temp(count);
end
end
end
for i = 1:n_delays
for j = 1:n_delays
for k = 1:n_freq
count = count+1;
s.R4_noise(j,i,k) = temp(count);
end
end
end
%s.R = s.R1 + s.R2 + s.R3 + s.R4;