def _rays_per_sweep_data_factory(radar):
    """ Return a function which returns the number of rays per sweep. """
    def _rays_per_sweep_data():
        """ The function which returns the number of rays per sweep. """
        return (radar.sweep_end_ray_index['data'] -
                radar.sweep_start_ray_index['data'] + 1)
    return _rays_per_sweep_data