Difficulty downloading tuning curve data through API

brain-observatory-visual-coding
api
how-to
#1

Hi everyone,
I think it’s really cool that you are putting all these data online. I would like to use it for a class I am teaching in which I introduce students to the brain. I would like them to download some tuning curves. The problem is that the data somehow never get downloaded. I am using the following code (adapted from the documentation):

from allensdk.core.brain_observatory_cache import BrainObservatoryCache
boc = BrainObservatoryCache(manifest_file=‘boc/manifest.json’)
import pandas as pd
cell_specimen_id = 541512399
stimulus = ‘drifting_gratings’

get the whole database

cell_specimens = pd.DataFrame(boc.get_cell_specimens())

get the correct cell from the database

expt_id = cell_specimens[cell_specimens.cell_specimen_id==cell_specimen_id].experiment_container_id.values[0]

find the sessions belonging to drifting gratings

session_id = boc.get_ophys_experiments(stimuli=[stimulus],experiment_container_ids=[expt_id])[0][‘id’]
print(“Opening NWB file for ophys session. This will take several minutes if the file isn’t downloaded yet.”)
Here it gets stuck and takes more than 45 minutes and still the data are not downloaded. I am wondering what is happening here.
Any help would be appreciated!
Many thanks,
Marieke

#2

Hi Marieke,

I’m sorry you’re having difficulty with this. I don’t have a good answer for you. I copied your code directly and ran it on my machine, and it ran pretty quickly. If the “get the whole database” line has not been run on your machine previous, that step can be slow, but on my machine it was ~5 minutes. But other than that, none of those steps should be very slow. This could be a connection issue.

You might have better luck accessing the data on AWS so that there is no downloading required. There is information here about how to access this: