This notebook shows some basic interaction with the .hdf5 files using the pandas library. The sample data was created using Picasso:Simulate. You can download the files here: http://picasso.jungmannlab.org/testdata.zip
In [1]:
# Import pandas and load localizations
import pandas as pd
locs = pd.read_hdf('testdata_locs.hdf5')
locs.head(5)
Out[1]:
In [2]:
# Summary statistics
locs.describe()
Out[2]:
In [3]:
# Plot some basic statistics using seaborn, i.e. photon distribution
import seaborn as sns
sns.set_style("white")
import matplotlib.pyplot as plt
sns.distplot(locs.photons.dropna(), kde=False)
plt.title('Photon distribution')
plt.show()
In [4]:
# load picked loaclizations
picked = pd.read_hdf('testdata_locs_picked.hdf5')
# Calculate mean of each column per group:
picked.groupby('group').mean().head(5)
Out[4]:
In [5]:
# Display a scatterplot of localizations of group 0
import numpy as np
# Select pick 0
pick_one = picked[picked.group==0]
# Scatterplot
plt.plot(pick_one['x'], pick_one['y'],'+')
plt.axis('equal')
plt.title('Scatterplot of Pick 0')
plt.xlabel('X')
plt.ylabel('Y')
plt.show()
# Time trace with photon values
xvec = np.arange(max(pick_one["frame"]) + 1)
yvec = xvec[:] * 0
yvec[pick_one["frame"]] = pick_one['photons']
plt.plot(xvec, yvec)
plt.title('Time Trace of Pick 0')
plt.xlabel('Frame')
plt.ylabel('Photons')
plt.show()
In [ ]: