Helper Modules of SiqNAL

Bandpass Module

Author : Jay Krishna

This module implements linear phase finite impulse response (FIR) butterworth bandpass filter using Frequency shift theorem and symmetricity of the filter. The computed signal after applying bandpass filter is then stoared as (.txt) file.

Approach

  1. Frequency Shift Approach

    • First of all the centre frequency of signal is shifted from current centre frequency(fc) to mean of lower and higher frequency cutoff.
    • A linear phase finite impulse response (FIR) butterworth bandpass filter is constructed of width half of passband width.
    • After filtering the signal is again shifted back to the previous centre frequency.
  2. Frequency Zeroing Approach

    • Rectangular window in frequency domain is constructed with unity at passband while zero elsewhere.
    • The rectangular window is multiplied with the signal in frequency domain.

    Though this approach is quite easygoing but sometimes have it’s own consequences because multiplying with zero equals to subtraction of sin wave of same frequency. In our case it won’t affect much beacause we are going to just detect signals.

Note

  1. Frequency Shift Theorem

    The frequency shift theorem states that, if

    \[x(t) = X( \omega )\]

    then,

    \[x(t) e^{(j \omega_o t)} = X( \omega - \omega_o)\]

    where,

    \[\omega_o = 2 \pi F_o / F_{sample}\]

    \(F_o\) is in it’s equivalent baseband counterpart.

    1. Width of the filter
      Linear Phase filters are symmetric around the centre frequency of the signal. Since the centre frequency of the new signal is average of lower and higher frequency cutoffs. Hence, the width of the filter is kept half of the passband width.
Modules.bandpass.butter_bandpass_filter(data, width, fs)[source]

This function constructs as well as applies the specified linear phase finite impulse response (FIR) butterworth bandpass filter to the given shifted signal. The order of the filter is automatically selected based upon the value of (Width of the filter / Nyquist Smapling frequency).

Parameters:
  • data (ndarray) – Numpy complex array of shifted signal.
  • width (float) – Width of the filter to be constructed.
  • fs (float) – Sampling frequency of the signal.
Returns:

y – Numpy complex array of filtered and shifted signal.

Return type:

ndarray

Modules.bandpass.calc_parameter(flow, fhigh, fc, fs)[source]

This function calculates the width of the filter and the multiplying factor for the shifting of the signal to the required centre frequency.

Parameters:
  • flow (float) – Lower cutoff frequency for bandpass filter.
  • fhigh (float) – Higher cutoff frequency for bandpass filter.
  • fc (float) – Center frequency of the signal.
  • fs (float) – Sampling frequency of the signal.
Returns:

  • multiplier (float) – Shifting coefficient for the frequency shift.
  • width (float) – Width of the filter to be constructed.

Modules.bandpass.filter(signal, SignalInfo, Flow, Fhigh, chunksize)[source]

Driver function of bandpass filtering. Signal is read at the rate of per second, shifted to the desired centre frequency, linear phase finite impulse response (FIR) butterworth bandpass filter is applied, signal is reshifted back and written to a (.txt) file.

Parameters:
  • signal (ndarray) – Numpy complex array of signal.
  • SignalInfo (object) – Instance of class SignalData having meta-data of file and signal.
  • Flow (float) – Lower cutoff frequency for bandpass filter.
  • Fhigh (float) – Higher cutoff frequency for bandpass filter.
  • filename (string) – Name of the (.txt) file used for storing filtered signal.
  • chunksize (int) – Size of one signal chunk processed each time, preferred power of two for faster FFT computation.
Returns:

final – Numpy complex array of filtered signal.

Return type:

ndarray

Modules.bandpass.filter_box(SignalInfo, Flow, Fhigh, chunksize)[source]

This function implement box filter approach for bandpass filtering using multiplication of rectangular pulse with the signal in frequency domain.

Parameters:
  • SignalInfo (object) – Instance of class SignalData having meta-data of file and signal.
  • Flow (float) – Lower cutoff frequency for bandpass filter.
  • Fhigh (float) – Higher cutoff frequency for bandpass filter.
  • filename (string) – Name of the (.txt) file used for storing filtered signal.
  • chunksize (int) – Size of one signal chunk processed each time, preferred power of two for faster FFT computation.
Returns:

signal_filtered – Numpy complex array of filtered signal.

Return type:

ndarray

Fourier Module

Author : Jay Krishna

This module computes the fourier transform, fourier transform power & inverse fourier transform of the signal.

Modules.fourier.CalcFourier(signal)[source]

This function calculates the fourier transform of a signal. The fourier transform’s zero frequency is shifted to the centre of the spectrum.

Parameters:signal (ndarray) – Numpy complex array of signal.
Returns:transform – Numpy array of computed fourier transform.
Return type:ndarray
Modules.fourier.CalcFourierPower(signal, fs, fc)[source]

This function calculates the power of fourier transform of a signal in each frequency bin.

Parameters:
  • signal (ndarray) – Numpy complex array of signal.
  • fs (float) – Sampling frequency of the signal.
  • fc (float) – Centre frequency of the signal.
Returns:

  • frequency (ndarray) – Numpy array of values of frequencies present in the signal.
  • transform (ndarray) – Numpy array of computed fourier transform.

Modules.fourier.CalcIFourier(signal)[source]

This function calculates the inverse fourier transform of a signal. The fourier transform’s zero frequency is shifted to the left of the spectrum.

Parameters:signal (ndarray) – Numpy complex array of signal.
Returns:isignal – Numpy array of computed inverse fourier transform.
Return type:ndarray

Frequency Band Module

Author : Jay Krishna

This module reads the json database of satellites & correspondingly populates list object for construction of bandpass filter and signal detection.

Modules.freqbands.getbands(SignalInfo, filename)[source]

This function go through the json database of satellites, read the meta data about them usch as name and transmission method used by them. It also reads about their transponder data particularly Downlink frequency along with width of frequency band used by them which is further corrected for doppler shift and stored.

Parameters:
  • SignalInfo (object) – Instance of class SignalData having meta-data of file and signal.
  • filename (str) – Absolute path to json satellite database.
Returns:

bands – List object containing meta data about each satellite.

Return type:

list

Import File Module

Author : Jay Krishna

This module reads the json file associated with a signal file for server version of this project.

Modules.importfile.loadfile(filename)[source]

This function read the json file associated with the signal file and extract centre frequency and sampling frequency of the signal file.

Parameters:filename (string) – Absolute path of signal file whose associated json file need to be read.
Returns:SignalInfo – Instance of class SignalData having meta-data of file and signal.
Return type:object

Read Dat Module

Author : Jay Krishna

This module read (.dat) file from physical storage as a memory- mapped file.

Modules.read_dat.loaddata(filename)[source]

This function opens a (.dat) format file specified by it’s absolute path and returns a memory-mapped file object.

Parameters:filename (string) – Absolute path to (.dat) format file to be read.
Returns:signal – Memory mapped file object of specified (.dat) file.
Return type:file object

Read Wav Module

Author : Jay Krishna

This module read (.wav) file from physical storage as a memory- mapped file.

Modules.read_wav.loaddata(filename)[source]

This function opens a (.wav) format file specified by it’s absolute path and returns a memory-mapped file object.

Parameters:filename (string) – Absolute path to (.wav) format file to be read.
Returns:signal – Memory mapped file object of specified (.wav) file.
Return type:file object

SignalData Module

Author : Jay Krishna

This module defines class to pass meta data about the file source and signal in structured manner.

Note

Three file extensions are supported in this project, namely

  1. .dat
  2. .wav

Waterfall Module

Author : Jay Krishna

This module saves the waterfall diagram of the entire signal by concatenating waterfall diagram of each second.

Approach

  • Signal is broken down into slices of size specified.

  • For each signal slice

    • Rectangular window is chosen based of size according to overlaping factor.
    • Fast Fourier Transform is calculated whose zero frequency spectrum is shifted to the centre and length normalized.
    • Each fft is stacked over previous one.
Modules.waterfall.plot_waterfall(SignalInfo, chunksize, number)[source]
Parameters:
  • SignalInfo (object) – Instance of class SignalData.
  • chunksize (int) – Size of one signal chunk processed each time, preferred power of two for faster FFT computation.
  • number (int) – Number of rows to be interleaved to help reduce memory consumption.