updated tools to calculate sigma on a window