Improve critical error handling in moy_ue

This commit is contained in:
Emmanuel Viennet 2023-06-21 17:25:40 +02:00
parent 9067424f8f
commit b501233ba4

View File

@ -30,6 +30,7 @@
import numpy as np
import pandas as pd
import app
from app import db
from app import models
from app.models import (
@ -167,8 +168,14 @@ def notes_sem_assemble_cube(modimpls_notes: list[pd.DataFrame]) -> np.ndarray:
"""
assert len(modimpls_notes)
modimpls_notes_arr = [df.values for df in modimpls_notes]
try:
modimpls_notes = np.stack(modimpls_notes_arr)
# passe de (mod x etud x ue) à (etud x mod x ue)
except ValueError:
app.critical_error(
f"""notes_sem_assemble_cube: shapes {
", ".join([x.shape for x in modimpls_notes_arr])}"""
)
return modimpls_notes.swapaxes(0, 1)