@@ -494,7 +494,7 @@ def empirical_neg_log_prior(Dt0, Fp0, Dp0, S00=None):
494494 # define the prior
495495 def neg_log_prior (p ):
496496 # depends on whether S0 is fitted or not
497- if len (p ) is 4 :
497+ if len (p ) == 4 :
498498 Dt , Fp , Dp , S0 = p [0 ], p [1 ], p [2 ], p [3 ]
499499 else :
500500 Dt , Fp , Dp = p [0 ], p [1 ], p [2 ]
@@ -507,7 +507,7 @@ def neg_log_prior(p):
507507 Dt_prior = stats .lognorm .pdf (Dt , Dt_shape , scale = Dt_scale )
508508 Fp_prior = stats .beta .pdf (Fp , Fp_a , Fp_b )
509509 # determine and return the prior for D, f and D* (and S0)
510- if len (p ) is 4 :
510+ if len (p ) == 4 :
511511 S0_prior = stats .beta .pdf (S0 / 2 , S0_a , S0_b )
512512 return - np .log (Dp_prior + eps ) - np .log (Dt_prior + eps ) - np .log (Fp_prior + eps ) - np .log (
513513 S0_prior + eps )
@@ -525,7 +525,7 @@ def neg_log_likelihood(p, bvalues, dw_data):
525525 :param dw_data: 1D Array diffusion-weighted data
526526 :returns: the log-likelihood of the parameters given the data
527527 """
528- if len (p ) is 4 :
528+ if len (p ) == 4 :
529529 return 0.5 * (len (bvalues ) + 1 ) * np .log (
530530 np .sum ((ivim (bvalues , p [0 ], p [1 ], p [2 ], p [3 ]) - dw_data ) ** 2 )) # 0.5*sum simplified
531531 else :
0 commit comments