def _bin_edges_helper(p_dict): bin_edges = core.bin_edges(**p_dict) assert_almost_equal(0, np.ptp(np.diff(bin_edges))) if 'nbins' in p_dict: nbins = p_dict['nbins'] assert_equal(nbins + 1, len(bin_edges)) if 'step' in p_dict: step = p_dict['step'] assert_almost_equal(step, np.diff(bin_edges)) if 'range_max' in p_dict: range_max = p_dict['range_max'] assert_true(np.all(bin_edges <= range_max)) if 'range_min' in p_dict: range_min = p_dict['range_min'] assert_true(np.all(bin_edges >= range_min)) if 'range_max' in p_dict and 'step' in p_dict: step = p_dict['step'] range_max = p_dict['range_max'] assert_true((range_max - bin_edges[-1]) < step)
def _bin_edges_exceptions(param_dict): core.bin_edges(**param_dict)