Skip to content

Instantly share code, notes, and snippets.

@richardjgowers
Created April 28, 2015 10:00
Show Gist options
  • Save richardjgowers/0fd7e43729fa44669512 to your computer and use it in GitHub Desktop.
Save richardjgowers/0fd7e43729fa44669512 to your computer and use it in GitHub Desktop.
Read xvg file
import numpy as np
import sys
def read_xvg(fname):
"""Read columns of data from file fname
Returns numpy array of data
"""
with open(fname, 'r') as f:
for i, line in enumerate(f):
if not line.startswith(('#', '@')):
skip = i
break
return np.genfromtxt(fname, skip_header=skip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment