Esempio n. 1
0
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.rcParams[
    'animation.ffmpeg_path'] = "C:\\Users\\IntelligentSystem\[email protected]\george\Code\Python\ExtraRequirements\\ffmpeg-20140618-git-7f52960-win64-static\\bin\\ffmpeg.exe"

fn_adc = "C:\George\Data\ECoG_Chronic_Recordings\\2014_08_06_Jpak65_Anesthesia_PawStimulation_Electrical\\2014_08_06_JPak65_PawStimulation_BackRight_200uA_2ms_ADC.bin"
fn_amp = "C:\George\Data\ECoG_Chronic_Recordings\\2014_08_06_Jpak65_Anesthesia_PawStimulation_Electrical\\2014_08_06_JPak65_PawStimulation_BackRight_200uA_2ms_Amp.bin"

sampling_freq = 20000
threshold = 10000
filt_cutoff_freq = None
minduration = 10
pick_out_or_in = True

data_raw_events = tl.load_raw_event_trace(fn_adc,
                                          number_of_channels=1,
                                          dtype=np.uint16)
event_times, event_values = tl.create_piezosensor_events(
    data_raw_events.dataMatrix, threshold, sampling_freq, filt_cutoff_freq,
    minduration, pick_out_or_in)

data_raw_amp = tl.load_raw_data(fn_amp, 128)
sub_tl_data, sub_tl_avg_data, sub_time_axis = tl.time_lock_raw_data(
    data_raw_amp.dataMatrix,
    event_times,
    times_to_cut=[-2, 2],
    sampling_freq=sampling_freq,
    baseline_time=[-0.5, 0],
    sub_sample_freq=1000)
#sub_tl_hp_data, sub_tl_hp_avg_data, sub_time_axis = tl.time_lock_raw_data(data_raw_amp.dataMatrix, event_times, times_to_cut=[-2, 2], sampling_freq=sampling_freq, baseline_time=[-0.5, 0], high_pass_cutoff=400, rectify=False, sub_sample_freq=1000)
#sub_tl_hpr_data, sub_tl_hpr_avg_data, sub_time_axis = tl.time_lock_raw_data(data_raw_amp.dataMatrix, event_times, times_to_cut=[-2, 2], sampling_freq=sampling_freq, baseline_time=[-0.5, 0], high_pass_cutoff=400, rectify=True, sub_sample_freq=1000)
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.rcParams['animation.ffmpeg_path'] = "C:\\Users\\IntelligentSystem\[email protected]\george\Code\Python\ExtraRequirements\\ffmpeg-20140618-git-7f52960-win64-static\\bin\\ffmpeg.exe"
import mne as mne


sampling_freq = 30000


#Cell 1
fn_adc_c1 = "C:\\George\\Data\\ECoG_Juxta_Paired_Recordings\\2014_12_05_Jpak77\\2014_12_05_Jpak77_JuxtaCell1_ADC_Cell1.bin"
fn_amp_c1 = "C:\\George\\Data\\ECoG_Juxta_Paired_Recordings\\2014_12_05_Jpak77\\2014_12_05_Jpak77_JuxtaCell1_Amp_Cell1.bin"

threshold = 0.0003
cell_1_data_raw_spikes = tl.load_raw_event_trace(fn_adc_c1, number_of_channels=8, channel_used=0, dtype=np.uint16)
cell_1_event_times, cell_1_eventdata_in_V = tl.create_spike_triggered_events(cell_1_data_raw_spikes.dataMatrix, threshold = threshold, inter_spike_time_distance=0.001, amp_gain=1000,
                                  sampling_freq=sampling_freq, amp_y_digitization=65536, amp_y_range=10)

cell_1_event_times = cell_1_event_times[1:-120]
cell_1_data_raw_amp = tl.load_raw_data(fn_amp_c1, 64)


cell_1_tl_sub_reref_avg, sub_time_axis = tl.time_lock_raw_data(cell_1_data_raw_amp.dataMatrix, cell_1_event_times, times_to_cut=[-0.2, 0.2], sampling_freq=sampling_freq,
                                                               baseline_time=[-0.2, -0.05], sub_sample_freq=2000, avg_reref = True, keep_trials=False)


x_of_bad_channels = np.array([19, 136, 214, 87, 516])  #For 420 spikes average
y_of_bad_channels = np.array([88, 68, 94, -119, 64])
cell_1_tl_sub_reref_avg_nbc, bad_channels_cell_1_tl_sub_reref_avg = bad_channel_removal(x_of_bad_channels, y_of_bad_channels, cell_1_tl_sub_reref_avg)
pf.plot_video_topoplot(cell_1_tl_sub_reref_avg_nbc, sub_time_axis, pf.grid_layout_64channels(bad_channels_cell_1_tl_sub_reref_avg), times_to_plot = [-0.06, 0.1],
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
plt.rcParams[
    'animation.ffmpeg_path'] = "C:\\Users\\IntelligentSystem\[email protected]\george\Code\Python\ExtraRequirements\\ffmpeg-20140618-git-7f52960-win64-static\\bin\\ffmpeg.exe"
import mne as mne

sampling_freq = 30000

#Cell 1
fn_adc_c1 = "C:\\George\\Data\\ECoG_Juxta_Paired_Recordings\\2014_12_05_Jpak77\\2014_12_05_Jpak77_JuxtaCell1_ADC_Cell1.bin"
fn_amp_c1 = "C:\\George\\Data\\ECoG_Juxta_Paired_Recordings\\2014_12_05_Jpak77\\2014_12_05_Jpak77_JuxtaCell1_Amp_Cell1.bin"

threshold = 0.0003
cell_1_data_raw_spikes = tl.load_raw_event_trace(fn_adc_c1,
                                                 number_of_channels=8,
                                                 channel_used=0,
                                                 dtype=np.uint16)
cell_1_event_times, cell_1_eventdata_in_V = tl.create_spike_triggered_events(
    cell_1_data_raw_spikes.dataMatrix,
    threshold=threshold,
    inter_spike_time_distance=0.001,
    amp_gain=1000,
    sampling_freq=sampling_freq,
    amp_y_digitization=65536,
    amp_y_range=10)

cell_1_event_times = cell_1_event_times[1:-120]
cell_1_data_raw_amp = tl.load_raw_data(fn_amp_c1, 64)

cell_1_tl_sub_reref_avg, sub_time_axis = tl.time_lock_raw_data(
    cell_1_data_raw_amp.dataMatrix,
import matplotlib.animation as animation
plt.rcParams['animation.ffmpeg_path'] = "C:\\Users\\IntelligentSystem\[email protected]\george\Code\Python\ExtraRequirements\\ffmpeg-20140618-git-7f52960-win64-static\\bin\\ffmpeg.exe"



fn_adc = "C:\George\Data\ECoG_Chronic_Recordings\\2014_08_06_Jpak65_Anesthesia_PawStimulation_Electrical\\2014_08_06_JPak65_PawStimulation_BackRight_200uA_2ms_ADC.bin"
fn_amp = "C:\George\Data\ECoG_Chronic_Recordings\\2014_08_06_Jpak65_Anesthesia_PawStimulation_Electrical\\2014_08_06_JPak65_PawStimulation_BackRight_200uA_2ms_Amp.bin"


sampling_freq = 20000
threshold = 10000
filt_cutoff_freq = None
minduration = 10
pick_out_or_in = True

data_raw_events = tl.load_raw_event_trace(fn_adc, number_of_channels= 1, dtype=np.uint16)
event_times, event_values = tl.create_piezosensor_events(data_raw_events.dataMatrix, threshold, sampling_freq, filt_cutoff_freq, minduration, pick_out_or_in)

data_raw_amp = tl.load_raw_data(fn_amp, 128)
sub_tl_data, sub_tl_avg_data, sub_time_axis = tl.time_lock_raw_data(data_raw_amp.dataMatrix, event_times, times_to_cut=[-2, 2], sampling_freq=sampling_freq, baseline_time=[-0.5, 0], sub_sample_freq=1000)
#sub_tl_hp_data, sub_tl_hp_avg_data, sub_time_axis = tl.time_lock_raw_data(data_raw_amp.dataMatrix, event_times, times_to_cut=[-2, 2], sampling_freq=sampling_freq, baseline_time=[-0.5, 0], high_pass_cutoff=400, rectify=False, sub_sample_freq=1000)
#sub_tl_hpr_data, sub_tl_hpr_avg_data, sub_time_axis = tl.time_lock_raw_data(data_raw_amp.dataMatrix, event_times, times_to_cut=[-2, 2], sampling_freq=sampling_freq, baseline_time=[-0.5, 0], high_pass_cutoff=400, rectify=True, sub_sample_freq=1000)


fn_adc2 = "C:\George\Data\ECoG_Chronic_Recordings\\14_06_03_Jpak65_Anesthesia_Stimulations\\14_06_03_stimulation_manual_paw_qtip2\stim.bin"
fn_amp2 = "C:\George\Data\ECoG_Chronic_Recordings\\14_06_03_Jpak65_Anesthesia_Stimulations\\14_06_03_stimulation_manual_paw_qtip2\\amplifier.bin"

sampling_freq = 8000
threshold = 1e7
filt_cutoff_freq = 1000
minduration = 100