Commit ae676a6a authored by Maximilian Beckers's avatar Maximilian Beckers
Browse files

catch error in variance estimation

parent 5dc860dc
......@@ -178,7 +178,7 @@ def main():
if args.locResMap is None: #if no local Resolution map is given,don't do any filtration
mean, var, _ = estimateNoiseFromMap(mapData, wn, boxCoord);
#if varianceMap is given, use it
if args.varianceMap is not None:
varMap = mrcfile.open(args.varianceMap, mode='r+');
......
......@@ -3,6 +3,7 @@ import subprocess
import math
import gc
import os
import sys
#Author: Maximilian Beckers, EMBL Heidelberg, Sachse Group
......@@ -48,7 +49,11 @@ def estimateNoiseFromMap(map, windowSize, boxCoord):
#estimate variance and mean from the sample
mean = np.mean(sampleMap);
var = np.var(sampleMap);
if var == 0.0:
print("Variance is estimated to be 0. You are probably estimating noise in a masked region. Exit ...")
sys.exit();
return mean, var, sampleMap;
#-------------------------------------------------------------------------------------
def estimateNoiseFromMapInsideMask(map, mask):
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment