Added gain sweep code as used in Sun test