Пример #1
0
#plt.show()

# Measure threshold crossings
signal = ephys.apply_probe_map_to_amplifier(clean)
num_channels = len(signal)
spike_times = [[] for _ in range(num_channels)]  
spike_peaks = [[] for _ in range(num_channels)]  

for channel in np.arange(num_channels):

    try:
        # Extract data for single channel
        channel_data = signal[channel,:]
        
        # FILTERS (one ch at the time)
        channel_data_highpass = ephys.highpass(channel_data,BUTTER_ORDER=3, F_HIGH=14250,sampleFreq=30000.0,passFreq=500)
    
        # Determine high and low threshold
        abs_channel_data_highpass = np.abs(channel_data_highpass)
        sigma_n = np.median(abs_channel_data_highpass) / 0.6745
        
        #adaptive th depending of ch noise
        spike_threshold_hard = -3.0 * sigma_n
        spike_threshold_soft = -1.0 * sigma_n
        
        # Find threshold crossings
        spike_start_times, spike_stop_times = threshold_crossing(channel_data_highpass,spike_threshold_hard,spike_threshold_soft)    
        
        # Find peak voltages and times
        spike_peak_voltages = []
        spike_peak_times = []
Пример #2
0
# Measure stats for each channel
for ch in range(128):

    # Report
    print("Starting channel {0}".format(ch))

    # Extract channel data and convert to uV (float32)
    data_ch = data[ch, :]
    data_ch_uV = (data_ch.astype(np.float32) - 32768) * 0.195
    print("- converted to uV")

    # High-pass filter at 500 Hz
    highpass_ch_uV = ephys.highpass(data_ch_uV,
                                    BUTTER_ORDER=3,
                                    F_HIGH=14250,
                                    sampleFreq=30000.0,
                                    passFreq=500)
    print("- highpassed")

    # Determine RMS noise after filtering
    abs_highpass_ch_uV = np.abs(highpass_ch_uV)
    sigma_n = np.median(abs_highpass_ch_uV) / 0.6745
    print("- Noise sigma measured")

# Measure RMS of each channel (in uV) and save
# Make example plots...of unfiltered and high-pass filtered data
# Should compare this with both "cleaned" and raw data

#FIN
Пример #3
0
highcut= 52

wo50 = ephys.butter_bandstop(raw_uV,lowcut, highcut, fs=30000, order=3, btype='bandstop')
plt.plot(wo50[:150000],alpha = 0.4)


raw_diff = raw_uV - wo50
cleaned_diff = cleaned_uV - wo50

plt.plot(raw_diff[:150000],alpha = 0.4)
plt.plot(cleaned_diff[:150000],alpha = 0.4)


# highpass

highpass_cleaned = ephys.highpass(wo50,BUTTER_ORDER=3, F_HIGH=14250,sampleFreq=30000.0,passFreq=500)
plt.plot(highpass_cleaned[:150000],alpha = 0.4)





#lowpass
lowcut = 250

lowpass_cleaned = ephys.butter_filter_lowpass(wo50,lowcut, fs=30000, order=3, btype='lowpass')
plt.plot(lowpass_cleaned[:150000],alpha = 0.4)