msna-sim
A Python library for generating realistic synthetic Muscle Sympathetic Nerve Activity (MSNA) signals with physiologically accurate timing, noise characteristics, and signal properties. This library also includes an interactive dashboard for real-time parameter exploration and exporting data.
Overview
Muscle Sympathetic Nerve Activity (MSNA) provides direct measurement of sympathetic outflow to skeletal muscle vasculature, offering insights into cardiovascular neural control mechanisms. This library generates realistic synthetic MSNA signals that closely replicate those obtained through microneurography recordings.
The simulator incorporates:
- Physiologically accurate cardiac synchronization with heart rate variability
- Respiratory modulation of sympathetic activity
- Realistic burst morphology with variable timing and amplitude
- Comprehensive multi-frequency noise modeling based on real clinical recordings
- Interactive dashboard for parameter exploration and data export
msna-sim is designed for algorithm development, method validation, education, and clinical research applications where realistic synthetic MSNA data is needed.
Installation
Install from PyPI:
pip install msna-sim
Requirements will be automatically installed, but can be found in requirements.txt.
Quick Start
Interactive Dashboard
Launch the interactive dashboard for real-time parameter exploration:
msna-sim-dashboard
The dashboard allows you to play with various simulation parmaeters, and export data as CSV. It could be used as the main way to interact with this library for users with minimal programming experience.
Examples
Basic Programmatic Usage
from msna_sim import quick_simulation
# Generate a 60-second recording with default settings
results = quick_simulation(duration = 60, preset = "normal_adult")
# Access the signals
time = results.time
clean_msna = results.clean_msna # Clean MSNA signal
noisy_msna = results.noisy_msna # Realistic noisy signal
burst_times = results.burst_peak_idx # Burst occurrence times
print(f"Generated {results.n_bursts} bursts")
print(f"Burst incidence: {results.burst_incidence:.1f}%")
Using Preset Configurations
from msna_sim import Simulation, create_preset_config
# Available presets include physiological and pathological conditions
presets = [
"normal_adult", "young_healthy", "athlete", "elderly_healthy",
"hypertensive", "heart_failure", "bradycardia", "tachycardia",
"diabetes", "obesity", "sleep_apnea", "copd", "anxiety",
"post_exercise", "pristine_lab", "noisy_clinical"
]
# Create simulation with hypertensive patient preset
config = create_preset_config("hypertensive")
simulation = Simulation(config)
results = simulation.simulate(duration = 120, sampling_rate = 1000)
print(f"Heart rate: {results.mean_heart_rate:.1f} bpm")
print(f"Burst incidence: {results.burst_incidence:.1f}%")
Custom Configuration
from msna_sim import Simulation, PatientConfig, SignalConfig
# Create custom patient configuration
patient_config = PatientConfig(
heart_rate = 75.0, # beats per minute
hrv_std = 0.04, # heart rate variability
burst_incidence = 65.0, # percentage of cardiac cycles with bursts
noise_floor = 0.25, # baseline noise level
signal_amplitude = 1.2, # relative burst amplitude
resp_rate = 16.0, # breaths per minute
resp_modulation_strength = 0.4 # respiratory modulation strength
)
# Optional: customize signal processing parameters
signal_config = SignalConfig(
integration_smoothing = 0.95, # signal integration smoothing
pink_noise_amplitude = 0.4, # pink noise contribution
spike_artifact_amplitude = 0.3 # spike artifact strength
)
simulation = Simulation(patient_config, signal_config)
results = simulation.simulate(duration = 180, sampling_rate = 1000, seed = 42)
Usage Examples
# Launch dashboard
msna-sim-dashboard
Technical Details
For technical details, refer to the SPECS.md file.
API Reference
Core Classes
Simulation: Main simulation classPatientConfig: Physiological parameter configurationSignalConfig: Signal processing parameter configurationSimulationResults: Container for simulation outputs
Key Functions
quick_simulation(): Convenience function for simple simulationscreate_preset_config(): Load predefined patient configurations
Simulation Results
The SimulationResults object provides:
time: Time array in secondsclean_msna: Clean MSNA signal without noisenoisy_msna: Realistic MSNA signal with noiserespiratory_signal: Respiratory waveformburst_peak_idx: Array of burst occurrence timesn_bursts: Total number of burstsburst_incidence: Realized burst incidence percentage
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation
If you use this library in your research, please cite:
@software{msna_sim,
author = {Ryan Peters},
title = {msna-sim: Realistic MSNA Signal Simulation},
url = {https://github.com/ryanirl/msna-sim},
version = {0.1.2},
year = {2025}
}
Metadata
Release files for msna-sim 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| msna_sim-0.1.2.tar.gz | 714.5 kB | Without provenance | Details for msna_sim-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| msna_sim-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for msna_sim-0.1.2-py3-none-any.whl |
Total release size: 736.6 kB
Release files / msna_sim-0.1.2.tar.gz
| Download URL | msna_sim-0.1.2.tar.gz |
|---|---|
| Size | 714.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
236ca82f98a714fb339bba8f8e7b0a3e5744ffd3a79f91bccca5e3f6b935c963
|
|
BLAKE2b-256 checksum How to use checksums |
b5522f40f2e8ff7189209cd848eb95632a8dbb74fbb2ad5bfea10b7e66505ed7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|
Release files / msna_sim-0.1.2-py3-none-any.whl
| Download URL | msna_sim-0.1.2-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed82ab487dc0ff8e338e3d946e84db58407b113f2d3944bcc666a643a38b85a8
|
|
BLAKE2b-256 checksum How to use checksums |
47991d6954605ac4f0e3f34928c0e2c94a64b5db88860246603a21eaa36c9f40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.13
|
Security for msna-sim 0.1.2
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.