Fork me on GitHub

pyhrf.jde.asl_physio_det_fwdm module

Physio prior, deterministic version where fwd model is changed TODO: clean to remove stochastic parts

class pyhrf.jde.asl_physio_det_fwdm.ASLPhysioSampler(nb_iterations=3000, obs_hist_pace=-1.0, glob_obs_hist_pace=-1, smpl_hist_pace=-1.0, burnin=0.3, callback=<pyhrf.jde.samplerbase.GSDefaultCallbackHandler object>, bold_response_levels=<pyhrf.jde.asl_physio_det_fwdm.BOLDResponseLevelSampler object>, perf_response_levels=<pyhrf.jde.asl_physio_det_fwdm.PerfResponseLevelSampler object>, labels=<pyhrf.jde.asl_physio_det_fwdm.LabelSampler object>, noise_var=<pyhrf.jde.asl_physio_det_fwdm.NoiseVarianceSampler object>, brf=<pyhrf.jde.asl_physio_det_fwdm.PhysioBOLDResponseSampler object>, brf_var=<pyhrf.jde.asl_physio_det_fwdm.PhysioBOLDResponseSampler object>, prf=<pyhrf.jde.asl_physio_det_fwdm.PhysioPerfResponseSampler object>, prf_var=<pyhrf.jde.asl_physio_det_fwdm.PhysioPerfResponseSampler object>, bold_mixt_params=<pyhrf.jde.asl_physio_det_fwdm.BOLDMixtureSampler object>, perf_mixt_params=<pyhrf.jde.asl_physio_det_fwdm.PerfMixtureSampler object>, drift=<pyhrf.jde.asl_physio_det_fwdm.DriftCoeffSampler object>, drift_var=<pyhrf.jde.asl_physio_det_fwdm.DriftVarianceSampler object>, perf_baseline=<pyhrf.jde.asl_physio_det_fwdm.PerfBaselineSampler object>, perf_baseline_var=<pyhrf.jde.asl_physio_det_fwdm.PerfBaselineVarianceSampler object>, check_final_value=None)

Bases: pyhrf.xmlio.Initable, pyhrf.jde.samplerbase.GibbsSampler

computeFit()
default_nb_its = 3000
finalizeSampling()
getGlobalOutputs()
inputClass

alias of WN_BiG_ASLSamplerInput

parametersToShow = ['nb_its', 'response_levels', 'hrf', 'hrf_var']
class pyhrf.jde.asl_physio_det_fwdm.BOLDMixtureSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.MixtureParamsSampler, pyhrf.xmlio.Initable

get_true_values_from_simulation_cdefs(cdefs)
class pyhrf.jde.asl_physio_det_fwdm.BOLDResponseLevelSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseLevelSampler, pyhrf.xmlio.Initable

computeVarYTildeOpt(update_perf=False)

if update_perf is True then also update sumcXg and prl.ytilde update_perf should only be used at init of variable values.

getOutputs()
samplingWarmUp(v)
class pyhrf.jde.asl_physio_det_fwdm.DriftCoeffSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
compute_y_tilde()
getOutputs()
linkToData(dataInput)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

updateNorm()
class pyhrf.jde.asl_physio_det_fwdm.DriftVarianceSampler(val_ini=array([ 1.]), do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
linkToData(dataInput)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.asl_physio_det_fwdm.LabelSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

CLASSES = array([0, 1])
CLASS_NAMES = ['inactiv', 'activ']
L_CA = 1
L_CI = 0
checkAndSetInitValue(variables)
compute_ext_field()
countLabels()
linkToData(dataInput)
sampleNextInternal(v)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

samplingWarmUp(v)

Called before the launch of the main sampling loop by the sampler engine. Should be overriden and perform precalculations.

class pyhrf.jde.asl_physio_det_fwdm.MixtureParamsSampler(name, response_level_name, val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

I_MEAN_CA = 0
I_VAR_CA = 1
I_VAR_CI = 2
L_CA = 1
L_CI = 0
NB_PARAMS = 3
PARAMS_NAMES = ['Mean_Activ', 'Var_Activ', 'Var_Inactiv']
checkAndSetInitValue(variables)
computeWithJeffreyPriors(j, cardCIj, cardCAj)
get_current_means()
get_current_vars()
get_true_values_from_simulation_dict()
linkToData(dataInput)
sampleNextInternal(variables)
class pyhrf.jde.asl_physio_det_fwdm.NoiseVarianceSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
compute_y_tilde()
linkToData(dataInput)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.asl_physio_det_fwdm.PerfBaselineSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
compute_residuals()
compute_wa(a=None)
linkToData(dataInput)
sampleNextInternal(v)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.asl_physio_det_fwdm.PerfBaselineVarianceSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
linkToData(dataInput)
sampleNextInternal(v)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.asl_physio_det_fwdm.PerfMixtureSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.MixtureParamsSampler, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
get_true_values_from_simulation_cdefs(cdefs)
class pyhrf.jde.asl_physio_det_fwdm.PerfResponseLevelSampler(val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseLevelSampler, pyhrf.xmlio.Initable

checkAndSetInitValue(variables)
computeVarYTildeOpt()
class pyhrf.jde.asl_physio_det_fwdm.PhysioBOLDResponseSampler(smooth_order=2, zero_constraint=True, duration=25.0, normalise=1.0, val_ini=None, do_sampling=True, use_true_value=False, use_omega=True, deterministic=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseSampler, pyhrf.xmlio.Initable

computeYTilde()

y - sum cWXg - Pl - wa

get_mat_X()
get_mat_XtWX()
get_mat_XtX()
get_stackX()
sampleNextInternal(variables)

Sample BRF

changes to mean: changes to var:

samplingWarmUp(variables)

Called before the launch of the main sampling loop by the sampler engine. Should be overriden and perform precalculations.

class pyhrf.jde.asl_physio_det_fwdm.PhysioBOLDResponseVarianceSampler(val_ini=array([ 0.001]), do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseVarianceSampler, pyhrf.xmlio.Initable

sampleNextInternal(v)

Sample variance of BRF

TODO: change code below –> no changes necessary so far

class pyhrf.jde.asl_physio_det_fwdm.PhysioPerfResponseSampler(smooth_order=2, zero_constraint=True, duration=25.0, normalise=1.0, val_ini=None, do_sampling=True, use_true_value=False, diff_res=True, regularize=True, deterministic=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseSampler, pyhrf.xmlio.Initable

computeYTilde()

y - sum aXh - Pl - wa

get_mat_X()
get_mat_XtX()
get_stackX()
sampleNextInternal(variables)

Sample PRF with physio prior

changes to mean: add a factor of Omega h Sigma_g^-1 v_g^-1

samplingWarmUp(variables)

Called before the launch of the main sampling loop by the sampler engine. Should be overriden and perform precalculations.

class pyhrf.jde.asl_physio_det_fwdm.PhysioPerfResponseVarianceSampler(val_ini=array([ 0.001]), do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.asl_physio_det_fwdm.ResponseVarianceSampler, pyhrf.xmlio.Initable

sampleNextInternal(v)

Sample variance of PRF

changes:
  • mu_g = omega h
  • new beta calculation, based on physio_inspired prior
samplingWarmUp(variables)

Called before the launch of the main sampling loop by the sampler engine. Should be overriden and perform precalculations.

class pyhrf.jde.asl_physio_det_fwdm.ResponseLevelSampler(name, response_name, mixture_name, val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

checkAndSetInitValue(variables)
computeRR()
computeVarYTildeOpt()
linkToData(dataInput)
sampleNextInternal(variables)
samplingWarmUp(variables)
class pyhrf.jde.asl_physio_det_fwdm.ResponseSampler(name, response_level_name, variance_name, smooth_order=2, zero_constraint=True, duration=25.0, normalise=1.0, val_ini=None, do_sampling=True, use_true_value=False, deterministic=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

Generic parent class to perfusion response & BOLD response samplers

calcXResp(resp, stackX=None)
checkAndSetInitValue(variables)
computeYTilde()
get_mat_X()
get_mat_XtX()
get_rlrl()
get_stackX()
get_ybar()
linkToData(dataInput)
sampleNextInternal(variables)
setFinalValue()
updateNorm()
updateXResp()
class pyhrf.jde.asl_physio_det_fwdm.ResponseVarianceSampler(name, response_name, val_ini=None, do_sampling=True, use_true_value=False)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

checkAndSetInitValue(v)
linkToData(dataInput)
sampleNextInternal(v)
class pyhrf.jde.asl_physio_det_fwdm.WN_BiG_ASLSamplerInput(data, dt, typeLFD, paramLFD, hrfZc, hrfDuration)

Bases: pyhrf.jde.models.WN_BiG_Drift_BOLDSamplerInput

cleanPrecalculations()
makePrecalculations()
pyhrf.jde.asl_physio_det_fwdm.b()
pyhrf.jde.asl_physio_det_fwdm.compute_StS_StY(rls, v_b, mx, mxtx, ybar, rlrl, yaj, ajak_vb)

yaj and ajak_vb are only used to store intermediate quantities, they’re not inputs.

pyhrf.jde.asl_physio_det_fwdm.compute_StS_StY_deterministic(brls, prls, v_b, mx, mxtx, mx_perf, mxtx_perf, mxtwx, ybar, rlrl_bold, rlrl_perf, brlprl, yj, ajak_vb, cjck_vb, omega, W)

yaj and ajak_vb are only used to store intermediate quantities, they’re not inputs.

pyhrf.jde.asl_physio_det_fwdm.compute_bRpR(brl, prl, nbConditions, nbVoxels)