Use double rather than float when appropriate to improve precision of heatmaps
Merge heatmap_fixes branch
Change float to double for calculations