"""Load the tidy measurements as one row per setting x 12 outputs.""" import numpy as np import pandas as pd from .space import OUTPUTS, PARAMS, ROOT def load_settings(include_synthetic: bool = True) -> pd.DataFrame: """One row per setting: PARAMS, `source`, and a column per (target, position).""" df = pd.read_csv(ROOT / "data" / "extrusion.csv") if not include_synthetic: df = df[df["source"] == "real"] wide = df.pivot_table( index=[*PARAMS, "source"], columns="position", values=sorted({t for t, _ in OUTPUTS}), ) wide.columns = [f"{t}|{p}" for t, p in wide.columns] wide = wide[[f"{t}|{p}" for t, p in OUTPUTS]].reset_index() return wide def setting_array(df: pd.DataFrame) -> np.ndarray: return df[PARAMS].to_numpy(dtype=float)