def top_hat_width(subband_df, subband_f0, DM):
    """top_hat_width(subband_df, subband_f0, DM)
    Returns width of a top-hat pulse to convolve with pulses for dipsersion
    broadening. Following Lorimer and Kramer, 2005 (sec 4.1.1 and A2.4)
    subband_df : subband bandwidth (MHz)
    subband_f0 : subband center frequency (MHz)
    DM : dispersion measure (pc/cm^3)
    return top_hat_width (milliseconds)
    """
    D = 4.148808e3  # sec*MHz^2*pc^-1*cm^3, dispersion const
    width_sec = 2*D * DM * (subband_df) / (subband_f0)**3
    return width_sec * 1.0e+3