Skip to main content

npc_mvr

Tools for reading raw video data from MindScope Neuropixels experiments, compatible with data in the cloud.

PyPI Python version

Coverage CI/CD GitHub issues

Usage

conda create -n npc_mvr python>=3.9
conda activate npc_mvr
pip install npc_mvr

Python

>>> import npc_mvr

>>> d = npc_mvr.MVRDataset('s3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/behavior')

# get paths
>>> d.video_paths['behavior']
S3Path('s3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/behavior/Behavior_20230803T120430.mp4')
>>> d.info_paths['behavior']
S3Path('s3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/behavior/Behavior_20230803T120430.json')

# get data
>>> type(d.video_data['behavior'])
<class 'cv2.VideoCapture'>
>>> type(d.info_data['behavior'])
<class 'dict'>
>>> type(d.sync_data)
<class 'npc_sync.sync.SyncDataset'>

# get frame times for each camera on sync clock
# - nans correspond to frames not recorded on sync
# - first nan is metadata frame 
>>> d.frame_times['behavior']
array([       nan,   14.08409,   14.10075, ..., 5084.4582 , 5084.47487, 5084.49153]) 

>>> d.validate()

Excluded cameras

MVRDataset.video_paths (and frame_times, video_data etc.) leaves out cameras whose frame times can't be trusted, with a warning. The reasons are in d.excluded_cameras, and all videos found are in d.all_video_paths:

  • more than max_frames_cut (default 20) surplus exposures on sync that MVR doesn't account for (frames lost without being reported, so frame times drift)
  • more than max_lost_frame_percentage (default 0.1%) frames lost
  • the recording started inside an interval where sync events are unknown

Pass None for either limit to disable it. Counts for each camera are in d.camera_frame_times (see npc_mvr.CameraFrameTimes).

Unknown sync intervals

With a patched npc_sync.SyncDataset (or on_invalid='mask'), camera exposures inside intervals where sync events are unknown (SyncDataset.get_unknown_intervals) are estimated from the camera's period: their frame times are nan, and frames after them keep the right times.

Development

See instructions in https://github.com/AllenInstitute/npc_mvr/CONTRIBUTING.md and the original template: https://github.com/AllenInstitute/copier-pdm-npc/blob/main/README.md

Metadata

Release files for npc-mvr 0.1.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for npc-mvr 0.1.21
File Size Uploaded Provenance Actions
npc_mvr-0.1.21.tar.gz 24.4 kB Without provenance Details for npc_mvr-0.1.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for npc-mvr 0.1.21
File Interpreter ABI Platform Actions
npc_mvr-0.1.21-py3-none-any.whl Python 3 none any Details for npc_mvr-0.1.21-py3-none-any.whl

Total release size: 45.7 kB

Release files / npc_mvr-0.1.21.tar.gz

Download URL npc_mvr-0.1.21.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ae23f2b838740f18c151f51d908fba8a92db256dd35bfe7cae74aa5719423c1c
BLAKE2b-256 checksum
How to use checksums
ef181a0f5d99443a4f439fa4feeffc603660ca4eb6c0ab5f6b4ab04bdb1b80f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / npc_mvr-0.1.21-py3-none-any.whl

Download URL npc_mvr-0.1.21-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7119afcf1ce35ed9064608a1c83e25c624d3375e97e30cff02a0ede861443b97
BLAKE2b-256 checksum
How to use checksums
51e1c39c53d30ea45a7240e81144829a0b10cf2b764bec1bd5dcfcbd657abb36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for npc-mvr 0.1.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page