code for error analysis, enable by #define ST_STRUCTURE in calibration_pu.c