Update scale factor code to print median value of scale factors