-
Notifications
You must be signed in to change notification settings - Fork 8
/
example.m~
64 lines (49 loc) · 1.41 KB
/
example.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
% This code generates some fake data and the runs the sampler on it
% for testing
rng(12341)
% number of traces to generate
K = 1;
% set parameters for generating data
params.T = 20000;
params.dt = 1/20000;
params.phi = [.80, -.12];
params.sigma_sq = 3.0;
params.baseline_bounds = [-100 0];
params.tau_r_bounds = [0.25 1.0]*1e-3;
params.tau_f_bounds = [0.0025 0.0075];
params.a_bounds = [.5 20];
params.rate = 20;
params.event_direction = -1;
[traces, true_signal] = sample_traces(K,params);
% plot the noisy data
figure
plot_trace_stack(traces,40,zeros(size(traces,1),3),'-')
title('Noisy Data')
% plot the noise-free data
figure
plot_trace_stack(true_signal.traces,40,zeros(size(traces,1),3),'-')
title('Noise-free Data')
% save data to runresults
filename = 'data/test-data.mat';
save(filename,'traces','true_signal')
% build a parameter struct that will point to this file
params.traces_filename = filename;
% fill rest of struct with defaults
params = get_params(params);
% check that you're not writing over a previous results file
if exist(params.full_save_string, 'file') == 2
disp('****ABORTING: THE REQUESTED RESULTS FILE NAME ALREADY EXISTS****')
disp(params.full_save_string)
return
end
%%
params.num_sweeps= 1000
params.a_max = 25
params.a_min = 5
params.add_drop_sweeps = 1
params.amp_sweeps = 1
params.amp_prop_std = 0.5
params.p_event = 1e-7
%%
% run sampler
run_posterior_sampler(params);