#data-interchange #radio-astronomy #encoded #format #frame #vdif #vlbi

rustvdif

A Rust library for interacting with data encoded in the VLBI Data Interchange Format (VDIF)

2 unstable releases

0.2.0 Oct 17, 2024
0.1.0 Sep 29, 2024

#164 in Science

Download history 188/week @ 2024-09-26 28/week @ 2024-10-03 2/week @ 2024-10-10 150/week @ 2024-10-17 4/week @ 2024-10-24

190 downloads per month

MIT/Apache

49KB
937 lines

Rust VDIF

A rust crate for interacting with data encoded in the VLBI Data Interchange Format (VDIF), commonly used in radio astronomy experiments. The VDIF data format is defined in the VDIF specification, found here.

This is a minimalist crate designed to relieve the problem of dealing with VDIF data in your own applications.

Documentation is available here.

Contributing

I'd love to see contributions from the VLBI community, and if you have any suggestions or questions you can always reach out to me directly or open an issue.

Licensing

This library is licensed under either the MIT License or the Apache 2.0 License at your option.


lib.rs:

A Rust library for interacting with data encoded in the VLBI Data Interchange Format (VDIF).

Before using this library, it is recommended you familiarize yourself with the VDIF format, if you haven't already, by reading the VDIF Version 1.1.1 specification. Put simply, VDIF defines a 'Data Frame': a datagram-like object consisting of a fixed size header and a payload of bytes.

I take some inspiration from the Python baseband library in developing this.

Getting Started

If you're working with files, you'll want to check out VDIFFileReader, which allows you to read VDIFFrames from a file like so:

fn main() {
    let mut file = VDIFFileReader::open("path/to/my/vdif/file").unwrap();
    // Read the first frame in the file
    let frame0 = file.get_frame().unwrap();
    println!("", frame0);
}

You can then read the next frame by calling get_frame again, or skip the next frame by calling nextframe. If you want to read all frames from the file (be careful with big files!), you can call get_all_frames.

If your working with VDIF data from other sources you'll be using the more general VDIFReader type, which allows you to wrap any type implementing std::io::Read.

For decoding the payload, check out the encoding module.

Dependencies

~2MB
~32K SLoC