Skip to main content

Fast Python bindings for reading Intan RHS files

Project description

Fast Python bindings for reading Intan RHS files, powered by Rust for high performance.

Note: Version 0.2.0 introduces a breaking change - analog data arrays now return float64 values in physical units instead of raw int32 ADC values. See MIGRATION_GUIDE_v0.2.0.md for details.

Quick Start

import intan_importer

# Load a single RHS file or a directory of files
rec = intan_importer.load("data.rhs")

# Access the data
time = rec.data.time               # Time vector in seconds
data = rec.data.amplifier_data     # Neural data in microvolts

Data Structure

Recording object (rec)
│
├── .duration                → total duration in seconds
├── .num_samples             → total number of samples
├── .sample_rate             → sampling rate in Hz
├── .num_channels            → number of amplifier channels
├── .data_present            → bool, whether data exists
├── .source_files            → list of source files (if multiple)
│
├── .header
│   ├── .sample_rate         → sampling rate in Hz
│   ├── .notch_filter_frequency → 50, 60, or None
│   ├── .reference_channel   → reference channel name
│   ├── .note1, .note2, .note3 → user notes
│   ├── .amplifier_channels  → list of channel info
│   └── .board_adc_channels  → list of ADC channel info
│
├── .data (if present)
│   ├── .time                → time vector in seconds (float64)
│   ├── .timestamps          → sample numbers (int32)
│   ├── .amplifier_data      → neural data (µV, float64)
│   ├── .board_adc_data      → auxiliary inputs (V, float64)
│   ├── .board_dig_in_data   → digital inputs (0 or 1)
│   ├── .stim_data           → stimulation current (µA)
│   └── ... (other optional data types)
│
└── Methods:
    ├── .get_channel_data(channel, start_time, end_time)
    ├── .get_time_slice(start_time, end_time) 
    └── .summary()

Key Features

Time Vectors

Both time representations are available in the data object:

time = rec.data.time          # Time in seconds (computed from timestamps)
timestamps = rec.data.timestamps  # Raw sample numbers

# Convert between them
time_manual = timestamps / rec.sample_rate  # Same as rec.data.time

Channel Access

Access channels by index or name:

# By index
data = rec.get_channel_data(0)

# By channel name
data = rec.get_channel_data("CA1")

# With time window (in seconds)
data = rec.get_channel_data("CA1", start_time=10.0, end_time=20.0)

Channel Information

for i, ch in enumerate(rec.header.amplifier_channels):
    print(f"Channel {i}: {ch.custom_channel_name} ({ch.electrode_impedance_magnitude:.0f} Ω)")

Data Types

  • Time: Seconds (float64)
  • Timestamps: Sample numbers (int32)
  • Amplifier data: Microvolts (µV)
  • ADC data: Volts (V)
  • Digital data: Binary (0 or 1)
  • Stimulation data: Microamps (µA)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intan_importer-0.2.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intan_importer-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (335.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file intan_importer-0.2.0.tar.gz.

File metadata

  • Download URL: intan_importer-0.2.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for intan_importer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 56075c218fece0b8d5fe7fbe91e0fb9821e9f39edd46f59573f5c6b29648ba84
MD5 f60ab6cc75484eb33295b2a26a09b6fb
BLAKE2b-256 fede983a965db013c306edc5010ca77960c14734109e62e9d68e018deae990f1

See more details on using hashes here.

File details

Details for the file intan_importer-0.2.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for intan_importer-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 edde5741c3548fada6c333013743d810baa0f250c2783d91067d98f9944abd8d
MD5 6b88f8ccf6a259e3d0aa81f4cccfa345
BLAKE2b-256 deb48b7a05c3962839da120b5cf60ccf2c2287ded1d5054cdcf3985d65bb8ed1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page