On/off ratios for full field flashes not computed (shows nan values)

I was looking to access some precomputed metrics on the visual coding datasets, specifically the on/off ratio for units computed during full field flash stimuli.
The page I am basing this off of is https://allensdk.readthedocs.io/en/latest/visual_coding_neuropixels.html

However, after loading the metadata in (using the standard method to create a cache and download metadata), I found that the on/off ratio appears to not have actually been computed, and instead all the values in that column are nan.

To be clear, I used the following commands to access both stimulus sets
analysis_metrics1 = cache.get_unit_analysis_metrics_by_session_type(‘brain_observatory_1.1’)

analysis_metrics2 = cache.get_unit_analysis_metrics_by_session_type(‘functional_connectivity’)

I can see numbers computed for all the other prestimulus metrics, but the on/off ratios are all set to nan.

Just wondering if this is a known issue, since the site says that this metric is available.


Hi Brice,

Yes, this is a known issue. There was a bug when we were computing on/off ratio for the data release, but it’s since been fixed.

If you want to use this metric, you can calculate it with the following code (after you’ve loaded an EcephysSession object):

from allensdk.brain_observatory.ecephys.stimulus_analysis import Flashes
fl = Flashes(session)
ratio = fl._get_on_off_ratio(unit_id)

Hope that helps!