def get_fd_qnm(template=None, **kwargs):
    """Return a frequency domain damped sinusoid.

    Parameters
    ----------
    template: object
        An object that has attached properties. This can be used to substitute
        for keyword arguments. A common example would be a row in an xml table.
    f_0 : float
        The ringdown-frequency.
    tau : float
        The damping time of the sinusoid.
    amp : float
        The amplitude of the ringdown (constant for now).
    phi : float
        The initial phase of the ringdown. Should also include the information
        from the azimuthal angle (phi_0 + m*Phi).
    inclination : {None, float}, optional
        Inclination of the system in radians for the spherical harmonics.
    l : {2, int}, optional
        l mode for the spherical harmonics. Default is l=2.
    m : {2, int}, optional
        m mode for the spherical harmonics. Default is m=2.
    t_0 :  {0, float}, optional
        The starting time of the ringdown.
    delta_f : {None, float}, optional
        The frequency step used to generate the ringdown.
        If None, it will be set to the inverse of the time at which the
        amplitude is 1/1000 of the peak amplitude.
    f_lower: {None, float}, optional
        The starting frequency of the output frequency series.
        If None, it will be set to delta_f.
    f_final : {None, float}, optional
        The ending frequency of the output frequency series.
        If None, it will be set to the frequency at which the amplitude is
        1/1000 of the peak amplitude.

    Returns
    -------
    hplustilde: FrequencySeries
        The plus phase of the ringdown in frequency domain.
    hcrosstilde: FrequencySeries
        The cross phase of the ringdown in frequency domain.
    """

    input_params = props(template, qnm_required_args, **kwargs)

    f_0 = input_params.pop('f_0')
    tau = input_params.pop('tau')
    amp = input_params.pop('amp')
    phi = input_params.pop('phi')
    # the following have defaults, and so will be populated
    t_0 = input_params.pop('t_0')
    # the following may not be in input_params
    inc = input_params.pop('inclination', None)
    l = input_params.pop('l', 2)
    m = input_params.pop('m', 2)
    delta_f = input_params.pop('delta_f', None)
    f_lower = input_params.pop('f_lower', None)
    f_final = input_params.pop('f_final', None)

    if not delta_f:
        delta_f = 1. / qnm_time_decay(tau, 1./1000)
    if not f_lower:
        f_lower = delta_f
        kmin = 0
    else:
        kmin = int(f_lower / delta_f)
    if not f_final:
        f_final = qnm_freq_decay(f_0, tau, 1./1000)
    if f_final > max_freq:
        f_final = max_freq
    kmax = int(f_final / delta_f) + 1

    freqs = numpy.arange(kmin, kmax)*delta_f
    if inc is not None:
        Y_plus, Y_cross = spher_harms(l, m, inc)
    else:
        Y_plus, Y_cross = 1, 1

    denominator = 1 + (4j * pi * freqs * tau) - (4 * pi_sq * ( freqs*freqs - f_0*f_0) * tau*tau)
    norm = amp * tau / denominator
    if t_0 != 0:
        time_shift = numpy.exp(-1j * two_pi * freqs * t_0)
        norm *= time_shift

    # Analytical expression for the Fourier transform of the ringdown (damped sinusoid)
    hp_tilde = norm * Y_plus * ( (1 + 2j * pi * freqs * tau) * numpy.cos(phi)
                                        - two_pi * f_0 * tau * numpy.sin(phi) )
    hc_tilde = norm * Y_cross * ( (1 + 2j * pi * freqs * tau) * numpy.sin(phi)
                                        + two_pi * f_0 * tau * numpy.cos(phi) )

    outplus = FrequencySeries(zeros(kmax, dtype=complex128), delta_f=delta_f)
    outcross = FrequencySeries(zeros(kmax, dtype=complex128), delta_f=delta_f)
    outplus.data[kmin:kmax] = hp_tilde
    outcross.data[kmin:kmax] = hc_tilde

    return outplus, outcross
def get_fd_qnm ( template = None , ** kwargs ) : input_params = props ( template , qnm_required_args , ** kwargs ) f_0 = input_params . pop ( 'f_0' ) tau = input_params . pop ( 'tau' ) amp = input_params . pop ( 'amp' ) phi = input_params . pop ( 'phi' ) t_0 = input_params . pop ( 't_0' ) inc = input_params . pop ( 'inclination' , None ) l = input_params . pop ( 'l' , 2 ) m = input_params . pop ( 'm' , 2 ) delta_f = input_params . pop ( 'delta_f' , None ) f_lower = input_params . pop ( 'f_lower' , None ) f_final = input_params . pop ( 'f_final' , None ) if not delta_f : delta_f = 1. / qnm_time_decay ( tau , 1. / 1000 ) if not f_lower : f_lower = delta_f kmin = 0 else : kmin = int ( f_lower / delta_f ) if not f_final : f_final = qnm_freq_decay ( f_0 , tau , 1. / 1000 ) if f_final > max_freq : f_final = max_freq kmax = int ( f_final / delta_f ) + 1 freqs = numpy . arange ( kmin , kmax ) * delta_f if inc is not None : Y_plus , Y_cross = spher_harms ( l , m , inc ) else : Y_plus , Y_cross = 1 , 1 denominator = 1 + ( 4j * pi * freqs * tau ) - ( 4 * pi_sq * ( freqs * freqs - f_0 * f_0 ) * tau * tau ) norm = amp * tau / denominator if t_0 != 0 : time_shift = numpy . exp ( - 1j * two_pi * freqs * t_0 ) norm *= time_shift hp_tilde = norm * Y_plus * ( ( 1 + 2j * pi * freqs * tau ) * numpy . cos ( phi ) - two_pi * f_0 * tau * numpy . sin ( phi ) ) hc_tilde = norm * Y_cross * ( ( 1 + 2j * pi * freqs * tau ) * numpy . sin ( phi ) + two_pi * f_0 * tau * numpy . cos ( phi ) ) outplus = FrequencySeries ( zeros ( kmax , dtype = complex128 ) , delta_f = delta_f ) outcross = FrequencySeries ( zeros ( kmax , dtype = complex128 ) , delta_f = delta_f ) outplus . data [ kmin : kmax ] = hp_tilde outcross . data [ kmin : kmax ] = hc_tilde return outplus , outcross
Return a frequency domain damped sinusoid.

    Parameters
    ----------
    template: object
        An object that has attached properties. This can be used to substitute
        for keyword arguments. A common example would be a row in an xml table.
    f_0 : float
        The ringdown-frequency.
    tau : float
        The damping time of the sinusoid.
    amp : float
        The amplitude of the ringdown (constant for now).
    phi : float
        The initial phase of the ringdown. Should also include the information
        from the azimuthal angle (phi_0 + m*Phi).
    inclination : {None, float}, optional
        Inclination of the system in radians for the spherical harmonics.
    l : {2, int}, optional
        l mode for the spherical harmonics. Default is l=2.
    m : {2, int}, optional
        m mode for the spherical harmonics. Default is m=2.
    t_0 :  {0, float}, optional
        The starting time of the ringdown.
    delta_f : {None, float}, optional
        The frequency step used to generate the ringdown.
        If None, it will be set to the inverse of the time at which the
        amplitude is 1/1000 of the peak amplitude.
    f_lower: {None, float}, optional
        The starting frequency of the output frequency series.
        If None, it will be set to delta_f.
    f_final : {None, float}, optional
        The ending frequency of the output frequency series.
        If None, it will be set to the frequency at which the amplitude is
        1/1000 of the peak amplitude.

    Returns
    -------
    hplustilde: FrequencySeries
        The plus phase of the ringdown in frequency domain.
    hcrosstilde: FrequencySeries
        The cross phase of the ringdown in frequency domain.