def do_main_analysis(spike_times, spike_times_optimization, spike_times_validation, analysis_file, settings): """ Determine the history dependence of a neuron's activity based on spike time data. """ utl.save_spike_times_stats(analysis_file, spike_times, **settings) if settings['cross_validated_optimization']: settings['cross_val'] = 'h1' # first half of the data utl.save_history_dependence_for_embeddings(analysis_file, spike_times_optimization, **settings) settings['cross_val'] = 'h2' # second half of the data utl.save_history_dependence_for_embeddings(analysis_file, spike_times_validation, **settings) utl.compute_CIs(analysis_file, spike_times, target_R='R_max', **settings) else: settings['cross_val'] = None utl.save_history_dependence_for_embeddings(analysis_file, spike_times, **settings) utl.compute_CIs(analysis_file, spike_times, target_R='R_max', **settings)
def compute_CIs(spike_times, analysis_file, settings): """ Compute bootstrap replications of the history-dependence estimate which can be used to obtain confidence intervals. """ if settings['cross_validated_optimization']: settings['cross_val'] = 'h2' # second half of the data else: settings['cross_val'] = None utl.compute_CIs(analysis_file, spike_times, target_R='R_tot', **settings) utl.compute_CIs(analysis_file, spike_times, target_R='nonessential', **settings)
def test_history_dependence_estimation(): estimator_env.settings['cross_val'] = None for estimation_method in ['bbc', 'shuffling']: estimator_env.settings['estimation_method'] = estimation_method utl.save_history_dependence_for_embeddings(estimator_env.analysis_file, estimator_env.spike_times, **estimator_env.settings) utl.compute_CIs(estimator_env.analysis_file, estimator_env.spike_times, target_R='R_max', **estimator_env.settings) utl.create_CSV_files(estimator_env.analysis_file, estimator_env.csv_stats_file, estimator_env.csv_histdep_data_file, estimator_env.csv_auto_MI_data_file, estimator_env.analysis_num, **estimator_env.settings) check_parameters()