This commit is contained in:
Emmanuel Viennet 2022-01-17 00:06:21 +01:00
parent da5445baa8
commit b8b3185901
2 changed files with 13 additions and 7 deletions

View File

@ -121,6 +121,7 @@ def notes_sem_assemble_cube(modimpls_notes: list[pd.DataFrame]) -> np.ndarray:
(DataFrames rendus par compute_module_moy, (etud x UE)) (DataFrames rendus par compute_module_moy, (etud x UE))
Resultat: ndarray (etud x module x UE) Resultat: ndarray (etud x module x UE)
""" """
assert len(modimpls_notes)
modimpls_notes_arr = [df.values for df in modimpls_notes] modimpls_notes_arr = [df.values for df in modimpls_notes]
modimpls_notes = np.stack(modimpls_notes_arr) modimpls_notes = np.stack(modimpls_notes_arr)
# passe de (mod x etud x ue) à (etud x mod x UE) # passe de (mod x etud x ue) à (etud x mod x UE)
@ -156,8 +157,13 @@ def notes_sem_load_cube(formsemestre):
modimpls_evaluations[modimpl.id] = evaluations modimpls_evaluations[modimpl.id] = evaluations
modimpls_evaluations_complete[modimpl.id] = evaluations_completes modimpls_evaluations_complete[modimpl.id] = evaluations_completes
modimpls_notes.append(etuds_moy_module) modimpls_notes.append(etuds_moy_module)
if len(modimpls_notes):
cube = notes_sem_assemble_cube(modimpls_notes)
else:
nb_etuds = formsemestre.etuds.count()
cube = np.zeros((nb_etuds, 0, 0), dtype=float)
return ( return (
notes_sem_assemble_cube(modimpls_notes), cube,
modimpls_evals_poids, modimpls_evals_poids,
modimpls_evals_notes, modimpls_evals_notes,
modimpls_evaluations, modimpls_evaluations,
@ -191,8 +197,12 @@ def compute_ue_moys(
Resultat: DataFrame columns UE, rows etudid Resultat: DataFrame columns UE, rows etudid
""" """
nb_etuds, nb_modules, nb_ues = sem_cube.shape nb_etuds, nb_modules, nb_ues = sem_cube.shape
assert len(etuds) == nb_etuds
assert len(modimpls) == nb_modules assert len(modimpls) == nb_modules
if nb_modules == 0 or nb_etuds == 0:
return pd.DataFrame(
index=modimpl_inscr_df.index, columns=modimpl_coefs_df.index
)
assert len(etuds) == nb_etuds
assert len(ues) == nb_ues assert len(ues) == nb_ues
assert modimpl_inscr_df.shape[0] == nb_etuds assert modimpl_inscr_df.shape[0] == nb_etuds
assert modimpl_inscr_df.shape[1] == nb_modules assert modimpl_inscr_df.shape[1] == nb_modules
@ -200,10 +210,6 @@ def compute_ue_moys(
assert modimpl_coefs_df.shape[1] == nb_modules assert modimpl_coefs_df.shape[1] == nb_modules
modimpl_inscr = modimpl_inscr_df.values modimpl_inscr = modimpl_inscr_df.values
modimpl_coefs = modimpl_coefs_df.values modimpl_coefs = modimpl_coefs_df.values
if nb_etuds == 0:
return pd.DataFrame(
index=modimpl_inscr_df.index, columns=modimpl_coefs_df.index
)
# Duplique les inscriptions sur les UEs: # Duplique les inscriptions sur les UEs:
modimpl_inscr_stacked = np.stack([modimpl_inscr] * nb_ues, axis=2) modimpl_inscr_stacked = np.stack([modimpl_inscr] * nb_ues, axis=2)
# Enlève les NaN du numérateur: # Enlève les NaN du numérateur:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.1.24" SCOVERSION = "9.1.25"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"