heat map grayscale generation algorithm implemented and working