The map normalization that was used prior to this PR was very hacky, inconsistent across datasets, and led to confusion when using coot's vs. PyMOL's contour levels. Key improvements:
The mostly-full-of-zeros maps created by matchmaps are never subjected to gemmi's "normalize" feature, which operates over the entire unit cell. Doing so led to the zeros being replaced with some constant, small, non-zero value, and messed up everything downstream. Rather, normalization (enforcing mean=0, std=1) is only ever performed on non-zero voxels.
The final "unmasked" output map has matching values for "sigma" and "electrons / cubic Angstrom" by virtue of its creation. This (in combination with turning off the "normalize maps" feature in PyMOL) solves the issue of inconsistent contour levels between coot and PyMOL. The sigma and e/A^3 values differ slightly in the "masked" output, which is unavoidable, but the raw e/A^3 values match between the masked and unmasked versions.
The map normalization that was used prior to this PR was very hacky, inconsistent across datasets, and led to confusion when using coot's vs. PyMOL's contour levels. Key improvements: