Created
August 15, 2017 17:47
-
-
Save dyf/4b2bf5a0a1131fc721e52569bc6c5bcc to your computer and use it in GitHub Desktop.
find eye tracking experiments
This file contains 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 allensdk.core.brain_observatory_cache import BrainObservatoryCache | |
from allensdk.config import enable_console_log | |
from allensdk.api.queries.rma_api import RmaApi | |
import matplotlib.pyplot as plt | |
# print out API queries | |
enable_console_log() | |
# download experiments with passing eye tracking | |
results = RmaApi().model_query('OphysExperiment', | |
criteria="[fail_eye_tracking$eqfalse]", | |
num_rows=1000) | |
exp_ids = [ r['id'] for r in results ] | |
# make cache object | |
boc = BrainObservatoryCache(manifest_file='boc/manifest.json') | |
# download one experiment at random | |
ds = boc.get_ophys_experiment_data(exps[0]['id']) | |
# plot XY | |
ts, xy = ds.get_pupil_location() | |
_, sz = ds.get_pupil_size() | |
plt.plot(ts, xy[:, 0], label='x') | |
plt.plot(ts, xy[:, 1], label='y') | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment