Skip to content

Instantly share code, notes, and snippets.

@jbernhard
Last active August 29, 2015 14:23
Show Gist options
  • Save jbernhard/0c21c79cc2029d403f31 to your computer and use it in GitHub Desktop.
Save jbernhard/0c21c79cc2029d403f31 to your computer and use it in GitHub Desktop.
#!/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