def write_meas_info(fid, info, data_type=None, reset_range=True):
    "Write measurement info into a file id (from a fif file)\n\n    Parameters\n    ----------\n    fid : file\n        Open file descriptor\n    info : instance of mne.fiff.meas_info.Info\n        The measurement info structure\n    data_type : int\n        The data_type in case it is necessary. Should be 4 (FIFFT_FLOAT),\n        5 (FIFFT_DOUBLE), or 16 (mne.fiff.FIFF.FIFFT_DAU_PACK16) for\n        raw data.\n    reset_range : bool\n        If True, info['chs'][k]['range'] will be set to unity.\n\n    Note\n    ----\n    Tags are written in a particular order for compatibility with maxfilter\n    "
    start_block(fid, FIFF.FIFFB_MEAS_INFO)
    write_extra_meas_info(fid, info)
    if (info['dig'] is not None):
        start_block(fid, FIFF.FIFFB_ISOTRAK)
        for d in info['dig']:
            write_dig_point(fid, d)
        end_block(fid, FIFF.FIFFB_ISOTRAK)
    if ((info['acq_pars'] is not None) or (info['acq_stim'] is not None)):
        start_block(fid, FIFF.FIFFB_DACQ_PARS)
        if (info['acq_pars'] is not None):
            write_string(fid, FIFF.FIFF_DACQ_PARS, info['acq_pars'])
        if (info['acq_stim'] is not None):
            write_string(fid, FIFF.FIFF_DACQ_STIM, info['acq_stim'])
        end_block(fid, FIFF.FIFFB_DACQ_PARS)
    if (info['dev_head_t'] is not None):
        write_coord_trans(fid, info['dev_head_t'])
    if (info['ctf_head_t'] is not None):
        write_coord_trans(fid, info['ctf_head_t'])
    write_proj(fid, info['projs'])
    write_ctf_comp(fid, info['comps'])
    if (len(info['bads']) > 0):
        start_block(fid, FIFF.FIFFB_MNE_BAD_CHANNELS)
        write_name_list(fid, FIFF.FIFF_MNE_CH_NAME_LIST, info['bads'])
        end_block(fid, FIFF.FIFFB_MNE_BAD_CHANNELS)
    if (info.get('experimenter') is not None):
        write_string(fid, FIFF.FIFF_EXPERIMENTER, info['experimenter'])
    if (info.get('description') is not None):
        write_string(fid, FIFF.FIFF_DESCRIPTION, info['description'])
    if (info.get('proj_id') is not None):
        write_int(fid, FIFF.FIFF_PROJ_ID, info['proj_id'])
    if (info.get('proj_name') is not None):
        write_string(fid, FIFF.FIFF_PROJ_NAME, info['proj_name'])
    if (info.get('meas_date') is not None):
        write_int(fid, FIFF.FIFF_MEAS_DATE, info['meas_date'])
    write_int(fid, FIFF.FIFF_NCHAN, info['nchan'])
    write_float(fid, FIFF.FIFF_SFREQ, info['sfreq'])
    write_float(fid, FIFF.FIFF_LOWPASS, info['lowpass'])
    write_float(fid, FIFF.FIFF_HIGHPASS, info['highpass'])
    if (info.get('line_freq') is not None):
        write_float(fid, FIFF.FIFF_LINE_FREQ, info['line_freq'])
    if (data_type is not None):
        write_int(fid, FIFF.FIFF_DATA_PACK, data_type)
    for (k, c) in enumerate(info['chs']):
        c = deepcopy(c)
        c['scanno'] = (k + 1)
        if (reset_range is True):
            c['range'] = 1.0
        write_ch_info(fid, c)
    if (info.get('subject_info') is not None):
        start_block(fid, FIFF.FIFFB_SUBJECT)
        si = info['subject_info']
        if (si.get('id') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_ID, si['id'])
        if (si.get('his_id') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_HIS_ID, si['his_id'])
        if (si.get('last_name') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_LAST_NAME, si['last_name'])
        if (si.get('first_name') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_FIRST_NAME, si['first_name'])
        if (si.get('birthday') is not None):
            write_julian(fid, FIFF.FIFF_SUBJ_BIRTH_DAY, si['birthday'])
        if (si.get('sex') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_SEX, si['sex'])
        if (si.get('hand') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_HAND, si['hand'])
        end_block(fid, FIFF.FIFFB_SUBJECT)
    end_block(fid, FIFF.FIFFB_MEAS_INFO)
Write measurement info into a file id (from a fif file)

Parameters
----------
fid : file
    Open file descriptor
info : instance of mne.fiff.meas_info.Info
    The measurement info structure
data_type : int
    The data_type in case it is necessary. Should be 4 (FIFFT_FLOAT),
    5 (FIFFT_DOUBLE), or 16 (mne.fiff.FIFF.FIFFT_DAU_PACK16) for
    raw data.
reset_range : bool
    If True, info['chs'][k]['range'] will be set to unity.

Note
----
Tags are written in a particular order for compatibility with maxfilter
def write_meas_info(fid, info, data_type=None, reset_range=True):
    "Write measurement info into a file id (from a fif file)\n\n    Parameters\n    ----------\n    fid : file\n        Open file descriptor\n    info : instance of mne.fiff.meas_info.Info\n        The measurement info structure\n    data_type : int\n        The data_type in case it is necessary. Should be 4 (FIFFT_FLOAT),\n        5 (FIFFT_DOUBLE), or 16 (mne.fiff.FIFF.FIFFT_DAU_PACK16) for\n        raw data.\n    reset_range : bool\n        If True, info['chs'][k]['range'] will be set to unity.\n\n    Note\n    ----\n    Tags are written in a particular order for compatibility with maxfilter\n    "
    start_block(fid, FIFF.FIFFB_MEAS_INFO)
    write_extra_meas_info(fid, info)
    if (info['dig'] is not None):
        start_block(fid, FIFF.FIFFB_ISOTRAK)
        for d in info['dig']:
            write_dig_point(fid, d)
        end_block(fid, FIFF.FIFFB_ISOTRAK)
    if ((info['acq_pars'] is not None) or (info['acq_stim'] is not None)):
        start_block(fid, FIFF.FIFFB_DACQ_PARS)
        if (info['acq_pars'] is not None):
            write_string(fid, FIFF.FIFF_DACQ_PARS, info['acq_pars'])
        if (info['acq_stim'] is not None):
            write_string(fid, FIFF.FIFF_DACQ_STIM, info['acq_stim'])
        end_block(fid, FIFF.FIFFB_DACQ_PARS)
    if (info['dev_head_t'] is not None):
        write_coord_trans(fid, info['dev_head_t'])
    if (info['ctf_head_t'] is not None):
        write_coord_trans(fid, info['ctf_head_t'])
    write_proj(fid, info['projs'])
    write_ctf_comp(fid, info['comps'])
    if (len(info['bads']) > 0):
        start_block(fid, FIFF.FIFFB_MNE_BAD_CHANNELS)
        write_name_list(fid, FIFF.FIFF_MNE_CH_NAME_LIST, info['bads'])
        end_block(fid, FIFF.FIFFB_MNE_BAD_CHANNELS)
    if (info.get('experimenter') is not None):
        write_string(fid, FIFF.FIFF_EXPERIMENTER, info['experimenter'])
    if (info.get('description') is not None):
        write_string(fid, FIFF.FIFF_DESCRIPTION, info['description'])
    if (info.get('proj_id') is not None):
        write_int(fid, FIFF.FIFF_PROJ_ID, info['proj_id'])
    if (info.get('proj_name') is not None):
        write_string(fid, FIFF.FIFF_PROJ_NAME, info['proj_name'])
    if (info.get('meas_date') is not None):
        write_int(fid, FIFF.FIFF_MEAS_DATE, info['meas_date'])
    write_int(fid, FIFF.FIFF_NCHAN, info['nchan'])
    write_float(fid, FIFF.FIFF_SFREQ, info['sfreq'])
    write_float(fid, FIFF.FIFF_LOWPASS, info['lowpass'])
    write_float(fid, FIFF.FIFF_HIGHPASS, info['highpass'])
    if (info.get('line_freq') is not None):
        write_float(fid, FIFF.FIFF_LINE_FREQ, info['line_freq'])
    if (data_type is not None):
        write_int(fid, FIFF.FIFF_DATA_PACK, data_type)
    for (k, c) in enumerate(info['chs']):
        c = deepcopy(c)
        c['scanno'] = (k + 1)
        if (reset_range is True):
            c['range'] = 1.0
        write_ch_info(fid, c)
    if (info.get('subject_info') is not None):
        start_block(fid, FIFF.FIFFB_SUBJECT)
        si = info['subject_info']
        if (si.get('id') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_ID, si['id'])
        if (si.get('his_id') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_HIS_ID, si['his_id'])
        if (si.get('last_name') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_LAST_NAME, si['last_name'])
        if (si.get('first_name') is not None):
            write_string(fid, FIFF.FIFF_SUBJ_FIRST_NAME, si['first_name'])
        if (si.get('birthday') is not None):
            write_julian(fid, FIFF.FIFF_SUBJ_BIRTH_DAY, si['birthday'])
        if (si.get('sex') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_SEX, si['sex'])
        if (si.get('hand') is not None):
            write_int(fid, FIFF.FIFF_SUBJ_HAND, si['hand'])
        end_block(fid, FIFF.FIFFB_SUBJECT)
    end_block(fid, FIFF.FIFFB_MEAS_INFO)