Created
April 28, 2015 10:00
-
-
Save richardjgowers/0fd7e43729fa44669512 to your computer and use it in GitHub Desktop.
Read xvg file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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