-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimport_HyperionData.m
38 lines (29 loc) · 1.11 KB
/
import_HyperionData.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
function m = import_HyperionData(filename)
CountRate = h5read(filename, '/CountRate');
h = h5read(filename, '/CountRate_headers');
m.count = CountRate.count;
m.period = double(CountRate.period(1)) * 1e-9;
m.timestamp = convertTimestamp(h.timestamp) + m.period/2.;
m.exp_id = h.experiment_id(1);
%%
cri = h5read(filename, '/Cri');
h = h5read(filename, '/Cri_headers');
m.cri = cri.count;
m.cri_onset_ps = cri.utime_from_ps(1);
m.cri_until_ps = cri.utime_until_ps(1);
m.cri_timestamp = convertTimestamp(h.timestamp) + m.period/2.;
m.cri_exp_id = h.experiment_id;
%%
dtof = h5read(filename, '/Dtof');
h = h5read(filename, '/Dtof_headers');
m.dtof = dtof.counts;
m.dtof_range_min = dtof.range_min(1); % same over one experiment
m.dtof_range_max = dtof.range_max(1); % same over one experiment
m.dtof_resolution = dtof.resolution(1); % ps
m.dtof_timestamp = convertTimestamp(h.timestamp) + m.period/2.;
m.dtof_exp_id = h.experiment_id(1);
end
function time_in_sec = convertTimestamp(timestamp)
timestamp = timestamp - timestamp(1); % ns precision
time_in_sec = double(timestamp) * 1e-9; % sec
end