-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoE_time_evolve_statemat.m
executable file
·55 lines (41 loc) · 1.96 KB
/
SoE_time_evolve_statemat.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
function [ SoE_state_matrix ] = SoE_time_evolve_statemat ( SoE, Nsubtracks, adj_mat )
% Input: matrix sequence of events
% Output: matrix of tracks vs. Events. Uncorrected. values may be 0 or negative,
% and, if so, will be corrected by a separate script.
Nevents = size( SoE, 1 );
SoE_state_matrix = NaN( [ Nevents, Nsubtracks] );
% initialize:
prev_states = NaN( [ 1, Nsubtracks ] );
% cycle through events:
for evi = 1:Nevents
if( evi > 1 )
prev_states = SoE_state_matrix(evi-1,:);
end
% preserve states from previous event for tracks irrelevant to the present event
% ( relevant tracks will be over-written later)
SoE_state_matrix( evi, : ) = prev_states;
%-------------------- BIRTH: --------------------
if ( SoE(evi,2) == 1)
SoE_state_matrix( evi, SoE(evi,3) ) = 1 + adj_mat(evi, SoE(evi,3) ) ;
% index for this track: ^
% initialize as monomer + whatever is indicated by the adjustment matrix
% ---- born through split?
if ( ~isnan( SoE(evi,4) ) )
SoE_state_matrix( evi, SoE(evi,4) ) = prev_states ( SoE(evi, 4) ) -1 - adj_mat(evi, SoE(evi,3)) ;
% index for other track: ^ ^
% Parent track decreases by (1+adjustment_matrix of born track at this event),
% The default assumption being that the born track is always is a
% monomer state).
end
%-------------------- DEATH: --------------------
else if ( SoE(evi,2) == 2 )
SoE_state_matrix( evi, SoE(evi,3) ) = NaN;
% index for this track: ^
% ---- death through merger ?
if ( ~isnan( SoE(evi,4) ) )
SoE_state_matrix( evi, SoE(evi,4) ) = prev_states ( SoE(evi, 4) ) + prev_states ( SoE(evi, 3) ) ; % increment by state of dying track
% index for other track: ^
end
end
end % end of loop through Events.
end % end of function