Skip to content
Snippets Groups Projects
Commit 07cdd3b5 authored by Lukas Bentkamp's avatar Lukas Bentkamp
Browse files

Adding min_estimate to read_histogram

parent 72c8795e
Branches
Tags
1 merge request!132Feature: min estimates for histogram ranges
Pipeline #238296 failed
......@@ -301,6 +301,7 @@ def read_histogram(
base_group = 'statistics',
pp_file = None,
iteration_range = None,
min_estimate = None,
max_estimate = None,
niter_stat = None,
nbins = None,
......@@ -326,6 +327,17 @@ def read_histogram(
if (hh.shape[-1] == 4):
hh = hh[..., :3]
max_estimate /= 3**0.5
if type(min_estimate) == type(None):
if quantity[:5] == 'log2_':
if 'min_' + quantity[5:] + '_estimate' in self.parameters:
min_estimate = np.log2(self.parameters['min_' + quantity[5:] + '_estimate'])
else:
min_estimate = -max_estimate # for compatibility with old data sets
else:
if 'min_' + quantity + '_estimate' in self.parameters:
min_estimate = self.parameters['min_' + quantity + '_estimate']
else:
min_estimate = -max_estimate # for compatibility with old data sets
ngrid = self.parameters['nx']*self.parameters['ny']*self.parameters['nz']
if return_full_history:
npoints_expected = ngrid
......@@ -334,7 +346,7 @@ def read_histogram(
npoints_expected = ngrid*hh.shape[0]
hh = np.sum(hh, axis = 0)
npoints = np.sum(hh, axis = 0, keepdims=True)
bb0 = np.linspace(-max_estimate, max_estimate, nbins+1)
bb0 = np.linspace(min_estimate, max_estimate, nbins+1)
bb = (bb0[1:] + bb0[:-1])*0.5
if (undersample_warning_on):
if not (npoints == npoints_expected).all():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment