def _convert_comp_data(res4):
 if (res4['ncomp'] == 0):
  return
 res4['comp'] = sorted(res4['comp'], key=_comp_sort_keys)
 _check_comp(res4['comp'])
 first = 0
 kind = (-1)
 comps = list()
 for k in range(len(res4['comp'])):
  if (res4['comp'][k]['coeff_type'] != kind):
   if (k > 0):
    comps.append(_conv_comp(res4['comp'], first, (k - 1), res4['chs']))
   kind = res4['comp'][k]['coeff_type']
   first = k
 comps.append(_conv_comp(res4['comp'], first, k, res4['chs']))
 return comps

def _convert_comp_data ( res4 ) : if ( res4 [ 'ncomp' ] == 0 ) : return res4 [ 'comp' ] = sorted ( res4 [ 'comp' ] , key = _comp_sort_keys ) _check_comp ( res4 [ 'comp' ] ) first = 0 kind = ( - 1 ) comps = list ( ) for k in range ( len ( res4 [ 'comp' ] ) ) : if ( res4 [ 'comp' ] [ k ] [ 'coeff_type' ] != kind ) : if ( k > 0 ) : comps . append ( _conv_comp ( res4 [ 'comp' ] , first , ( k - 1 ) , res4 [ 'chs' ] ) ) kind = res4 [ 'comp' ] [ k ] [ 'coeff_type' ] first = k comps . append ( _conv_comp ( res4 [ 'comp' ] , first , k , res4 [ 'chs' ] ) ) return comps
convert the compensation data into named matrices .