import numpy as np
import pandas as pd

CSV_PATH = "dummy_data.csv"  # <-- change to your csv filename

INPUT_COLS = ["in1", "in2", "in3", "in1", "in2", "in3", "in1", "in2", "in3", "in1", "in2", "in3", "in1", "in2", "in3", "in1", "in2", "in3", "in1", "in2"]

# 1) Load CSV
df = pd.read_csv(CSV_PATH)

# 2) Extract inputs
X = df[INPUT_COLS].to_numpy()

# 3) OPTIONAL: apply the SAME preprocessing used during training/inference
# Example: standardization (fill with your training mean/std if you used it)
# mean = np.array([...], dtype=np.float32)
# std  = np.array([...], dtype=np.float32)
# X = (X - mean) / std

# 4) Convert dtype
X = X.astype(np.float32)

# 5) Choose calibration size (recommended: a few hundred to ~1024 if you have it)
# Hailo logs often show calibration running with 64 entries in some cases (works, but can be less stable). 
N = min(len(X), 1024)

# Shuffle so first N rows are representative (important if your CSV is time-ordered)
rng = np.random.default_rng(0)
idx = rng.choice(len(X), size=N, replace=False)
calib = X[idx]

# 6) Save
np.save("model_t13/calib_set_t13.npy", calib)
print("Saved calib_set_t13.npy:", calib.shape, calib.dtype)
