All Projects → bbrzycki → setigen

bbrzycki / setigen

Licence: MIT license
Python library for generating and injecting artificial narrow-band signals into radio frequency data

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to setigen

FftSharp
A .NET Standard library for computing the Fast Fourier Transform (FFT) of real or complex data
Stars: ✭ 132 (+594.74%)
Mutual labels:  frequency, signal-processing
gr-eventstream
gr-eventstream is a set of GNU Radio blocks for creating precisely timed events and either inserting them into, or extracting them from normal data-streams precisely. It allows for the definition of high speed time-synchronous c++ burst event handlers, as well as bridging to standard GNU Radio Async PDU messages with precise timing easily.
Stars: ✭ 38 (+100%)
Mutual labels:  radio, signal-processing
vor-python-decoder
Decodes VOR signal from WAV file to get the bearing to your position
Stars: ✭ 33 (+73.68%)
Mutual labels:  radio, signal-processing
spafe
🔉 spafe: Simplified Python Audio Features Extraction
Stars: ✭ 310 (+1531.58%)
Mutual labels:  frequency, signal-processing
RFFHEM
Counterpart of SIGNALDuino, it's the code for FHEM to work with the data received from the uC
Stars: ✭ 44 (+131.58%)
Mutual labels:  radio, frequency
SW-Chinese-received-frequency
主流国际中文电台短波接收频率
Stars: ✭ 46 (+142.11%)
Mutual labels:  radio, frequency
yellowShoes
nrsc5 (HD FM) radio player
Stars: ✭ 16 (-15.79%)
Mutual labels:  radio
tf audio signal
How to run GPU accelerated Signal Processing in TensorFlow
Stars: ✭ 22 (+15.79%)
Mutual labels:  signal-processing
dsp-collection-java
A collection of Java classes for Digital Signal Processing
Stars: ✭ 41 (+115.79%)
Mutual labels:  signal-processing
computer-vision
Notebook series on interesting topics in computer vision
Stars: ✭ 17 (-10.53%)
Mutual labels:  signal-processing
vmdpy
Variational mode decomposition (VMD) in Python
Stars: ✭ 158 (+731.58%)
Mutual labels:  signal-processing
bsuir-csn-cmsn-helper
Repository containing ready-made laboratory works in the specialty of computing machines, systems and networks
Stars: ✭ 43 (+126.32%)
Mutual labels:  signal-processing
jsCast
📻 An Audio Streaming Application written in JavaScript
Stars: ✭ 23 (+21.05%)
Mutual labels:  radio
OpenAVRc Dev
The Next Step ...
Stars: ✭ 60 (+215.79%)
Mutual labels:  radio
flare
nRF905 single-chip radio transceiver demodulator + FLARM protocol decoder
Stars: ✭ 51 (+168.42%)
Mutual labels:  radio
pifi-radio
MPD web client to listen to radio, written in React and Sinatra.
Stars: ✭ 36 (+89.47%)
Mutual labels:  radio
RFMap
RFMap - Radio Frequency Mapper
Stars: ✭ 23 (+21.05%)
Mutual labels:  radio
beatmup
Beatmup: image and signal processing library
Stars: ✭ 168 (+784.21%)
Mutual labels:  signal-processing
react-native-animated-radio-button
Fully customizable animated radio button for React Native
Stars: ✭ 25 (+31.58%)
Mutual labels:  radio
nmmn
Miscellaneous methods for: astronomy, dealing with arrays, statistical distributions, computing goodness-of-fit, numerical simulations and much more
Stars: ✭ 16 (-15.79%)
Mutual labels:  signal-processing

setigen

PyPI version Build Status Documentation Status AJ Paper

setigen is a Python library for generating and injecting artificial narrow-band signals into radio frequency data, by way of data formats used extensively by the Breakthrough Listen (BL) team @ Berkeley.

Synthetic sine modulated signal + synthetic RFI signal

The main module of setigen is based on creating synthetic spectrogram (dynamic spectra) data, showing intensity as a function of time and frequency. Observational data saved in filterbank files can be loaded into setigen, and synthetic signals can be easily injected on top and saved out to file. setigen works well with file handling via BL's blimpy package.

The setigen.voltage module enables the synthesis of GUPPI RAW files via synthetic real voltage “observations” and a software signal processing pipeline that implements a polyphase filterbank, mirroring actual BL hardware. The voltage module supports single and multi-antenna RAW files, and can be GPU accelerated via CuPy.


Table of Contents

Installation

You can use pip to install the package automatically:

pip install setigen

Alternately, you can clone the repository and install it directly. At the command line, execute:

git clone [email protected]:bbrzycki/setigen.git
python setup.py install

The setigen.voltage module specifically can be GPU accelerated, via CuPy (https://docs.cupy.dev/en/stable/install.html). CuPy is not strictly required to use the voltage module, but it reduces compute time significantly. If CuPy is installed, enable setigen GPU usage either by setting the SETIGEN_ENABLE_GPU environmental variable to 1 or doing so in Python:

import os
os.environ['SETIGEN_ENABLE_GPU'] = '1'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'

While it isn’t used directly by setigen, you may also find it helpful to install cusignal for access to CUDA-enabled versions of scipy functions when writing custom voltage signal source functions.

Spectrogram Format - setigen.Frame

Guiding Principles

Injecting an artificial signal is as simple as adding it to the data. To fully describe an artificial signal, we need the following:

  • Start and stop times (in most cases, this would probably be the beginning and end of the observation, assuming the signal is "on" continuously)
  • Frequency center of signal as a function of time sample
  • Intensity modulation of signal as a function of time sample
  • Frequency structure within each time sample
  • Overall intensity modulation as a function of frequency (bandpass)

setigen provides sample functions and shapes for each of these parameters. These all contribute to the final structure of the signal - the goal is to empower the user to generate artificial signals that are as simple or complex as one would like.

Minimal Working Example

Here's an example of synthetic signal generation, using astropy.units to express frame parameters:

from astropy import units as u
import setigen as stg
import matplotlib.pyplot as plt

frame = stg.Frame(fchans=1024*u.pixel,
                  tchans=32*u.pixel,
                  df=2.7939677238464355*u.Hz,
                  dt=18.253611008*u.s,
                  fch1=6095.214842353016*u.MHz)
noise = frame.add_noise(x_mean=10, noise_type='chi2')
signal = frame.add_signal(stg.constant_path(f_start=frame.get_frequency(index=200),
                                            drift_rate=2*u.Hz/u.s),
                          stg.constant_t_profile(level=frame.get_intensity(snr=30)),
                          stg.gaussian_f_profile(width=40*u.Hz),
                          stg.constant_bp_profile(level=1))

fig = plt.figure(figsize=(10, 6))
frame.plot()
plt.savefig('example.png', bbox_inches='tight')
plt.show()

This first adds chi-squared noise to the frame, and adds a constant intensity signal at 30 SNR (relative to the background noise). The result is:

Example synthetic frame

Another example, using values found in real observations and visualized in the style of blimpy:

from astropy import units as u
import setigen as stg
import matplotlib.pyplot as plt

frame = stg.Frame(fchans=1024*u.pixel,
                  tchans=16*u.pixel,
                  df=2.7939677238464355*u.Hz,
                  dt=18.253611008*u.s,
                  fch1=6095.214842353016*u.MHz)
noise = frame.add_noise_from_obs()
signal = frame.add_signal(stg.constant_path(f_start=frame.get_frequency(index=200),
                                            drift_rate=2*u.Hz/u.s),
                          stg.constant_t_profile(level=frame.get_intensity(snr=30)),
                          stg.gaussian_f_profile(width=40*u.Hz),
                          stg.constant_bp_profile(level=1))

fig = plt.figure(figsize=(10, 6))
frame.bl_plot()
plt.show()

Example obs synthetic frame

Raw Voltage Format - setigen.voltage

setigen.voltage block diagram

The setigen.voltage module extends setigen to the voltage regime. Instead of directly synthesizing spectrogram data, we can produce real voltages, pass them through a software pipeline based on a polyphase filterbank, and record to file in GUPPI RAW format. In turn, this data can then be reduced as usual using rawspec. As this process models actual hardware used by Breakthrough Listen for recording raw voltages, this enables lower level testing and experimentation. The basic layout of a setigen.voltage pipeline is shown above.

A simple example implementation may be written as follows. For more information, check out the docs.

from astropy import units as u
import setigen as stg

antenna = stg.voltage.Antenna(sample_rate=3e9*u.Hz,
                              fch1=6000e6*u.Hz,
                              ascending=True,
                              num_pols=1)

antenna.x.add_noise(v_mean=0,
                    v_std=1)

antenna.x.add_constant_signal(f_start=6002.2e6*u.Hz,
                              drift_rate=-2*u.Hz/u.s,
                              level=0.002)

digitizer = stg.voltage.RealQuantizer(target_fwhm=32,
                                      num_bits=8)

filterbank = stg.voltage.PolyphaseFilterbank(num_taps=8,
                                             num_branches=1024)

requantizer = stg.voltage.ComplexQuantizer(target_fwhm=32,
                                           num_bits=8)

rvb = stg.voltage.RawVoltageBackend(antenna,
                                    digitizer=digitizer,
                                    filterbank=filterbank,
                                    requantizer=requantizer,
                                    start_chan=0,
                                    num_chans=64,
                                    block_size=134217728,
                                    blocks_per_file=128,
                                    num_subblocks=32)

rvb.record(output_file_stem='example_1block',
           num_blocks=1,
           length_mode='num_blocks',
           header_dict={'HELLO': 'test_value',
                        'TELESCOP': 'GBT'},
           verbose=True)

A set of tutorial walkthroughs can be found at: https://github.com/bbrzycki/setigen/tree/main/jupyter-notebooks/voltage.

One unique application of the setigen.voltage pipeline is to ingest IQ data collected from an RTL-SDR dongle and create GUPPI RAW files accordingly: https://github.com/bbrzycki/rtlsdr-to-setigen.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].