source code needed for calculating calibration factors