In [38]:
import numpy as np
import numpy.ma as ma
import brain_diffusion.msd as msd
import brain_diffusion.histogram_utils as huts
import matplotlib.pyplot as plt
In [8]:
DIR = '../data/'
file = 'sample_data'
In [11]:
!ls ../data/
In [9]:
total1, frames, x_m, y_m, xs_m, ys_m = msd.MSD_iteration(DIR, file)
In [23]:
time = np.linspace(0, frames, frames+1)
print('Total number of particles: ', total1)
print('Total frames in video: ', frames)
In [18]:
x_m[0:10, 0:4]
Out[18]:
In [29]:
geoM2xy, gSEM, SM1x, SM1y, SM2xy = msd.vectorized_MMSD_calcs(frames, total1, xs_m, ys_m)
In [51]:
SM2xy_name = 'sample_SM2xy_data.csv'
np.savetxt(SM2xy_name, SM2xy, delimiter=',')
In [28]:
%matplotlib inline
In [42]:
yhi = 40
plt.figure()
plt.plot(time[1:], np.exp(geoM2xy), color='k')
plt.plot(time[1:], np.exp(geoM2xy+gSEM), color='lightgray')
plt.plot(time[1:], np.exp(geoM2xy-gSEM), color='lightgray')
plt.ylim(0, yhi)
Out[42]:
In [45]:
plt.figure()
for part in range(0, total1):
plt.plot(time[1:], ma.masked_equal(SM2xy[:, part], 0), color='k', alpha=0.2)
plt.ylim(0, yhi)
Out[45]:
In [56]:
huts.histogram_by_video(SM2xy_name, fps=10, y_range=30)
Out[56]:
In [57]:
!rm sample*png
!rm sample_csv
In [ ]: