Last active
August 29, 2015 14:23
-
-
Save jbernhard/0c21c79cc2029d403f31 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import division, print_function | |
import sys | |
import numpy as np | |
import h5py | |
def main(): | |
try: | |
outfile = sys.argv[1] | |
except IndexError: | |
print('usage: {} output_hdf5_file'.format(sys.argv[0])) | |
exit(1) | |
with h5py.File(outfile, 'w') as f: | |
for n, l in enumerate(sys.stdin.buffer): | |
positions = np.array(l.split()[:9], dtype=float).reshape(3, -1) | |
f.create_dataset('config_{}'.format(n), data=positions) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment