Skip to content

Commit

Permalink
v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandezfran committed Jul 27, 2022
1 parent af40f5b commit 4043d2c
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sierras_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@master
Expand Down
6 changes: 3 additions & 3 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Submodules
:show-inheritance:
:member-order: bysource

``sierras.diffusion`` module
----------------------------
``sierras.get_diffusion_coefficient`` module
--------------------------------------------

.. automodule:: sierras.diffusion
.. automodule:: sierras.get_diffusion_coefficient
:members:
:undoc-members:
:show-inheritance:
Expand Down
4 changes: 2 additions & 2 deletions sierras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@

__author__ = "Francisco Fernandez"
__email__ = "fernandezfrancisco2195@gmail.com"
__version__ = "0.1.0"
__version__ = "0.1.1"


# ============================================================================
# IMPORTS
# ============================================================================

from .arrhenius import ArrheniusDiffusion # noqa
from .diffusion import get_diffusion_coefficient # noqa
from .get_diffusion_coefficient import from_msd, from_vacf # noqa
9 changes: 7 additions & 2 deletions sierras/diffusion.py → sierras/get_diffusion_coefficient.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# DOCS
# ============================================================================

"""Function to fit the mean square displacement."""
"""Functions to obtain the diffusion coefficient."""

# ============================================================================
# IMPORTS
Expand All @@ -25,7 +25,7 @@
# ============================================================================


def get_diffusion_coefficient(
def from_msd(
time, msd, start=0, stop=None, ndim=3, sample_weight=None, lr_kws=None
):
"""To obtain the trace diffusion coefficient from mean square displacement.
Expand Down Expand Up @@ -77,3 +77,8 @@ def get_diffusion_coefficient(
dcoef = reg.coef_[0] / (2 * ndim)

return dcoef, reg


def from_vacf():
"""To obtain it from the velocity autocorrelation function."""
raise NotImplementedError
6 changes: 3 additions & 3 deletions tests/test_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import pytest

import sierras.diffusion
import sierras.get_diffusion_coefficient

# ============================================================================
# TESTS
Expand All @@ -31,7 +31,7 @@
(0, 50, (0.70261868, (4.215712, -0.1003175))),
],
)
def test_get_diffusion_coefficient(start, stop, reference):
def test_get_diffusion_coefficient_from_msd(start, stop, reference):
"""Test the linear regression to get the trace diffusion coefficient.
This test uses data of a Lennard-Jones fluid in its liquid phase.
Expand Down Expand Up @@ -242,7 +242,7 @@ def test_get_diffusion_coefficient(start, stop, reference):
]
)

dcoeff, reg = sierras.diffusion.get_diffusion_coefficient(
dcoeff, reg = sierras.get_diffusion_coefficient.from_msd(
time_data, msd_data, start=start, stop=stop
)

Expand Down
35 changes: 18 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ envlist = style, docstyle, check-manifest, docs, py39, coverage

[gh-actions]
python =
3.9: style, docstyle, check-manifest, docs, py39, coverage
3.9: py39
3.10: style, docstyle, check-manifest, docs, py310, coverage

# =============================================================================
# ENVS
# =============================================================================


[testenv]
deps =
pytest
commands =
pytest tests/ {posargs}

[testenv:style]
skip_install = True
usedevelop = False
Expand All @@ -31,16 +26,6 @@ deps = flake8
commands =
flake8 setup.py tests/ sierras/ {posargs}

[testenv:coverage]
deps =
{[testenv]deps}
coverage
pytest-cov
commands =
coverage erase
pytest -q tests/ --cov=sierras/ --cov-append --cov-report=
coverage report --fail-under=90 -m

[testenv:docstyle]
deps = pydocstyle
commands =
Expand All @@ -62,3 +47,19 @@ deps =
-r {toxinidir}/docs/requirements.txt
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees source {envtmpdir}/html

[testenv]
deps =
pytest
commands =
pytest tests/ {posargs}

[testenv:coverage]
deps =
{[testenv]deps}
coverage
pytest-cov
commands =
coverage erase
pytest -q tests/ --cov=sierras/ --cov-append --cov-report=
coverage report --fail-under=90 -m

0 comments on commit 4043d2c

Please sign in to comment.