#NEWLINE# def check_normalization( distfn , args , distname ) : #NEWLINE# #INDENT# norm_moment = distfn . moment ( 0 , * args ) #NEWLINE# npt . assert_allclose ( norm_moment , 1.0 ) #NEWLINE# if ( distname == 'ncf' ) : #NEWLINE# #INDENT# ( atol , rtol ) = ( 1e-05 , 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( atol , rtol ) = ( 1e-07 , 1e-07 ) #NEWLINE# #UNINDENT# normalization_expect = distfn . expect ( ( lambda x : 1 ) , args = args ) #NEWLINE# npt . assert_allclose ( normalization_expect , 1.0 , atol = atol , rtol = rtol , err_msg = distname , verbose = True ) #NEWLINE# normalization_cdf = distfn . cdf ( distfn . b , * args ) #NEWLINE# npt . assert_allclose ( normalization_cdf , 1.0 )