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.20

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.20
File Size Uploaded Provenance Actions
npc_mvr-0.1.20.tar.gz 23.9 kB Without provenance Details for npc_mvr-0.1.20.tar.gz

Built distribution (wheel)

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

Total release size: 44.7 kB

Release files / npc_mvr-0.1.20.tar.gz

Download URL npc_mvr-0.1.20.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
56e1474db6b745b5077f4b23f8821df7a450313865808c35c2c7495261a764c5
BLAKE2b-256 checksum
How to use checksums
65ef25f677ac7fe2fb9a7fcc95eaf631936fdeb88740df3f2b5486e28ab89513
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.20-py3-none-any.whl

Download URL npc_mvr-0.1.20-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1060722a62e104dcef05ab43a5cfa437273fa6709db46c3d51688b6a3a4f675
BLAKE2b-256 checksum
How to use checksums
3fb60d5b325dba9bcaa0194877cef22140905245d8a5e9683f7cbf0cbdd125fa
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.20

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