Updated tools.py including more general radial average.