id: satellites_doppler_correction
label: Doppler Correction
category: '[Satellites]/Doppler'

templates:
  imports: import satellites
  make: satellites.doppler_correction(${file}, ${samp_rate}, ${t0})

parameters:
- id: file
  label: File
  dtype: file_open
- id: samp_rate
  label: Sample rate
  dtype: float
  default: samp_rate
- id: t0
  label: Start time
  dtype: float
  default: 0

inputs:
- label: in
  domain: stream
  dtype: complex

outputs:
- label: out
  domain: stream
  dtype: complex

documentation: |-
    The Doppler Correction block uses a text file listing frequency vs. time to
    perform Doppler correction on its input signal. The same block can be used
    for Doppler simulation by inverting the frequency values in the input file
    or by taking the complex conjugate of the output of the block.

    The text file should contain lines with a timestamp and a frequency
    separated by a space. The timestamps are given in seconds, and typically
    consist of UNIX time. The "Start Time" parameter in the block constructor
    gives the starting time, which is the timestamp corresponding to the first
    sample processed by the block. As long as the timestamps in the file and
    this timestamp are consistent, the block will work correctly. The
    frequencies are given in Hz.

    The block can also use time tags such as those generated by the UHD Source
    block to update its internal timestamp. In this case the timestamps in the
    file should use UNIX seconds, since the UHD timestamps also use UNIX
    seconds. When using UHD time tags, the t0 parameter can be left as 0.

    The Doppler correction block interpolates the frequency linearly between each
    pair of entries in the text file, and generates a correction with continuous
    phase.

    Input:
        A stream of IQ samples
    Output:
        The input shifted in frequency with a shift opposite to the one described
        in the file

    Parameters:
        File: Frequency vs. time text file.
        Sample rate: Input and output sample rate.
        Start time: Timestamp correponding to the first sample processed by the block.

file_format: 1
