1 stable release

1.0.6 Jul 12, 2024
1.0.2 Jul 11, 2024

#1572 in Parser implementations

Download history 22/week @ 2024-09-16 53/week @ 2024-09-30 2/week @ 2024-10-07

212 downloads per month
Used in shr_parser_py

GPL-3.0-only

35KB
672 lines

Signal Hound Spike Spectrum Analyzer SHR Parser

This Rust library provides powerful tools for parsing and handling SHR files generated by the Signal Hound Spike softwa. The SHR file format encompasses a file header and multiple sweeps, each with its own header and data. This library leverages memory mapping for efficient file reading and Rayon for parallel processing of sweeps, ensuring high performance and scalability.

Features

  • Parse SHR Files: Read and interpret SHR files, including headers and sweeps.
  • Validate Files: Ensure the integrity of SHR files by validating signatures and versions.
  • Sweep Metrics Calculation: Compute key metrics such as peak, mean, and low values from sweep data.
  • Serialization & Deserialization: Utilize Serde for seamless serialization and deserialization of SHR data.
  • CSV Export: Export parsed SHR data to CSV format for easy analysis and reporting.

Installation

To include this library in your project, add the following dependencies to your Cargo.toml file:

[dependencies]
shr_parser = "1.0.5"

Usage

Here's an example of how to use the SHR file parser:

use std::path::PathBuf;
use shr_parser::{SHRParser, SHRParsingType};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let file_path = PathBuf::from("path/to/your/shrfile.shr");
    let parser = SHRParser::new(file_path, SHRParsingType::Peak)?;

    println!("{}", parser.to_str());

    parser.to_csv(PathBuf::from("output.csv"))?;

    Ok(())
}

Documentation

Complete documentation is available on docs.rs. To generate the documentation locally, run:

cargo doc --open

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the GPL-3 License. See the LICENSE file for details.

Dependencies

~2.9–4MB
~76K SLoC