-
-
Save sbrodehl/12850781a98772065539a777a621a0bd 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 first two columns of data from xvg file fname | |
Returns numpy array of data | |
""" | |
skip = 0 | |
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, usecols=(0, 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment