def downsample_header(header, factor, axis):
    """
    Downsample a FITS header along an axis using the FITS convention for axis number
    """
    header = header.copy()
    cd = 'CDELT{0:d}'.format(axis)
    cp = 'CRPIX{0:d}'.format(axis)
    scalefactor = 1.0 / factor
    header[cp] = (header[cp] - 1) * scalefactor + scalefactor / 2.0 + 0.5
    header[cd] = header[cd] * factor
    return header
