當前位置: 首頁>>代碼示例>>Python>>正文


Python FmriData.from_simulation_dict方法代碼示例

本文整理匯總了Python中pyhrf.FmriData.from_simulation_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python FmriData.from_simulation_dict方法的具體用法?Python FmriData.from_simulation_dict怎麽用?Python FmriData.from_simulation_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyhrf.FmriData的用法示例。


在下文中一共展示了FmriData.from_simulation_dict方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    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_bold(self.tmp_dir, spatial_size='random_small')
        self.data_simu = FmriData.from_simulation_dict(simu)
開發者ID:ainafp,項目名稱:pyhrf,代碼行數:10,代碼來源:test_jde_vem_tools.py

示例2: test_hrf_with_var_sampler_2

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def test_hrf_with_var_sampler_2(self):
        # estimation of HRF and its variance tested in the following situation:
        #    -  simulated gaussian smooth HRF is not normalized

        pyhrf.verbose.set_verbosity(2)

        simu = simulate_bold(self.tmp_dir, spatial_size='small',
                             normalize_hrf=False)
        simu = FmriData.from_simulation_dict(simu)

        self._test_specific_samplers(['HRFVariance','HRF'], simu_scenario=simu,
                                     check_fv='print', nb_its=100,
                                     hrf_prior_type='voxelwiseIID')
開發者ID:Solvi,項目名稱:pyhrf,代碼行數:15,代碼來源:valid_jde_bold_mono_subj_sess.py

示例3: test_hrf_var_sampler

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def test_hrf_var_sampler(self):

        # estimation of HRF variance tested in the following situation:
        #    -  simulated gaussian smooth HRF is not normalized
        #       -> else the simulated HRF variance is not consistent

        pyhrf.verbose.set_verbosity(2)

        simu = simulate_bold(self.tmp_dir, spatial_size='small',
                             normalize_hrf=False)
        simu = FmriData.from_simulation_dict(simu)

        self._test_specific_samplers(['HRFVariance'], simu_scenario=simu,
                                     check_fv='raise', nb_its=100,
                                     hrf_prior_type='singleHRF')
開發者ID:Solvi,項目名稱:pyhrf,代碼行數:17,代碼來源:valid_jde_bold_mono_subj_sess.py

示例4: test_default_jde_small_simulation

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    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()
開發者ID:pyhrf,項目名稱:pyhrf,代碼行數:20,代碼來源:jdetest.py

示例5: test_default_jde_small_simulation

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def test_default_jde_small_simulation(self):
        """ Test ASL Physio sampler on small simulation with small nb of
        iterations. Estimation accuracy is not tested.
        """
        pyhrf.verbose.set_verbosity(0)

        sampler_params = {
            jde_asl_physio.ASLPhysioSampler.P_NB_ITERATIONS : 100,
            jde_asl_physio.ASLPhysioSampler.P_SMPL_HIST_PACE : 1,
            jde_asl_physio.ASLPhysioSampler.P_OBS_HIST_PACE : 1,
            'brf' : jde_asl_physio.PhysioBOLDResponseSampler(zero_constraint=False),
            'brf_var' : jde_asl_physio.PhysioBOLDResponseVarianceSampler(val_ini=\
                                                                         np.array([1e-3])),
            'prf' : jde_asl_physio.PhysioPerfResponseSampler(zero_constraint=False),
            'prf_var' : jde_asl_physio.PhysioPerfResponseVarianceSampler(val_ini=\
                                                                         np.array([1e-3])),
            'noise_var' : jde_asl_physio.NoiseVarianceSampler(),
            'drift_var' : jde_asl_physio.DriftVarianceSampler(),
            'drift_coeff' : jde_asl_physio.DriftCoeffSampler(),
            'brl' : jde_asl_physio.BOLDResponseLevelSampler(),
            'prl' : jde_asl_physio.PerfResponseLevelSampler(),
            'bold_mixt_params' : jde_asl_physio.BOLDMixtureSampler(),
            'perf_mixt_params' : jde_asl_physio.PerfMixtureSampler(),
            'label' : jde_asl_physio.LabelSampler(),
            'perf_baseline' : jde_asl_physio.PerfBaselineSampler(),
            'perf_baseline_var' : jde_asl_physio.PerfBaselineVarianceSampler(),
            'assert_final_value_close_to_true' : False,
        }


        sampler = jde_asl_physio.ASLPhysioSampler(sampler_params)

        simu_items = phym.simulate_asl_physio_rfs(spatial_size='random_small')
        simu_fdata = FmriData.from_simulation_dict(simu_items)

        dt = simu_items['dt']
        analyser = JDEMCMCAnalyser(sampler=sampler, osfMax=4, dtMin=.4,
                                   dt=dt, driftParam=4, driftType='polynomial',
                                   outputFile=None,outputPrefix='jde_mcmc_',
                                   randomSeed=None)

        treatment = FMRITreatment(fmri_data=simu_fdata, analyser=analyser)
        treatment.run()
開發者ID:Solvi,項目名稱:pyhrf,代碼行數:45,代碼來源:jdetest.py

示例6: test_default_jde_small_simulation

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def test_default_jde_small_simulation(self):
        """ Test ASL Physio sampler on small simulation with small nb of
        iterations. Estimation accuracy is not tested.
        """
        pyhrf.verbose.set_verbosity(0)

        sampler_params = {
            'nb_iterations' : 3,
            'smpl_hist_pace' : 1,
            'obs_hist_pace' : 1,
            'brf' : jde_asl_physio.PhysioBOLDResponseSampler(zero_constraint=False),
            'brf_var' : jde_asl_physio.PhysioBOLDResponseVarianceSampler(val_ini=\
                                                                         np.array([1e-3])),
            'prf' : jde_asl_physio.PhysioPerfResponseSampler(zero_constraint=False),
            'prf_var' : jde_asl_physio.PhysioPerfResponseVarianceSampler(val_ini=\
                                                                         np.array([1e-3])),
            'noise_var' : jde_asl_physio.NoiseVarianceSampler(),
            'drift_var' : jde_asl_physio.DriftVarianceSampler(),
            'drift' : jde_asl_physio.DriftCoeffSampler(),
            'bold_response_levels' : jde_asl_physio.BOLDResponseLevelSampler(),
            'perf_response_levels' : jde_asl_physio.PerfResponseLevelSampler(),
            'bold_mixt_params' : jde_asl_physio.BOLDMixtureSampler(),
            'perf_mixt_params' : jde_asl_physio.PerfMixtureSampler(),
            'labels' : jde_asl_physio.LabelSampler(),
            'perf_baseline' : jde_asl_physio.PerfBaselineSampler(),
            'perf_baseline_var' : jde_asl_physio.PerfBaselineVarianceSampler(),
            'check_final_value' : None,
        }


        sampler = jde_asl_physio.ASLPhysioSampler(**sampler_params)

        simu_items = phym.simulate_asl_physio_rfs(spatial_size='random_small')
        simu_fdata = FmriData.from_simulation_dict(simu_items)

        dt = simu_items['dt']
        analyser = JDEMCMCAnalyser(sampler=sampler, osfMax=4, dtMin=.4,
                                   dt=dt, driftParam=4, driftType='polynomial',
                                   outputPrefix='jde_mcmc_')

        treatment = FMRITreatment(fmri_data=simu_fdata, analyser=analyser,
                                  output_dir=None)
        treatment.run()
開發者ID:pmesejo,項目名稱:pyhrf,代碼行數:45,代碼來源:jdetest.py

示例7: test_full_sampler

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def test_full_sampler(self):
        """ Test JDE on simulation with normal size.
        Estimation accuracy is tested.
        """
        # pyhrf.verbose.set_verbosity(2)
        pyhrf.logger.setLevel(logging.INFO)

        simu = simulate_bold(self.tmp_dir, spatial_size='normal',
                             normalize_hrf=False)
        simu = FmriData.from_simulation_dict(simu)

        sampler = BG(self.sampler_params_for_full_test)

        analyser = JDEMCMCAnalyser(sampler=sampler, osfMax=4, dtMin=.4,
                                   dt=.5, driftParam=4, driftType='polynomial',
                                   outputPrefix='jde_mcmc_',
                                   randomSeed=None)

        treatment = FMRITreatment(fmri_data=simu,
                                  analyser=analyser, output_dir=self.tmp_dir)

        treatment.run()
        print 'output_dir:', self.tmp_dir
開發者ID:ainafp,項目名稱:pyhrf,代碼行數:25,代碼來源:valid_jde_bold_mono_subj_sess.py

示例8: setUp

# 需要導入模塊: from pyhrf import FmriData [as 別名]
# 或者: from pyhrf.FmriData import from_simulation_dict [as 別名]
    def setUp(self):
        np.random.seed(8652761)
        tmpDir = tempfile.mkdtemp(prefix='pyhrf_tests',
                                  dir=pyhrf.cfg['global']['tmp_path'])
        self.tmp_dir = tmpDir
        self.clean_tmp = True
        bf = 'subj0_bold_session0.nii.gz'
        self.boldFiles = [pyhrf.get_data_file_name(bf)]
        pf = 'subj0_parcellation.nii.gz'
        self.parcelFile = pyhrf.get_data_file_name(pf)
        self.tr = 2.4
        self.dt = .6
        self.onsets = pyhrf.paradigm.onsets_loc_av
        self.durations = None
        self.nbIt = 3
        self.pfMethod = 'es'

        simu = simulate_bold(self.tmp_dir, spatial_size='random_small')
        self.data_simu = FmriData.from_simulation_dict(simu)

        self.sampler_params_for_single_test = {
            'nb_iterations': 100,
            'smpl_hist_pace': 1,
            'obs_hist_pace': 1,
            # level of spatial correlation = beta
            'beta': BS({
                'do_sampling': False,
                'use_true_value': False,
                'val_ini': np.array([0.6]),
            }),
            # HRF
            'hrf': HS({
                'do_sampling': False,
                'use_true_value': True,
                'prior_type': 'singleHRF',
            }),
            # HRF variance
            'hrf_var': HVS({
                'use_true_value': True,
                'do_sampling': False,
            }),
            # neural response levels (stimulus-induced effects)
            'nrl': NS({
                'use_true_nrls': True,
                'use_true_labels': True,
                'do_sampling': False,
                'do_label_sampling': False,
            }),
            'mixt_params': BGMS({
                'do_sampling': False,
                'use_true_value': True,
            }),
            'noise_var': NoiseVarianceSampler({
                'do_sampling': False,
                'use_true_value': True,
            }),
            'check_final_value_close_to_true': 'raise',  # print or raise
        }

        self.sampler_params_for_full_test = {
            'nb_iterations': 500,
            'smpl_hist_pace': 1,
            'obs_hist_pace': 1,
            # level of spatial correlation = beta
            'beta': BS({
                'do_sampling': True,
                'use_true_value': False,
                'val_ini': np.array([0.6]),
            }),
            # HRF
            'hrf': HS({
                'do_sampling': True,
                'use_true_value': False,
                'normalise': 1.,
            }),
            # HRF variance
            'hrf_var': HVS({
                'use_true_value': False,
                'do_sampling': True,
            }),
            # neural response levels (stimulus-induced effects)
            'nrl': NS({
                'use_true_nrls': False,
                'use_true_labels': False,
                'do_sampling': True,
                'do_label_sampling': True,
            }),
            'mixt_params': BGMS({
                'do_sampling': True,
                'use_true_value': False,
            }),
            'noise_var': NoiseVarianceSampler({
                'do_sampling': True,
                'use_true_value': False,
            }),
            'check_final_value_close_to_true': 'print',  # print or raise
        }
開發者ID:pyhrf,項目名稱:pyhrf,代碼行數:99,代碼來源:jdetest.py


注:本文中的pyhrf.FmriData.from_simulation_dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。