Skip to content

Commit

Permalink
Merge pull request #12 from dprada/main
Browse files Browse the repository at this point in the history
Adding tests
  • Loading branch information
dprada authored Nov 5, 2021
2 parents 3a17cc0 + 2fa0158 commit 866d9ad
Show file tree
Hide file tree
Showing 158 changed files with 280 additions and 35,951 deletions.
118 changes: 112 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,119 @@
__pycache__/*
*/__pycache__/*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so
*.pyc

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# profraw files from LLVM? Unclear exactly what triggers this
# There are reports this comes from LLVM profiling, but also Xcode 9.
*profraw


# Temp included
INSTALL.log
*.egg-info/*
record.txt
*.ipynb_checkpoints
/docs/api/_autosummary
*.mod
dist/*
*.swp

# In This Library
devtools/playground/*
!devtools/playground/README.md

2 changes: 1 addition & 1 deletion NotePad.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ver: https://doi.org/10.1002/spe.2926



Where are simtk.unit, unyt or Pint published?
Where are openmm.unit, unyt or Pint published?

## Ideas

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ PyUnitWizard
[![codecov](https://codecov.io/gh/uibcdf/PyUnitWizard/branch/master/graph/badge.svg)](https://codecov.io/gh/uibcdf/PyUnitWizard/branch/master)


There are several Python libraries to work with physical quantities in the market, such as pint, unyt or simtk.unit. Imagine that your project or workflow requires the interaction with more than one of these tools, or that you are not sure if you will work with a different quantities library in the future. Wouldn't be having a unique API to work with different forms of physical quantities be a relief? PyUnitWizard just do that. It is the wizard you need in your code to change the form of your quantities with few effort.
There are several Python libraries to work with physical quantities in the market, such as pint, unyt or openmm.unit. Imagine that your project or workflow requires the interaction with more than one of these tools, or that you are not sure if you will work with a different quantities library in the future. Wouldn't be having a unique API to work with different forms of physical quantities be a relief? PyUnitWizard just do that. It is the wizard you need in your code to change the form of your quantities with few effort.

## Example

```ipython
In [1]: import pyunitwizard as puw
In [2]: puw.configure.load_libraries(['pint', 'simtk.unit'])
In [2]: puw.configure.load_libraries(['pint', 'openmm.unit'])
...: puw.configure.set_default_form('pint')
...: puw.configure.set_standard_units(['nm', 'ps', 'kcal', 'mole'])
...:
Expand All @@ -31,13 +31,13 @@ Out[6]: <Unit('nanometer / picosecond')>
In [7]: puw.dimensionality(q)
Out[7]: {'[L]': 1, '[M]': 0, '[T]': -1, '[K]': 0, '[mol]': 0, '[A]': 0, '[Cd]': 0}
In [8]: q2 = puw.convert(q, to_unit='angstroms/femtoseconds', to_form='simtk.unit')
In [8]: q2 = puw.convert(q, to_unit='angstroms/femtoseconds', to_form='openmm.unit')
In [9]: print(q2)
0.025000000000000005 A/fs
In [10]: puw.get_form(q2)
Out[10]: 'simtk.unit'
Out[10]: 'openmm.unit'
In [11]: puw.compatibility(q, q2)
Out[11]: True
Expand All @@ -49,7 +49,7 @@ q3 is now a pint quantity expressed in nanometer / picosecond.
```

## Units Python libraries
- [simtk.unit](https://github.com/openmm/openmm/tree/master/wrappers/python/simtk/unit)
- [openmm.unit](https://github.com/openmm/openmm/tree/master/wrappers/python/simtk/unit)
- [Pint](https://pint.readthedocs.io/en/stable/)
- [unyt](https://unyt.readthedocs.io/en/stable/)

Expand Down
3 changes: 3 additions & 0 deletions devtools/playground/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Any file in this directory will be ignored by git. Jupyter notebook to play with MolSysMT and to
locally test any thing can be placed here.

Binary file removed docs/_build/doctrees/README.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Convert.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Dimensionality.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Importing.doctree
Binary file not shown.
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Installation.doctree
Binary file not shown.
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Quick_Guide.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Standardize.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/contents/Strings.doctree
Binary file not shown.
Binary file removed docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file removed docs/_build/doctrees/index.doctree
Binary file not shown.
178 changes: 0 additions & 178 deletions docs/_build/doctrees/nbsphinx/contents/Convert.ipynb

This file was deleted.

Loading

0 comments on commit 866d9ad

Please sign in to comment.