Precomputed Unit Analysis Metrics


At the bottom of this page, Visual Coding – Neuropixels — Allen SDK dev documentation it notes to use the “get_unit_analysis_metrics()” method to get metrics of global orientation selectivity, sparseness etc. Additionally, it is mentioned in the Allen SDK documentation release dev.

However, I am having trouble calling this data, as I cant find which module this is part of. I have attempted things such as:

from allensdk.brain_observatory.ecephys.ecephys_session import get_unit_analysis_metrics
from allensdk.brain_observatory.ecephys.ecephys_project_cache import get_unit_analysis_metrics
from allensdk.brain_observatory.ecephys.ecephys_project_api import get_unit_analysis_metrics
import allensdk.brain_observatory.ecephys.ecephys_project_api

I have been able to find a table for the calcium imaging data using what I assume is a similar method - “get_cell_specimens()” on this page Brain Observatory — Allen SDK dev documentation (as there is an associated jupyter notebook tutorial) but I am looking for the neuropixel data.

This may be a simple question, but I am having quite a bit of trouble and cant find any answers anywhere else, thus would appreciate any help if you know how to call the table.

Hello! This method belongs to the EcephysProjectCache object (the same one used to download data).

You can create the cache object like this:

from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache

output_dir = '/local1/ecephys_cache_dir' # customize this
manifest_path = os.path.join(output_dir, "manifest.json")
cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)

Then, you can access the analysis metrics like this:

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')

These steps are documented in this tutorial, but we should also make this clear on the landing page!

1 Like

Thank you for this quick response! This is exactly what I was looking for, thank you.