def write_ctf_comp(fid, comps):
 if (len(comps) <= 0):
  return
 start_block(fid, FIFF.FIFFB_MNE_CTF_COMP)
 for comp in comps:
  start_block(fid, FIFF.FIFFB_MNE_CTF_COMP_DATA)
  write_int(fid, FIFF.FIFF_MNE_CTF_COMP_KIND, comp['ctfkind'])
  if comp.get('save_calibrated', False):
   write_int(fid, FIFF.FIFF_MNE_CTF_COMP_CALIBRATED, comp['save_calibrated'])
  if (not comp.get('save_calibrated', True)):
   comp = deepcopy(comp)
   data = (((1.0 / comp['rowcals'][:, None]) * comp['data']['data']) * (1.0 / comp['colcals'][None, :]))
   comp['data']['data'] = data
  write_named_matrix(fid, FIFF.FIFF_MNE_CTF_COMP_DATA, comp['data'])
  end_block(fid, FIFF.FIFFB_MNE_CTF_COMP_DATA)
 end_block(fid, FIFF.FIFFB_MNE_CTF_COMP)

def write_ctf_comp ( fid , comps ) : if ( len ( comps ) <= 0 ) : return start_block ( fid , FIFF . FIFFB_MNE_CTF_COMP ) for comp in comps : start_block ( fid , FIFF . FIFFB_MNE_CTF_COMP_DATA ) write_int ( fid , FIFF . FIFF_MNE_CTF_COMP_KIND , comp [ 'ctfkind' ] ) if comp . get ( 'save_calibrated' , False ) : write_int ( fid , FIFF . FIFF_MNE_CTF_COMP_CALIBRATED , comp [ 'save_calibrated' ] ) if ( not comp . get ( 'save_calibrated' , True ) ) : comp = deepcopy ( comp ) data = ( ( ( 1.0 / comp [ 'rowcals' ] [ : , None ] ) * comp [ 'data' ] [ 'data' ] ) * ( 1.0 / comp [ 'colcals' ] [ None , : ] ) ) comp [ 'data' ] [ 'data' ] = data write_named_matrix ( fid , FIFF . FIFF_MNE_CTF_COMP_DATA , comp [ 'data' ] ) end_block ( fid , FIFF . FIFFB_MNE_CTF_COMP_DATA ) end_block ( fid , FIFF . FIFFB_MNE_CTF_COMP )
write the ctf compensation data into a fif file .