Skip to content
Snippets Groups Projects
Commit 842df2aa authored by raclet's avatar raclet
Browse files

Ajout du sorted sur les paires de incomp theory

parent c1db2fdc
No related branches found
No related tags found
No related merge requests found
...@@ -51,7 +51,7 @@ def verifier_apogee_vs_theory(): ...@@ -51,7 +51,7 @@ def verifier_apogee_vs_theory():
for index, row in df.iterrows(): for index, row in df.iterrows():
group1 = row['COD_EXT_GPE'] group1 = row['COD_EXT_GPE']
group2 = row['COD_EXT_GPE1'] group2 = row['COD_EXT_GPE1']
# Normaliser l'ordre pour garantir la cohérence # normalisation de l'ordre pour garantir la cohérence
group_pair = tuple(sorted((group1, group2))) group_pair = tuple(sorted((group1, group2)))
incompatibility, g1_sillons, g2_sillons = check_incompatibility(group1, group2, sillon_to_groups) incompatibility, g1_sillons, g2_sillons = check_incompatibility(group1, group2, sillon_to_groups)
...@@ -63,14 +63,17 @@ def verifier_apogee_vs_theory(): ...@@ -63,14 +63,17 @@ def verifier_apogee_vs_theory():
# fonction qui génére toutes les incomp d'après la théorie de l'association groupes/sillons # fonction qui génére toutes les incomp d'après la théorie de l'association groupes/sillons
def incomp_theory_creator(): def incomp_theory_creator():
for sillon, groups in sillon_to_groups.items(): for sillon, groups in sillon_to_groups.items():
all_incompatibilities_theory.update(combinations(groups, 2)) # ajout de toutes les paires du même sillon
for group1, group2 in combinations(groups, 2):
all_incompatibilities_theory.add(tuple(sorted((group1, group2))))
# ajout des paires entre demi-sillons A et non-A ou B et non-B
base_sillon = ''.join(filter(str.isdigit, sillon)) base_sillon = ''.join(filter(str.isdigit, sillon))
for other_sillon, other_groups in sillon_to_groups.items(): for other_sillon, other_groups in sillon_to_groups.items():
if other_sillon != sillon and ''.join(filter(str.isdigit, other_sillon)) == base_sillon: if other_sillon != sillon and ''.join(filter(str.isdigit, other_sillon)) == base_sillon:
if not ((sillon.endswith('A') and other_sillon.endswith('B')) or (sillon.endswith('B') and other_sillon.endswith('A'))): if not ((sillon.endswith('A') and other_sillon.endswith('B')) or (sillon.endswith('B') and other_sillon.endswith('A'))):
for group1 in groups: for group1 in groups:
for group2 in other_groups: for group2 in other_groups:
all_incompatibilities_theory.add((group1, group2)) all_incompatibilities_theory.add(tuple(sorted((group1, group2))))
# fonction qui vérifie si une incomp qui devrait exister en théorie est bien enregistrée dans Apogee. # fonction qui vérifie si une incomp qui devrait exister en théorie est bien enregistrée dans Apogee.
# Si ce n'est pas le cas alors un message d'erreur est affiché. # Si ce n'est pas le cas alors un message d'erreur est affiché.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment