fix: counting states
This commit is contained in:
parent
cccb402d65
commit
afe7224dc6
|
@ -74,10 +74,13 @@ lower_tri = np.tril_indices(position.shape[0], k = -1)
|
|||
max_dist = box_size / 2.0
|
||||
|
||||
# second iteration to estimate pairwise distance CDF
|
||||
nr_time_points = 0
|
||||
for i, ((position, velocity), box_size) in enumerate(iter_load(config.input)):
|
||||
# ignore the first 25% (just keep it simple)
|
||||
if 4 * i < nr_states:
|
||||
continue
|
||||
# Count number of actually considured states / time points
|
||||
nr_time_points += 1
|
||||
# magic for all particle pair distances
|
||||
diff = position[:, np.newaxis, :] - position
|
||||
diff = diff[lower_tri[0], lower_tri[1], :]
|
||||
|
@ -90,7 +93,7 @@ for i, ((position, velocity), box_size) in enumerate(iter_load(config.input)):
|
|||
# accumulate per timepoint partial mean estimates of the CDF
|
||||
CDF += np.mean(dist[:, np.newaxis] < radii, axis = 0)
|
||||
# final division by timesteps as mean over pairs and time.
|
||||
CDF /= nr_states
|
||||
CDF /= nr_time_points
|
||||
|
||||
# store the CDF estimate to the second file
|
||||
with open(config.outputB, "w") as output:
|
||||
|
|
Loading…
Reference in New Issue