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:
print(
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 stimulus_duration
or stimulus_name
.
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:
https://celltypes.brain-map.org/api/v2/data/Specimen/query.xml?criteria=model::Specimen,rma::criteria,%5Bid$eq464212183%5D,specimen_types%5Bid$eq305008011%5D,rma::include,donor(transgenic_lines%5Btransgenic_line_type_code$eq%27D%27%5D),structure,cell_soma_locations,ephys_features,ephys_sweeps,ephys_result(well_known_files),neuronal_models(neuronal_model_template,neuronal_model_runs(well_known_files%5Bwell_known_file_type_id$eq481007198%5D))
A simplified version of the query that would return just the information for the electrophysiology sweeps would be:
https://celltypes.brain-map.org/api/v2/data/Specimen/query.xml?criteria=model::Specimen,rma::criteria,%5Bid$eq464212183%5D,specimen_types%5Bid$eq305008011%5D,rma::include,ephys_sweeps
And again, for each sweep, you would look for entries like num-spikes
, stimulus-duration
, stimulus-absolute-amplitude
, and stimulus-name
to find the sweeps and information you’re after.
I hope that helps!