You are correct that
ef__avg_firing_rate is calculated from a single sweep. In the electrophysiology white paper, there’s a section that says how that sweep is selected (which it seems like you may have already seen, but just for clarity):
Cell-wide spike train features were based on a representative suprathreshold sweep that was chosen by selecting the lowest amplitude long square sweep with a stimulus amplitude between 40 pA and 60 pA higher than rheobase.
As you said, though, we do calculate the number of spikes for every sweep (which is how the f-I curve is calculated). You can access that information in a couple of ways.
One way you can do it is via the Allen SDK software package. Here’s an example of getting that information for an example cell (specimen ID 464212183):
# Use the CellTypesCache object to access the data
from allensdk.core.cell_types_cache import CellTypesCache
ctc = CellTypesCache()
# Get a list of information about all the sweeps for the example cell
my_specimen_id = 464212183
ephys_sweep_info = ctc.get_ephys_sweeps(specimen_id=my_specimen_id)
# ephys_sweep_info is a list of dictionaries - one for each sweep
# we can loop through and print relevant information about each one
for swp_info in ephys_sweep_info:
swp_info["sweep_number"], # sweep number
swp_info["stimulus_duration"], # duration in seconds
swp_info["stimulus_name"], # readable name of stimulus
swp_info["stimulus_absolute_amplitude"], # amplitude in pA
swp_info["num_spikes"] # number of spikes found in the sweep
That will return information about all the sweeps, so you will need to filter to just the one-second-long “Long Square” sweeps to get the ones used to construct the f-I curve. You can do that by filtering on things like
As an alternative to the Allen SDK, you can also use the API to access the data. This is the same thing you see if you click the “This data is also available as XML” link at the bottom of each electrophysiology details page. A query for that same example cell looks like this:
A simplified version of the query that would return just the information for the electrophysiology sweeps would be:
And again, for each sweep, you would look for entries like
stimulus-absolute-amplitude , and
stimulus-name to find the sweeps and information you’re after.
I hope that helps!