Package: npc_sessions
npc_sessionsneuropixelscloudsessionsTools for accessing data and metadata for behavior and epyhys sessions from the
Mindscope Neuropixels team - in the cloud.quickstartMake a conda environment with python>=3.9 and simply pip install the npc_sessions package:condacreate-nnpc_sessionspython>=3.9
condaactivatenpc_sessions
pipinstallnpc_sessions>>>fromnpc_sessionsimportDynamicRoutingSession,get_sessions;# each object is used to get metadata and paths for a session:>>>session=DynamicRoutingSession('668755_2023-08-31')>>>session.is_ephysTrue>>>session.stim_paths[0].stem'DynamicRouting1_668755_20230831_131418'# data is processed on-demand to generate individual pynwb modules:>>>session.subject# doctest: +SKIPsubjectpynwb.file.Subjectat0x1999418231888Fields:age:P205Dage__reference:birthdate_of_birth:2023-02-0620:23:02-08:00genotype:wt/wtsex:Mspecies:Musmusculusstrain:C57BL6J(NP)subject_id:668755# a full NWBFile instance can also be generated with all currently-available data:>>>session.nwb# doctest: +SKIProotpynwb.file.NWBFileat0x...Fields:acquisition:{lickspout<class'ndx_events.events.Events'>}devices:{18005102491<class'pynwb.device.Device'>,18005114452<class'pynwb.device.Device'>,18005123131<class'pynwb.device.Device'>,18194810652<class'pynwb.device.Device'>,19192719021<class'pynwb.device.Device'>,19192719061<class'pynwb.device.Device'>}...# loop over all currently-tracked sessions using the session-generator:>>>all(s.session_start_time.year>=2022forsinget_sessions())# doctest: +SKIPTrue>>>trials_dfs={}>>>forsessioninget_sessions():# doctest: +SKIP...trials_dfs[session.id]=session.trials[:]to develop with condaTo install with the intention of contributing to this package:create a conda environment:condacreate-nnpc_sessionspython>=3.9
condaactivatenpc_sessionsclone npc_sessions from github:gitclonegit@github.com:AllenInstitute/npc_sessions.gitpip install all dependencies:cdnpc_sessions
pipinstall-e.Current NWB componentskey data typesDynamicTable: for general tabular data. Cells can contain arrays (e.g.spike_timesin a table of units)can be accessed as a pandas dataframeTimeIntervals: subclass ofDynamicTablewhich always has astart_timeandstop_timecolumn, plus other user-defined columnsTimeSeries: has a vector array ofdata, aunitsstring, and either:timestamps(same length asdata)orstarting_timeandrateElectricalSeries: subclass ofTimeSerieswith units fixed as voltsEvents: (added via an NWB extension) likeTimeSerieswith timestamps only, without values fordata(think lick times)all of the above also have adescription, as well as other type-specific attributessession metadata(multiple attributes)subject (multiple attributes)devices:DynamicTablephysical probes (model, serial number)currently only neuropixels probeselectrode_groups:DynamicTablerepresents the group of channels on one probe inserted in the brainhas session-specific info, like position relative to other probes or stereotactic coordselectrodes:DynamicTableindividual channels on a probehas CCF coordsunits:DynamicTablemetrics, links toelectrodesviapeak_channelepochs:TimeIntervalsstart/stop time of each stim blockhas a list of tags (includesTaskControlsubclass name)intervals:Mapping[str, TimeIntervals]1x table per stim epoch with trialsbehavior performance table (each block an interval)trials:TimeIntervalssame asintervals[DynamicRouting1]invalid_times:TimeIntervalsacquisition:Mapping[str, Any]raw dataif is_ephys:raw AP:Mapping[str, ElectricalSeries]raw LFP:Mapping[str, ElectricalSeries]if is_sync:lick_sensor_rising_edges:Eventslick_sensor_falling_edges:Eventsif is_task:rewards:Eventsif is_video:video frame times: 1xEventsper cameraprocessing:Mapping[str, Any]processed/filtered databehavior:Mapping[str, Any]licks:Eventsfrom sync or stim filerunning_speed:TimeSeriesfrom stim file, enhanced with sync info if availableecephys:Mapping[str, Any]analysis:Mapping[str, Any]derived data, resultsif is_ephys:all_spike_histograms: 1xTimeSeriesper probedrift_maps:ImageSeriesif is_task:performance:TimeIntervalsTodo:video feature extraction: pupil size, gaze trackingvideo processing: facemapfiltered LFPstimulus templates (vis, aud, opto)OptogeneticStimulusSiteanalysis -> RFMapsper-unit response metric for each stim modality