In [1]:
%reload_ext XTIPython
import numpy as np
In [2]:
%imaris_pull spots
Out[2]:
In [3]:
sv = spots.values()[0] #We should only have one ISPots object in the dictionary, so let's pull it.
The spots returned from Imaris are associated with a unique timepoint. This data is returned by sv.GetIndicesT().
Counting the number of instances for each timepoint gives the "number of cells vs time" data we are after.
We can do this through a loop, or there is a numpy function we can use to do this. np.unique() counts the unique number of instances in an array:
In [4]:
tpindexes, nspots = np.unique(sv.GetIndicesT(), return_counts=True)
If we want to display the actual timepoints instead of their indexes, there's a way to do this using BridgeLib (timepoints returned in second, starting from 0):
In [5]:
tps = BridgeLib.GetTimepoints(vDataSet,tpindexes)
print tps
NOTE: In this case, the timepoints are separated by exactly 1s, this may not always be the case!
In [6]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_axes([1,1,1,1])
ax.plot(tps,nspots)
ax.set_xlabel('Time (seconds)')
ax.set_ylabel('Number of cells')
ax.set_title('Number of spots vs Time')
Out[6]:
In [ ]: