def simulated_test(units, stimulus_list): # assert len(next(iter(units.values())).spike_train)==2200 test_pipeline = glia.compose(glia.f_create_experiments(stimulus_list), glia.f_has_stimulus_type(["GRATING"]), glia.f_group_by_stimulus(), glia.f_calculate_firing_rate_by_stimulus()) firing_rates = glia.apply_pipeline(test_pipeline, units, progress=True) for stimulus, rates in next(iter(firing_rates.values())).items(): for rate in rates: assert np.isclose(rate, 60, 1)
def save_unit_psth(units, stimulus_list, c_add_unit_figures, c_add_retina_figure, prepend, append): print("Creating solid unit PSTH") get_psth = glia.compose( glia.f_create_experiments(stimulus_list,prepend_start_time=prepend,append_lifespan=append), glia.f_has_stimulus_type(["SOLID"]), glia.f_group_by_stimulus(), glia.concatenate_by_stimulus ) psth = glia.apply_pipeline(get_psth,units) plot_function = partial(plot_psth,prepend_start_time=prepend,append_lifespan=append) result = glia.plot_units(partial(plot_function,bin_width=0.01),psth,ax_xsize=10, ax_ysize=5) c_add_unit_figures(result) glia.close_figs([fig for the_id,fig in result])
def simulated_test(units, stimulus_list): assert len(next(iter(units.values())).spike_train)==2200 test_pipeline = glia.compose( glia.f_create_experiments(stimulus_list), glia.f_has_stimulus_type(["GRATING"]), glia.f_group_by_stimulus(), glia.f_calculate_firing_rate_by_stimulus() ) firing_rates = glia.apply_pipeline(test_pipeline, units) for stimulus,rates in next(iter(firing_rates.values())).items(): for rate in rates: assert rate==1
def save_unit_psth(units, stimulus_list, c_unit_fig, c_add_retina_figure, prepend, append): print("Creating solid unit PSTH") get_psth = glia.compose( glia.f_create_experiments(stimulus_list,prepend_start_time=prepend,append_lifespan=append), glia.f_has_stimulus_type(["SOLID"]), glia.f_group_by_stimulus(), glia.concatenate_by_stimulus ) psth = glia.apply_pipeline(get_psth,units, progress=True) plot_function = partial(plot_psth,prepend_start_time=prepend,append_lifespan=append) result = glia.plot_units(partial(plot_function,bin_width=0.01),psth,ax_xsize=10, ax_ysize=5) c_unit_fig(result) glia.close_figs([fig for the_id,fig in result])
def get_fr_dsi_osi(units, stimulus_list): get_bar_firing_rate = glia.compose( glia.f_create_experiments(stimulus_list), glia.f_has_stimulus_type(["BAR"]), glia.f_group_by_stimulus(), glia.f_calculate_firing_rate_by_stimulus(), ) bar_firing_rate = glia.apply_pipeline(get_bar_firing_rate, units, progress=True) get_bar_dsi = glia.compose(glia.by_speed_width_then_angle, glia.calculate_dsi_by_speed_width) bar_dsi = glia.apply_pipeline(get_bar_dsi, bar_firing_rate, progress=True) get_bar_osi = glia.compose(glia.by_speed_width_then_angle, glia.calculate_osi_by_speed_width) bar_osi = glia.apply_pipeline(get_bar_osi, bar_firing_rate, progress=True) return (bar_firing_rate, bar_dsi, bar_osi)
def get_fr_dsi_osi(units, stimulus_list): get_bar_firing_rate = glia.compose( glia.f_create_experiments(stimulus_list), glia.f_has_stimulus_type(["BAR"]), glia.f_group_by_stimulus(), glia.f_calculate_firing_rate_by_stimulus(), ) bar_firing_rate = glia.apply_pipeline(get_bar_firing_rate,units) get_bar_dsi = glia.compose( glia.by_speed_width_then_angle, glia.calculate_dsi_by_speed_width ) bar_dsi = glia.apply_pipeline(get_bar_dsi,bar_firing_rate) get_bar_osi = glia.compose( glia.by_speed_width_then_angle, glia.calculate_osi_by_speed_width ) bar_osi = glia.apply_pipeline(get_bar_osi,bar_firing_rate) return (bar_firing_rate, bar_dsi, bar_osi)