def _write_dig_points(fname, dig_points):
 (_, ext) = op.splitext(fname)
 dig_points = np.asarray(dig_points)
 if ((dig_points.ndim != 2) or (dig_points.shape[1] != 3)):
  err = ('Points must be of shape (n_points, 3), not %s' % (dig_points.shape,))
  raise ValueError(err)
 if (ext == '.txt'):
  with open(fname, 'wb') as fid:
   version = __version__
   now = dt.now().strftime('%I:%M%p on %B %d, %Y')
   fid.write(b('% Ascii 3D points file created by mne-python version {version} at {now}\n'.format(version=version, now=now)))
   fid.write(b('% {N} 3D points, x y z per line\n'.format(N=len(dig_points))))
   np.savetxt(fid, dig_points, delimiter=' DCTB ', newline='\n')
 else:
  msg = ("Unrecognized extension: %r. Need '.txt'." % ext)
  raise ValueError(msg)

def _write_dig_points ( fname , dig_points ) : ( _ , ext ) = op . splitext ( fname ) dig_points = np . asarray ( dig_points ) if ( ( dig_points . ndim != 2 ) or ( dig_points . shape [ 1 ] != 3 ) ) : err = ( 'Points must be of shape (n_points, 3), not %s' % ( dig_points . shape , ) ) raise ValueError ( err ) if ( ext == '.txt' ) : with open ( fname , 'wb' ) as fid : version = __version__ now = dt . now ( ) . strftime ( '%I:%M%p on %B %d, %Y' ) fid . write ( b ( '% Ascii 3D points file created by mne-python version {version} at {now}\n' . format ( version = version , now = now ) ) ) fid . write ( b ( '% {N} 3D points, x y z per line\n' . format ( N = len ( dig_points ) ) ) ) np . savetxt ( fid , dig_points , delimiter = ' DCTB ' , newline = '\n' ) else : msg = ( "Unrecognized extension: %r. Need '.txt'." % ext ) raise ValueError ( msg )
write points to text file .