Giter VIP home page Giter VIP logo

pyh5md's Introduction

pyh5md : Read and write H5MD files

Copyright 2012-2017 Pierre de Buyl and contributors
License: BSD

pyh5md is a library to read and write easily H5MD files. H5MD is a file format specification based on HDF5 to store molecular data. pyh5md is built on top of h5py, the HDF5 for Python library by Andrew Colette.

pyh5md used to define a complex class structure. Since version 1.0.0.dev1, a light subclassing of h5py's classes is used instead.

Install

python setup.py install --user

or

pip install --user .

installs pyh5md for the current user

Examples

Once pyh5md is installed:

cd examples
python random_walk_1d.py

executes an example program that generates the H5MD file walk_1d.h5.

Usage

To write data to a particles group named "atoms", with a fixed set of positions:

from pyh5md import File, element
kwargs = {'creator': 'pyh5md README example',
          'author': 'Pierre de Buyl',
		  }
with File('new_file.h5', 'w', **kwargs) as f:
    g = f.particles_group('atoms')
	g.create_box(dimension=3, boundary=['none']*3)
	element(g, 'position', store='fixed', data=np.random.random(size=(32, 3)))

To read data from a H5MD file created with, for instance, LAMMPS:

from pyh5md import File, element
with File('dump_3d.h5', 'r') as f:
    g = f.particles_group('all')
    box_edges = element(g, 'box/edges').value[0]
    position = element(g, 'position').value[:]

pyh5md's People

Contributors

pdebuyl avatar

Stargazers

Fabian Zills avatar Yohsuke T. Fukai avatar Dr. Renard Sc.D avatar Ben Landrum avatar Manuel Carrer avatar Oliver Beckstein avatar Yang Zhou avatar Richard Gowers avatar Jakub Krajniak avatar David Hart avatar Nicolas Höft avatar Alex Liberzon avatar

Watchers

Oliver Beckstein avatar Jakub Krajniak avatar James Cloos avatar  avatar  avatar

pyh5md's Issues

Problem with import py3

I am getting such error:

@lukrecja lennard_jones $ python lj_h5md.py 
Traceback (most recent call last):
  File "lj_h5md.py", line 5, in <module>
    import espressopp
  File "/home/teodor/project/phd/espressopp/sim-espressopp/espressopp/__init__.py", line 65, in <module>
    from espressopp import esutil, bc, storage, integrator, interaction, analysis, tools, standard_system, external, check, io
  File "/home/teodor/project/phd/espressopp/sim-espressopp/espressopp/analysis/__init__.py", line 68, in <module>
    from espressopp.analysis.PyStore import *
  File "/home/teodor/project/phd/espressopp/sim-espressopp/espressopp/analysis/PyStore.py", line 10, in <module>
    import pyh5md
  File "/home/teodor/.local/pyh5md/pdebuyl/lib/python2.7/site-packages/pyh5md/__init__.py", line 24, in <module>
    from core import *
  File "/home/teodor/.local/pyh5md/pdebuyl/lib/python2.7/site-packages/pyh5md/core.py", line 15, in <module>
    from pyh5md.utils import create_compact_dataset
  File "/home/teodor/.local/pyh5md/pdebuyl/lib/python2.7/site-packages/pyh5md/utils.py", line 19, in <module>
    from h5py._hl.base import HLObject, py3
ImportError: cannot import name py3

now when I remove that py3 import then everything is fine. I checked h5py/_hl/base.py and there is nothing like py3. Is it some compatibility tools for Python 3.x?

Adding pyh5md conda-forge conda package

Hello,

I'm Edis, an undergraduate at ASU working with Dr. Oliver Beckstein and Beckstein Lab over the summer as an REU student.

The project I've been working on is implementing an h5md file coordinate reader/writer in MDAnalysis, where I've been using the pyh5md library to create and read from .h5md files. Here's a link to the issue on MDA where some of the progress has been documented.

I've opened this issue because we eventually need a pyh5md conda package for MDA and we are happy to help :).

Test suite

Sooner or later pyh5md should have a test suite. And sooner is better than later in my opinion. I'd be happy to start writing some tests, but we (all contributors) should agree on the tools for this. My personal favorite is nose, which allows much more light-weight tests than Python's unittest module. On the other hand, it's one more piece to install (only for contributors, not for users).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.