import numpy as np import numpy as np import matplotlib.pylab as plt import scipy.signal as signal from analysis import smooth from console import utils as ndaq # Get data and items data = ndaq.get_data() items = ndaq.get_items() dt = items[0].attrs['dt'] dt = .04 # Get peaks, decays and peak times decayTimes = [] for trace in data: peak = trace.min() decay = peak*0.37 peakTime = trace.argmin() decayTrace = trace[peakTime:] idx = decayTrace<decay decayTime = np.sum(idx)*dt #plt.plot(decayTrace[idx]) print decayTime decayTimes.append(decayTime) #plt.show() ndaq.store_data(decayTimes, name='decay_times')
# temp script to tranform velocity traces into something useful import numpy as np from analysis import smooth from console import utils as ndaq # Parameters posThs = 1.66 negThs = 1.62 final_smth_window = 100 # Get data and items data = ndaq.get_data() item = ndaq.get_items() dt = item[0].attrs['dt'] # Smooth data = smooth.smooth(data, window_len=4, window='hanning') # Threshold detection functions compPositive = lambda a, b: a > b compNegative = lambda a, b: a < b # Go through data i = 0 eStart, eEnd = [], [] while i < len(data): if compPositive(data[i], posThs): eStart.append(i) while i < len(data) and compPositive(data[i], posThs - 0.02): i += 1
import numpy as np import matplotlib.pylab as plt import scipy.signal as signal from analysis import smooth from console import utils as ndaq # Add single PSCs at a defined frequency and number # Get data and items data = ndaq.get_data() items = ndaq.get_items() dt = items[0].attrs['dt'] dt = 0.04 # Lag traces and add them number = 20 freq = 20. isi = 1 / freq * 1000 # in ms result = [] for n in range(number): trace = data npad = int(n * isi / dt) laggedTrace = np.pad(trace, (npad, 0), 'constant', constant_values=(0, 0)) #if n>0: laggedTrace = laggedTrace[:-npad] result.append(laggedTrace) maxshape = result[len(result) - 1].shape alignedTraces = [] c = 0 for trace in result:
# temp script to tranform velocity traces into something useful import numpy as np from analysis import smooth from console import utils as ndaq # Parameters posThs = 1.66 negThs = 1.62 final_smth_window = 100 # Get data and items data = ndaq.get_data() item = ndaq.get_items() dt = item[0].attrs['dt'] # Smooth data = smooth.smooth(data, window_len=4, window='hanning') # Threshold detection functions compPositive = lambda a, b: a > b compNegative = lambda a, b: a < b # Go through data i = 0 eStart, eEnd = [], [] while i<len(data): if compPositive(data[i], posThs): eStart.append(i) while i<len(data) and compPositive(data[i], posThs-0.02): i+=1