def test_brls(self): """ Validate estimation of BRLs at high SNR""" pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['bold_response_levels'], fdata, nb_its=100, check_fv='raise')
def test_prf(self): """ Validate estimation of PRF """ pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['prf'], fdata, nb_its=100, check_fv='raise')
def setUp(self): np.random.seed(8652761) tmpDir = tempfile.mkdtemp(prefix='pyhrf_tests', dir=pyhrf.cfg['global']['tmp_path']) self.tmp_dir = tmpDir simu = simulate_asl(self.tmp_dir, spatial_size='random_small') self.data_simu = FmriData.from_simulation_dict(simu)
def test_noise_var(self): """ Validate estimation of noise variances at high SNR""" pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['noise_var'], fdata, nb_its=100, check_fv='raise')
def test_brf_physio_reg(self): """ Validate estimation of BRF at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['brf'], fdata, nb_its=100, check_fv='raise')
def test_prf(self): """ Validate estimation of PRF """ # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_parameters(['prf'], fdata, simu, nItMax=20, estimateG=True)
def test_perf_baseline(self): """ Validate estimation of drift at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['perf_baseline'], fdata, nb_its=100, check_fv='raise')
def test_prls(self): """ Validate estimation of PRLs at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_parameters(['perf_response_levels'], fdata, simu, nItMax=100, estimateC=True)
def test_brf_physio_reg(self): """ Validate estimation of BRF at high SNR""" pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['brf'], fdata, nb_its=100, check_fv='raise') print 'pyhrf_view_qt3 %s/*brf*nii' %self.tmp_dir
def test_perf_baseline(self): """ Validate estimation of drift at high SNR""" pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['perf_baseline'], fdata, nb_its=100, check_fv='raise') print 'pyhrf_view_qt3 %s/*perf*nii' %self.tmp_dir
def test_prf_var(self): """ Validate estimation of PRF """ # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['prf_var'], fdata, nb_its=20, check_fv='raise')
def test_noise_var(self): """ Validate estimation of noise variances at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir) fdata = FmriData.from_simulation_dict(simu) self._test_specific_parameters(['noise_var'], fdata, simu, nItMax=100, estimateNoise=True) print 'pyhrf_view %s/*noise*nii' % self.tmp_dir
def test_sigmaG(self): """ Validate estimation of drift at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) self._test_specific_parameters(['sigma_G'], fdata, simu, nItMax=100, estimateSigmaG=True) print 'pyhrf_view %s/*mixt_params*perf*nii' % self.tmp_dir
def test_brf_physio_nonreg(self): """ Validate estimation of BRF at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['brf'], fdata, nb_its=100, check_fv='raise', rf_prior_type='physio_stochastic_not_regularized')
def test_prf_physio_det(self): """ Validate estimation of BRF at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') print simu['prf'].shape fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['prf'], fdata, nb_its=100, check_fv='raise', rf_prior_type='physio_deterministic')
def test_prf_physio_nonreg(self): """ Validate estimation of BRF at high SNR""" pyhrf.verbose.set_verbosity(2) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') print simu['prf'].shape fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['prf'], fdata, nb_its=100, check_fv='raise', rf_prior_type='physio_stochastic_not_regularized') print 'pyhrf_view_qt3 %s/*prf*nii' %self.tmp_dir
def test_all(self): """ Validate estimation of full ASL model at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) np.random.seed(25430) v = ['bold_response_levels', 'perf_response_levels', 'drift', 'drift_var', 'brf', 'brf_var', 'prf', 'labels', 'bold_mixt_params', 'perf_mixt_params', 'perf_baseline', 'perf_baseline_var'] self._test_specific_samplers(v, fdata, nb_its=500, check_fv='print')
def test_perfusion(self): """ Validate estimation of perfusion component at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) np.random.seed(25430) v = ['perf_response_levels', 'prf'] mem.cache(self._test_specific_parameters)(v, fdata, simu, nItMax=100, estimateG=True, estimateC=True, estimateSigmaG=True) print 'pyhrf_view %s/*nii' % self.tmp_dir
def test_perf_baseline_var(self): """ Validate estimation of drift at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') perf_baseline = simu['perf_baseline'] perf_baseline_mean = simu['perf_baseline_mean'] print 'perf_baseline_mean = ', perf_baseline_mean print 'perf_baseline_mean emp = ', np.mean(perf_baseline) perf_baseline_var = simu['perf_baseline_var'] print 'perf_baseline_var = ', perf_baseline_var print 'perf_baseline_var emp = ', np.var(perf_baseline) fdata = FmriData.from_simulation_dict(simu) self._test_specific_samplers(['perf_baseline_var'], fdata, nb_its=15, check_fv='raise')
def test_default_jde_small_simulation(self): """ Test ASL sampler on small simulation with small nb of iterations. Estimation accuracy is not tested. """ simu = simulate_asl(spatial_size='random_small') fdata = FmriData.from_simulation_dict(simu) sampler = jde_asl.ASLSampler() analyser = JDEMCMCAnalyser(sampler=sampler, osfMax=4, dtMin=.4, dt=.5, driftParam=4, driftType='polynomial', outputPrefix='jde_mcmc_', randomSeed=None) treatment = FMRITreatment(fmri_data=fdata, analyser=analyser, output_dir=None) treatment.run()
def test_all(self): """ Validate estimation of full ASL model at high SNR""" # pyhrf.verbose.set_verbosity(2) pyhrf.logger.setLevel(logging.INFO) from pyhrf.jde.asl import simulate_asl simu = simulate_asl(self.tmp_dir, spatial_size='normal') fdata = FmriData.from_simulation_dict(simu) np.random.seed(25430) v = ['bold_response_levels', 'perf_response_levels', 'brf', 'brf_var', 'prf', 'labels', 'bold_mixt_params', 'perf_mixt_params', 'drift_perf_baseline'] self._test_specific_parameters(v, fdata, simu, estimateSigmaH=False, nItMax=100, nItMin=10, estimateBeta=True, estimateSigmaG=True, PLOT=False, constrained=True, fast=False, estimateH=True, estimateG=True, estimateA=True, estimateC=True, estimateZ=True, estimateLA=True, estimateMP=True) print 'pyhrf_view %s/*nii' % self.tmp_dir
def test_simulation(self): # pyhrf.verbose.set_verbosity(0) pyhrf.logger.setLevel(logging.WARNING) simulate_asl(spatial_size='random_small')
def test_simulation(self): pyhrf.verbose.set_verbosity(0) simulate_asl(spatial_size='random_small')
def test_simulation(self): simulate_asl(spatial_size='random_small')