Skip to content

Commit

Permalink
test on seed
Browse files Browse the repository at this point in the history
leo-desbureaux-tellae committed Sep 18, 2023
1 parent 7c20c6a commit 36bbdcc
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions bhepop2/bhepop2_enrichment.py
Original file line number Diff line number Diff line change
@@ -71,7 +71,9 @@ def __init__(

# random seed (maybe use a random generator instead)
self.seed = seed
print("seed", seed)
if seed is not None:
print("seed", seed)
random.seed(seed)

# original population to be enriched
18 changes: 9 additions & 9 deletions tests/test_bhepop2_enrich.py
Original file line number Diff line number Diff line change
@@ -25,14 +25,14 @@ def test_bhepop2_enrich(

# pop.to_csv("tests/data/nantes_enriched.csv", index=False)

pop = pop.to_numpy()
expected_enriched_population_nantes = expected_enriched_population_nantes.to_numpy()
shape = np.shape(pop)
assert np.shape(expected_enriched_population_nantes) == shape
for i in range(shape[0]):
for j in range(shape[1]):
if pop[i, j] != expected_enriched_population_nantes[i, j]:
print(i, j)
print(pop[i, j], expected_enriched_population_nantes[i, j])
# pop = pop.to_numpy()
# expected_enriched_population_nantes = expected_enriched_population_nantes.to_numpy()
# shape = np.shape(pop)
# assert np.shape(expected_enriched_population_nantes) == shape
# for i in range(shape[0]):
# for j in range(shape[1]):
# if pop[i, j] != expected_enriched_population_nantes[i, j]:
# print(i, j)
# print(pop[i, j], expected_enriched_population_nantes[i, j])

assert np.all((pop == expected_enriched_population_nantes).to_numpy())

0 comments on commit 36bbdcc

Please sign in to comment.