move calculation of deg_y out of kv.sage