#astronomy #radio-astronomy #parser #parser-serializer #pulsars


A parser and serializer for SIGPROC pulsar filterbank files

6 releases (3 breaking)

0.4.0 Apr 5, 2024
0.3.0 Feb 26, 2023
0.2.1 Aug 12, 2022
0.1.1 Aug 11, 2022

#5 in #radio-astronomy

Apache-2.0 OR MIT



license docs rustc build status Codecov

This crate provides a simple, fast, and robust interface to the SIGPROC filterbank binary format. This format contains dynamic spectra, used commonly in pulsar and radio transient science in radio astronomy. This implementation is pure-rust with few dependencies and denies any unsafe code.


There are two main interfaces to filterbank files, reading and writing. These exists as separate data structures as the way you interact with them is fundamentally different.


To read from a filterbank file, you simply need a slice of bytes. This can come from a memory-mapped file, an incoming stream, etc. Then, there are getter methods for the header data and a single get method for accessing points in the dynamic spectra. Every filterbank will return f32s as the largest integer value supported by the format (u16) fits losslessly in an f32. get indexes as IF channel, Sample number, frequency channel.

use std::{fs::File, io::Read};

use sigproc_filterbank::read::ReadFilterbank;

let mut file = File::open("tests/small.fil").unwrap();
let mut bytes = vec![];
file.read_to_end(&mut bytes).unwrap();
let fb = ReadFilterbank::from_bytes(&bytes).unwrap();
let my_spec_val = fb.get(0,0,0);


To build a filterbank file, you push time-series data, just as you would receive them in a live telescope. You must declare the number of IFs and number of channels, and then the sample number is implied by how much data you write. Additionally, the number of bits of the filterbank is implied by the type of data you push. You get a compile error if you try to push different types. For data less than 8 bits, use the ux crate. We support, u1, u2, and u4.

Then to write the file, you simply dump the bytes and write to a file, stream, etc.

use sigproc_filterbank::write::WriteFilterbank;

// Two frequency channels, one IF
let mut fb = WriteFilterbank::new(2, 1);
fb.push(&[1u8, 2u8]);
fb.push(&[3u8, 4u8]);
// Serialize to bytes
let bytes = fb.bytes();


sigproc_filterbank is distributed under the terms of both the MIT license and the Apache License (Version 2.0).



~40K SLoC