Adding functions to constuct optimal filter from calibration traces