Skip to content

Commit

Permalink
Add a method to count length of Pos
Browse files Browse the repository at this point in the history
  • Loading branch information
kopeckyf committed Apr 11, 2022
1 parent 89b7223 commit 51789d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions taupy/simulation/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ def position_changes(simulation, *, measure=hamming_distance, densities=True):
return pd.DataFrame(list(zip(density_pairs, averages)), columns=["avg density in pair", "position difference"])
else:
return averages

def len_of_positions(simulation):
sim_ids = [idx for idx, s in enumerate(simulation)]

int1 = len([p for p in simulation.positions[-1] if len(p) in list(range(0,7))])
int2 = len([p for p in simulation.positions[-1] if len(p) in list(range(7,14))])
int3 = len([p for p in simulation.positions[-1] if len(p) in list(range(14,21))])

return pd.DataFrame(list(zip(sim_ids, int1, int2, int3)), columns=["id", "0–6", "7–13", "14–20"])


def mean_population_wide_agreement(simulation, *, densities=True):
Expand Down

0 comments on commit 51789d2

Please sign in to comment.