コード例 #1
0
from matplotlib.gridspec import GridSpec
from scipy.stats import entropy
import scipy.stats as stats

pvdfile = sys.argv[1]
tfilename = sys.argv[2]
mthresh = sys.argv[3]
dsname = sys.argv[4]

animal = dsname.split('/')[0]
recording_date = dsname.split('/')[1].split('_')[0]
recording_time = dsname.split('/')[1].split('_')[1]
cellname = tfilename.replace('./RawData/', '')
outcellname = dsname + '/' + cellname

ts, x, y = vu.readPVDfile(pvdfile)
x /= 8.2
xsmooth = np.abs(np.convolve(x, np.ones(100, dtype=np.int), 'valid')) / 100

#use later to detect direction
direction = np.where(np.diff(xsmooth) > 0, 1, 0)
#print("size of direction: ", np.size(direction))
#inotmoving and imoving are for entire recording
cum = np.cumsum(np.abs(np.diff(xsmooth)))

inotmoving = np.where(np.diff(cum) < .025)[0]
imoving = np.where(np.diff(cum) >= .025)[0]

print("reation")
print(np.size(inotmoving))
print(np.size(imoving))
コード例 #2
0
    l1.set_ydata(y_pix[current_frame:current_frame + 100])

    l2.set_color('g')
    l2.set_xdata(pvdx[current_frame:current_frame + 100])
    l2.set_ydata(pvdy[current_frame:current_frame + 100])

    print(int(current_frame))
    fig.canvas.draw_idle()


current_frame = 1
videofile = './RawData/VT1.Nvt'
pvdfile = './RawData/maze_dnTout.pvd'

x, y, ts = vu.getTrackerXY_Points(videofile)
x = x[79000:]
y = y[79000:]

x_pix = np.round(x / (np.max(x) / 640))
y_pix = np.round(y / (np.max(y) / 480))

pvdts, pvdx, pvdy = vu.readPVDfile(pvdfile)
fig, ax = plt.subplots()

l1, = plt.plot(x_pix, y_pix, '.', markersize=5, color='#FFE4C4')
l2, = plt.plot(pvdx, pvdy, '.', markersize=5, color='g')

cid = fig.canvas.mpl_connect('key_press_event', arrow_key_control)

plt.show()