@staticmethod<EOL><INDENT>def calc_fwhm(distribution, is_neg_log=True):<DEDENT>
if isinstance(distribution, interp1d):<EOL><INDENT>if is_neg_log:<EOL><INDENT>ymin = distribution.y.min()<EOL>log_prob = distribution.y-ymin<EOL><DEDENT>else:<EOL><INDENT>log_prob = -np.log(distribution.y)<EOL>log_prob -= log_prob.min()<EOL><DEDENT>xvals = distribution.x<EOL><DEDENT>elif isinstance(distribution, Distribution):<EOL><INDENT>xvals = distribution._func.x<EOL>log_prob = distribution._func.y<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>");<EOL><DEDENT>L = xvals.shape[<NUM_LIT:0>]<EOL>tmp = np.where(log_prob < <NUM_LIT>)[<NUM_LIT:0>]<EOL>x_l, x_u = tmp[<NUM_LIT:0>], tmp[-<NUM_LIT:1>]<EOL>if L < <NUM_LIT:2>:<EOL><INDENT>print ("<STR_LIT>")<EOL>return min(TINY_NUMBER, distribution.xmax - distribution.xmin)<EOL><DEDENT>else:<EOL><INDENT>return max(TINY_NUMBER, xvals[min(x_u+<NUM_LIT:1>,L-<NUM_LIT:1>)] - xvals[max(<NUM_LIT:0>,x_l-<NUM_LIT:1>)])<EOL><DEDENT>
Assess the width of the probability distribution. This returns
full-width-half-max