def _check_roundtrip(montage, fname):
 assert_equal(montage.coord_frame, 'head')
 montage.save(fname)
 montage_read = read_dig_montage(fif=fname)
 assert_equal(str(montage), str(montage_read))
 for kind in ('elp', 'hsp', 'nasion', 'lpa', 'rpa'):
  assert_allclose(getattr(montage, kind), getattr(montage_read, kind), err_msg=kind)
 assert_equal(montage_read.coord_frame, 'head')

def _check_roundtrip ( montage , fname ) : assert_equal ( montage . coord_frame , 'head' ) montage . save ( fname ) montage_read = read_dig_montage ( fif = fname ) assert_equal ( str ( montage ) , str ( montage_read ) ) for kind in ( 'elp' , 'hsp' , 'nasion' , 'lpa' , 'rpa' ) : assert_allclose ( getattr ( montage , kind ) , getattr ( montage_read , kind ) , err_msg = kind ) assert_equal ( montage_read . coord_frame , 'head' )
check roundtrip writing .