Design and analysis of spherical codes