@@ -494,7 +494,7 @@ def empirical_neg_log_prior(Dt0, Fp0, Dp0, S00=None):
494
494
# define the prior
495
495
def neg_log_prior (p ):
496
496
# depends on whether S0 is fitted or not
497
- if len (p ) is 4 :
497
+ if len (p ) == 4 :
498
498
Dt , Fp , Dp , S0 = p [0 ], p [1 ], p [2 ], p [3 ]
499
499
else :
500
500
Dt , Fp , Dp = p [0 ], p [1 ], p [2 ]
@@ -507,7 +507,7 @@ def neg_log_prior(p):
507
507
Dt_prior = stats .lognorm .pdf (Dt , Dt_shape , scale = Dt_scale )
508
508
Fp_prior = stats .beta .pdf (Fp , Fp_a , Fp_b )
509
509
# determine and return the prior for D, f and D* (and S0)
510
- if len (p ) is 4 :
510
+ if len (p ) == 4 :
511
511
S0_prior = stats .beta .pdf (S0 / 2 , S0_a , S0_b )
512
512
return - np .log (Dp_prior + eps ) - np .log (Dt_prior + eps ) - np .log (Fp_prior + eps ) - np .log (
513
513
S0_prior + eps )
@@ -525,7 +525,7 @@ def neg_log_likelihood(p, bvalues, dw_data):
525
525
:param dw_data: 1D Array diffusion-weighted data
526
526
:returns: the log-likelihood of the parameters given the data
527
527
"""
528
- if len (p ) is 4 :
528
+ if len (p ) == 4 :
529
529
return 0.5 * (len (bvalues ) + 1 ) * np .log (
530
530
np .sum ((ivim (bvalues , p [0 ], p [1 ], p [2 ], p [3 ]) - dw_data ) ** 2 )) # 0.5*sum simplified
531
531
else :
0 commit comments