def calculate_power_hit_miss_locations(prm, data, channel):
    hit_data, miss_data = vr_split_data.split_all_data_hit_miss(prm, data)

    hit_data_ob, hit_data_rz, hit_data_hb = vr_track_location_analysis.split_locations(
        prm, hit_data)
    miss_data_ob, miss_data_rz, miss_data_hb = vr_track_location_analysis.split_locations(
        prm, miss_data)

    #plot power spectra
    #hit_data_theta = vr_track_location_analysis.add_theta_and_gamma_signal(prm, hit_data, hit_data)
    #miss_data_theta = vr_track_location_analysis.add_theta_and_gamma_signal(prm, miss_data, miss_data)

    #vr_track_location_plots.plot_power_spectrum_all_hitmiss(prm, hit_data_theta,miss_data_theta, channel)
    #vr_track_location_plots.plot_power_spectrum_all_hitmiss_gamma(prm, hit_data[:,5],miss_data[:,5], channel)
    #average area under curve etc for all stops
    hit_power_ob = get_gamma_per_window(prm, hit_data_ob[:, 5])
    hit_power_rz = get_gamma_per_window(prm, hit_data_rz[:, 5])
    hit_power_hb = get_gamma_per_window(prm, hit_data_hb[:, 5])
    miss_power_ob = get_gamma_per_window(prm, miss_data_ob[:, 5])
    miss_power_rz = get_gamma_per_window(prm, miss_data_rz[:, 5])
    miss_power_hb = get_gamma_per_window(prm, miss_data_hb[:, 5])
    vr_power_calculations_plots.plot_gamma_power_hit_miss_locations(
        prm, hit_power_ob, miss_power_ob, hit_power_rz, miss_power_rz,
        hit_power_hb, miss_power_hb, channel)

    hit_power_ob = get_gamma_per_window(prm, hit_data_ob[:, 4])
    hit_power_rz = get_gamma_per_window(prm, hit_data_rz[:, 4])
    hit_power_hb = get_gamma_per_window(prm, hit_data_hb[:, 4])
    miss_power_ob = get_gamma_per_window(prm, miss_data_ob[:, 4])
    miss_power_rz = get_gamma_per_window(prm, miss_data_rz[:, 4])
    miss_power_hb = get_gamma_per_window(prm, miss_data_hb[:, 4])
    vr_power_calculations_plots.plot_theta_power_hit_miss_locations(
        prm, hit_power_ob, miss_power_ob, hit_power_rz, miss_power_rz,
        hit_power_hb, miss_power_hb, channel)
Esempio n. 2
0
def process_movement_and_stationary_locations(prm, before_stop, after_stop,
                                              channel):
    #before/after power spectra at different locations
    #split based on location
    before_stop_outbound, before_stop_rewardzone, before_stop_homebound = vr_track_location_analysis.split_locations(
        prm, before_stop)
    after_stop_outbound, after_stop_rewardzone, after_stop_homebound = vr_track_location_analysis.split_locations(
        prm, after_stop)
    # make example power spectras
    vr_track_location_analysis.stop_start_power_spectra_locations(
        prm, before_stop_outbound, before_stop_rewardzone,
        before_stop_homebound, after_stop_outbound, after_stop_rewardzone,
        after_stop_homebound, channel)  # FIGURE 2 B :
    # pull data from whole recording
    vr_power_calculations.calculate_and_plot_pooled_gamma_power_stop_start_locations(
        prm, after_stop_outbound, after_stop_rewardzone, after_stop_homebound,
        before_stop_outbound, before_stop_rewardzone, before_stop_homebound,
        channel)
    # plot example continuous data
    vr_track_location_plots.make_stop_start_locations_continuous_plot(
        prm, channel, after_stop_outbound, after_stop_rewardzone,
        after_stop_homebound, before_stop_outbound, before_stop_rewardzone,
        before_stop_homebound)

    return before_stop_outbound, before_stop_rewardzone, before_stop_homebound, after_stop_outbound, after_stop_rewardzone, after_stop_homebound
def calculate_power_speed_hit_miss_locations(prm, data, channel):
    hit_data, miss_data = vr_split_data.split_all_data_hit_miss(prm, data)

    hit_data_ob, hit_data_rz, hit_data_hb = vr_track_location_analysis.split_locations(
        prm, hit_data)
    miss_data_ob, miss_data_rz, miss_data_hb = vr_track_location_analysis.split_locations(
        prm, miss_data)

    speed_hit_ob = get_average_speed(prm, hit_data_ob[:, 6])
    speed_hit_rz = get_average_speed(prm, hit_data_rz[:, 6])
    speed_hit_hb = get_average_speed(prm, hit_data_hb[:, 6])
    speed_miss_ob = get_average_speed(prm, miss_data_ob[:, 6])
    speed_miss_rz = get_average_speed(prm, miss_data_rz[:, 6])
    speed_miss_hb = get_average_speed(prm, miss_data_hb[:, 6])
    gamma_power_hit_ob = get_gamma_per_window(prm, hit_data_ob[:, 5])
    gamma_power_hit_rz = get_gamma_per_window(prm, hit_data_rz[:, 5])
    gamma_power_hit_hb = get_gamma_per_window(prm, hit_data_hb[:, 5])
    gamma_power_miss_ob = get_gamma_per_window(prm, miss_data_ob[:, 5])
    gamma_power_miss_rz = get_gamma_per_window(prm, miss_data_rz[:, 5])
    gamma_power_miss_hb = get_gamma_per_window(prm, miss_data_hb[:, 5])
    theta_power_hit_ob = get_gamma_per_window(prm, hit_data_ob[:, 4])
    theta_power_hit_rz = get_gamma_per_window(prm, hit_data_rz[:, 4])
    theta_power_hit_hb = get_gamma_per_window(prm, hit_data_hb[:, 4])
    theta_power_miss_ob = get_gamma_per_window(prm, miss_data_ob[:, 4])
    theta_power_miss_rz = get_gamma_per_window(prm, miss_data_rz[:, 4])
    theta_power_miss_hb = get_gamma_per_window(prm, miss_data_hb[:, 4])

    #plot gamma
    hit_data_ob = np.vstack((speed_hit_ob, gamma_power_hit_ob))
    hit_data_ob = np.transpose(hit_data_ob)
    miss_data_ob = np.vstack((speed_miss_ob, gamma_power_miss_ob))
    miss_data_ob = np.transpose(miss_data_ob)
    hit_data_rz = np.vstack((speed_hit_rz, gamma_power_hit_rz))
    hit_data_rz = np.transpose(hit_data_rz)
    miss_data_rz = np.vstack((speed_miss_rz, gamma_power_miss_rz))
    miss_data_rz = np.transpose(miss_data_rz)
    hit_data_hb = np.vstack((speed_hit_hb, gamma_power_hit_hb))
    hit_data_hb = np.transpose(hit_data_hb)
    miss_data_hb = np.vstack((speed_miss_hb, gamma_power_miss_hb))
    miss_data_hb = np.transpose(miss_data_hb)
    bins_hit_ob, speed_bins_hit_ob = bin_speed_data(prm, hit_data_ob)
    bins_hit_rz, speed_bins_hit_rz = bin_speed_data(prm, hit_data_rz)
    bins_hit_hb, speed_bins_hit_hb = bin_speed_data(prm, hit_data_hb)
    bins_miss_ob, speed_bins_miss_ob = bin_speed_data(prm, miss_data_ob)
    bins_miss_rz, speed_bins_miss_rz = bin_speed_data(prm, miss_data_rz)
    bins_miss_hb, speed_bins_miss_hb = bin_speed_data(prm, miss_data_hb)
    vr_power_calculations_plots.plot_gamma_power_speed_hit_miss_locations(
        prm, bins_hit_ob, speed_bins_hit_ob, bins_miss_ob, speed_bins_miss_ob,
        bins_hit_rz, speed_bins_hit_rz, bins_miss_rz, speed_bins_miss_rz,
        bins_hit_hb, speed_bins_hit_hb, bins_miss_hb, speed_bins_miss_hb,
        channel)