processing_components/simulation/rfi.py
def simulate_DTV(frequency, times, power=50e3, timevariable=False, frequency_variable=False):
    """ Calculate DTV sqrt(power) as a function of time and frequency

    :param frequency: (sample frequencies)
    :param times: sample times (s)
    :param power: DTV emitted power W
    :return: Complex array [ntimes, nchan]
    """
    nchan = len(frequency)
    ntimes = len(times)
    shape = [ntimes, nchan]
    bchan = nchan // 4
    echan = 3 * nchan // 4
    amp = power / (max(frequency) - min(frequency))
    signal = numpy.zeros(shape, dtype='complex')
    if timevariable:
        if frequency_variable:
            sshape = [ntimes, nchan // 2]
            signal[:, bchan:echan] += numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape) \
                                    + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
        else:
            sshape = [ntimes]
            signal[:, bchan:echan] += numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape) \
                                    + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
    else:
        if frequency_variable:
            sshape = [nchan // 2]
            signal[:, bchan:echan] += (numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
                                   + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape))[numpy.newaxis, ...]
        else:
            signal[:, bchan:echan] = amp
    
    return signal
 Calculate DTV sqrt(power) as a function of time and frequency

    :param frequency: (sample frequencies)
    :param times: sample times (s)
    :param power: DTV emitted power W
    :return: Complex array [ntimes, nchan]
    
Calculate DTV sqrt(power) as a function of time and frequency
Calculate DTV sqrt ( power ) as a function of time and frequency
def simulate_DTV(frequency, times, power=50e3, timevariable=False, frequency_variable=False):
    nchan = len(frequency)
    ntimes = len(times)
    shape = [ntimes, nchan]
    bchan = nchan // 4
    echan = 3 * nchan // 4
    amp = power / (max(frequency) - min(frequency))
    signal = numpy.zeros(shape, dtype='complex')
    if timevariable:
        if frequency_variable:
            sshape = [ntimes, nchan // 2]
            signal[:, bchan:echan] += numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape) \
                                    + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
        else:
            sshape = [ntimes]
            signal[:, bchan:echan] += numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape) \
                                    + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
    else:
        if frequency_variable:
            sshape = [nchan // 2]
            signal[:, bchan:echan] += (numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape)
                                   + 1j * numpy.random.normal(0.0, numpy.sqrt(amp/2.0), sshape))[numpy.newaxis, ...]
        else:
            signal[:, bchan:echan] = amp
    return signal
def simulate_DTV ( frequency , times , power = 50e3 , timevariable = False , frequency_variable = False ) : nchan = len ( frequency ) ntimes = len ( times ) shape = [ ntimes , nchan ] bchan = nchan // 4 echan = 3 * nchan // 4 amp = power / ( max ( frequency ) - min ( frequency ) ) signal = numpy . zeros ( shape , dtype = 'complex' ) if timevariable : if frequency_variable : sshape = [ ntimes , nchan // 2 ] signal [ : , bchan : echan ] += numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) + 1j * numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) else : sshape = [ ntimes ] signal [ : , bchan : echan ] += numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) + 1j * numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) else : if frequency_variable : sshape = [ nchan // 2 ] signal [ : , bchan : echan ] += ( numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) + 1j * numpy . random . normal ( 0.0 , numpy . sqrt ( amp / 2.0 ) , sshape ) ) [ numpy . newaxis , ... ] else : signal [ : , bchan : echan ] = amp return signal
Calculate DTV sqrt(power) as a function of time and frequency
Calculate DTV sqrt ( power ) as a function of time and frequency
""" Calculate DTV sqrt(power) as a function of time and frequency

    :param frequency: (sample frequencies)
    :param times: sample times (s)
    :param power: DTV emitted power W
    :return: Complex array [ntimes, nchan]
    """
Complex array [ntimes, nchan]
Complex array [ ntimes nchan ]
frequency
None
times
sample times (s)
sample times ( s )
power
DTV emitted power W
DTV emitted power W
timevariable
frequency_variable