Last active
December 27, 2015 19:28
-
-
Save ralphpeterson/7376871 to your computer and use it in GitHub Desktop.
Script to find the percentage of good frames
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pymouse import hdf | |
| import numpy as np | |
| import os | |
| store = hdf.HDFStorage("/Users/DattaLab/Desktop/repackedh5s/6-18-13 25% 2, 5-DMP in DPG.h5") | |
| variables_to_load = ["mouse_name","frame_id","good_frame"] | |
| my_query = None | |
| scalars,arrays = store.select(variables=variables_to_load, query=my_query, experiments=store.experiments[:]) | |
| #gives the percentage (decimal) of good frames in an experiment | |
| def experiment_good_frame(name): | |
| index = scalars['mouse_name'].str.contains(name) | |
| this_good_frame = scalars['good_frame'][index] | |
| return (np.sum(this_good_frame)) / float(len(scalars['frame_id'][index])) | |
| for mouse_name in store.experiments: | |
| print "%s, %f" % (mouse_name,experiment_good_frame(mouse_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment