@@ -185,7 +185,7 @@ class ConcToPKP(Fitter):
185
185
186
186
Subclass of Fitter.
187
187
"""
188
- def __init__ (self , pk_model , pk_pars_0 = None , weights = None ):
188
+ def __init__ (self , pk_model , pk_pars_0 = None , weights = None , check_ve_vp_sum = True ):
189
189
"""
190
190
Args:
191
191
pk_model (PkModel): Pharmacokinetic model used to predict tracer
@@ -200,6 +200,8 @@ def __init__(self, pk_model, pk_pars_0=None, weights=None):
200
200
for sum-of-squares calculation. Can be used to "exclude" data
201
201
points from optimisation. Defaults to equal weighting for all
202
202
points.
203
+ check_ve_vp_sum (bool, optional): Whether to check if sum of ve and vp >=1.
204
+ If condition is met, outputs will be set to NaN. Defaults to True.
203
205
"""
204
206
self .pk_model = pk_model
205
207
if pk_pars_0 is None :
@@ -210,6 +212,7 @@ def __init__(self, pk_model, pk_pars_0=None, weights=None):
210
212
self .weights = np .ones (pk_model .n )
211
213
else :
212
214
self .weights = weights
215
+ self .check_ve_vp_sum = check_ve_vp_sum
213
216
# Convert initial pars from list of dicts to list of arrays
214
217
self .x_0_all = [pk_model .pkp_array (pars ) for pars in self .pk_pars_0 ]
215
218
@@ -244,7 +247,8 @@ def proc(self, C_t):
244
247
f'Unable to calculate pharmacokinetic parameters'
245
248
f': { result .message } ' )
246
249
pk_pars_opt = self .pk_model .pkp_dict (result .x )
247
- check_ve_vp_sum (pk_pars_opt )
250
+ if self .check_ve_vp_sum :
251
+ check_ve_vp_sum (pk_pars_opt )
248
252
Ct_fit , _C_cp , _C_e = self .pk_model .conc (* result .x )
249
253
Ct_fit [self .weights == 0 ] = np .nan
250
254
return tuple (result .x ) + (Ct_fit ,)
@@ -269,7 +273,7 @@ class EnhToPKP(Fitter):
269
273
R2 and R2* effects neglected.
270
274
"""
271
275
def __init__ (self , hct , pk_model , t10_blood , c_to_r_model , water_ex_model ,
272
- signal_model , pk_pars_0 = None , weights = None ):
276
+ signal_model , pk_pars_0 = None , weights = None , check_ve_vp_sum = True ):
273
277
"""
274
278
Args:
275
279
hct (float): Capillary haematocrit
@@ -295,6 +299,8 @@ def __init__(self, hct, pk_model, t10_blood, c_to_r_model, water_ex_model,
295
299
sum-of-squares calculation. Can be used to "exclude" data
296
300
points from optimisation. Defaults to equal weighting for all
297
301
points.
302
+ check_ve_vp_sum (bool, optional): Whether to check if sum of ve and vp >=1.
303
+ If condition is met, outputs will be set to NaN. Defaults to True.
298
304
"""
299
305
self .hct = hct
300
306
self .pk_model = pk_model
@@ -310,6 +316,7 @@ def __init__(self, hct, pk_model, t10_blood, c_to_r_model, water_ex_model,
310
316
self .weights = np .ones (pk_model .n )
311
317
else :
312
318
self .weights = weights
319
+ self .check_ve_vp_sum = check_ve_vp_sum
313
320
# Convert initial pars from list of dicts to list of arrays
314
321
self .x_0_all = [pk_model .pkp_array (pars ) for pars in self .pk_pars_0 ]
315
322
@@ -349,7 +356,8 @@ def proc(self, enh, k_fa, t10_tissue):
349
356
f'Unable to calculate pharmacokinetic parameters'
350
357
f': { result .message } ' )
351
358
pk_pars_opt = self .pk_model .pkp_dict (result .x )
352
- check_ve_vp_sum (pk_pars_opt )
359
+ if self .check_ve_vp_sum :
360
+ check_ve_vp_sum (pk_pars_opt )
353
361
enh_fit = pkp_to_enh (pk_pars_opt , self .hct , k_fa , t10_tissue ,
354
362
self .t10_blood , self .pk_model , self .c_to_r_model ,
355
363
self .water_ex_model , self .signal_model )
0 commit comments