I have a question regarding the calculation of spontaneous firing rates using the ecephys_session tutorial. In the instructions it is stated: ‘The gray period stimulus (just a blank gray screen) never gets a block.’ Yet, when I filter for the ‘spontaneous’ epochs, it looks like multiple epochs of gray screen are acquired throughout the session but the stimulus block value is set to ‘null’ for all blocks.
I tried using the tutorial to calculate the firing rates but for ‘spontaneous’ the firing rates go off the charts compared to ‘drifting grating’ etc. I assume that this is due to the fact that all spontaneous epochs have the same Stimulus_ID across the ‘null’ blocks, which is set to 0. While the stimulus_presentation_id seems to be unique across the different spontaneous epochs, the stimulus_condition_id is actually 0 for all entries. I would appreciate any feedback on whether it is possible to use the ‘spontaneous’ epoch as a filter due the stimulus ID as it’s done for ‘drifting gratings’ in the tutorial. Is there a specific reason that all spontaneous’ epochs have been assigned a ‘null’ value for the blocks?
Hi @Sarruedi1! First of all, I just want to make sure you’re aware that you can pull out a stimulus table for the spontaneous epochs using the following code:
The reason we don’t assign a block index to the spontaneous epochs is because it’s technically not a block of stimuli, but instead represents the gap between stimulus blocks. Each spontaneous epoch still has a stimulus_presentation_id, though, so it can be uniquely identified.
To calculate the firing rate within a particular spontaneous epoch, you would just count the spikes between the start_time and stop_time for that epoch, then divide by the value in the duration column. To get the overall spontaneous firing rate, you can compute the average firing rate across all epochs.
If you’re using conditionwise_spike_statistics to calculate firing rates, you need to specify use_rates=True, so it normalizes by the duration of each epoch. Maybe this explains why the spontaneous firing rates seemed abnormally high?
Hi Josh, Thank you for the feedback! In the meantime, I figured out how to get the ‘start_time’ and ‘stop_time’. I haven’t used conditionwise_spike_statistics yet, so thanks for the tip regarding this method.