def write_fiducials(fname, pts, coord_frame=0):
    "Write fiducials to a fiff file\n\n    Parameters\n    ----------\n    fname : str\n        Destination file name.\n    pts : iterator of dict\n        Iterator through digitizer points. Each point is a dictionary with\n        the keys 'kind', 'ident' and 'r'.\n    coord_frame : int\n        The coordinate frame of the points (one of\n        mne.fiff.FIFF.FIFFV_COORD_...)\n    "
    pts_frames = set((pt.get('coord_frame', coord_frame) for pt in pts))
    bad_frames = (pts_frames - set((coord_frame,)))
    if (len(bad_frames) > 0):
        err = ('Points have coord_frame entries that are incompatible with coord_frame=%i: %s.' % (coord_frame, str(tuple(bad_frames))))
        raise ValueError(err)
    fid = start_file(fname)
    start_block(fid, FIFF.FIFFB_ISOTRAK)
    write_int(fid, FIFF.FIFF_MNE_COORD_FRAME, coord_frame)
    for pt in pts:
        write_dig_point(fid, pt)
    end_block(fid, FIFF.FIFFB_ISOTRAK)
    end_file(fid)
Write fiducials to a fiff file

Parameters
----------
fname : str
    Destination file name.
pts : iterator of dict
    Iterator through digitizer points. Each point is a dictionary with
    the keys 'kind', 'ident' and 'r'.
coord_frame : int
    The coordinate frame of the points (one of
    mne.fiff.FIFF.FIFFV_COORD_...)
def write_fiducials(fname, pts, coord_frame=0):
    "Write fiducials to a fiff file\n\n    Parameters\n    ----------\n    fname : str\n        Destination file name.\n    pts : iterator of dict\n        Iterator through digitizer points. Each point is a dictionary with\n        the keys 'kind', 'ident' and 'r'.\n    coord_frame : int\n        The coordinate frame of the points (one of\n        mne.fiff.FIFF.FIFFV_COORD_...)\n    "
    pts_frames = set((pt.get('coord_frame', coord_frame) for pt in pts))
    bad_frames = (pts_frames - set((coord_frame,)))
    if (len(bad_frames) > 0):
        err = ('Points have coord_frame entries that are incompatible with coord_frame=%i: %s.' % (coord_frame, str(tuple(bad_frames))))
        raise ValueError(err)
    fid = start_file(fname)
    start_block(fid, FIFF.FIFFB_ISOTRAK)
    write_int(fid, FIFF.FIFF_MNE_COORD_FRAME, coord_frame)
    for pt in pts:
        write_dig_point(fid, pt)
    end_block(fid, FIFF.FIFFB_ISOTRAK)
    end_file(fid)