Skip to main content

Python library for VLF radio signal processing

Project description

vlfrx

Python library for VLF (Very Low Frequency) radio signal processing.

This library can be used both as a CLI tool and as a Python library for other projects.

PyPI Python Coverage

Install

pip install vlfrx

Usage (as Python Library)

from vlfrx import open_input, open_output, Timestamp
import numpy as np
from vlfrx.services.signal_gen import generate_sine
from vlfrx.services.spectrum import compute_fft
from vlfrx.services.filter import design_fir_filter, apply_filter

# Read a VT file
vt = open_input("signal.vt")
frame = vt.read_frame()
print(f"Timestamp: {vt.get_timestamp()}")
print(f"Channels: {vt.channels}, Sample rate: {vt.sample_rate} Hz")
vt.close()

# Write a VT file
signal = generate_sine(1000, 1.0, fs=48000)

vt = open_output("output.vt", channels=1, sample_rate=48000)
vt.write_frames(signal.reshape(-1, 1))
vt.close()

# Compute spectrum
vt = open_input("signal.vt")
frames = []
while True:
    frame = vt.read_frame()
    if frame is None:
        break
    frames.append(frame)
data = np.array(frames)
freqs, psd = compute_fft(data[:, 0], fs=vt.sample_rate)

# Apply filter
b = design_fir_filter('lowpass', 1000, fs=48000)
filtered, _ = apply_filter(data[:, 0], b)

Public API

# Core
from vlfrx import (
    Timestamp,      # High-precision timestamp
    VTFile,         # VT file reader/writer
    VTBlock,        # Data block structure
    ChannelSpec,    # Channel specification
    open_input,     # Open VT file for reading
    open_output,    # Open VT file for writing
    parse_chanspec,
)

# Services
from vlfrx.services.spectrum import (
    compute_fft,
    compute_power_spectrum,
    compute_spectrogram,
    compute_rolling_spectrogram,
    phase_spectrum,
)

from vlfrx.services.filter import (
    design_fir_filter,
    design_iir_filter,
    apply_filter,
    apply_fir_filter,
    apply_iir_filter,
    design_bandpass,
    design_notch,
)

from vlfrx.services.signal_gen import (
    generate_sine,
    generate_square,
    generate_sawtooth,
    generate_white_noise,
    generate_pink_noise,
    generate_chirp,
    generate_am,
    generate_fm,
)

CLI

# Read and display VT file
vlfrx read input.vt

# Show file info
vlfrx info input.vt

# Compute spectrum
vlfrx spec input.vt -o spectrum.txt

# Generate a sine wave
vlfrx gen 1000 1.0 -o signal.vt

# Concatenate files
vlfrx cat file1.vt file2.vt -o combined.vt

# Apply filter
vlfrx filter input.vt -o output.vt -t lowpass -c 1000

Development

git clone https://github.com/daedalus/vlfrx-tools-py.git
cd vlfrx-tools-py
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

License

MIT License - Copyright (c) 2026 Darío Clavijo

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

vlfrx-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

vlfrx-0.1.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file vlfrx-0.1.0.tar.gz.

File metadata

  • Download URL: vlfrx-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vlfrx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 34e58cf4534c3aca0c20cd4d82cf0529d9e56fedd2a1a41b76e61f19af643e6a
MD5 906790738b46ada97ed4ff797be58f01
BLAKE2b-256 d6ae535a360fa1cf3396f2f1e1afc07ec7354d6cb06091c933fce894bfcbe7d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for vlfrx-0.1.0.tar.gz:

Publisher: pypi-publish.yml on daedalus/vlfrx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vlfrx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vlfrx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vlfrx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cb2012c0c00162ee897f2194536ae940be0d0f23857bc4e55615b20e305760a
MD5 a90b2efab74c08fbf2f09b8cfa23d00d
BLAKE2b-256 837faf54358d0b9eb74bae2f90f5ce56fddca69915d749df18cd7a2007b07bae

See more details on using hashes here.

Provenance

The following attestation bundles were made for vlfrx-0.1.0-py3-none-any.whl:

Publisher: pypi-publish.yml on daedalus/vlfrx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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