Skip to content

Commit

Permalink
Merge pull request #31 from SimoneMartino98/minor_fixes
Browse files Browse the repository at this point in the history
Merging this pull request, which solves a few minor issues:
* #8 added dev installation to the README
* #14 updated onion documentation
* #30 added onion-clustering to dependencies and removed it from the dev dependancies ones
* Updated the maintainers to include @matteobecchi and @SimoneMartino98

Thank you, @SimoneMartino98
  • Loading branch information
andrewtarzia authored Sep 10, 2024
2 parents 7056001 + e5f58ff commit 6e4d1ba
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
python-version: "3.10"
cache: "pip"
- run: pip install -e '.[dev]'
- run: ruff .
- run: ruff check .
mypy:
runs-on: ubuntu-22.04
steps:
Expand Down
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
:maintainers:
`andrewtarzia <https://github.com/andrewtarzia/>`_
`andrewtarzia <https://github.com/andrewtarzia/>`_;
`matteobecchi <https://github.com/matteobecchi/>`_;
`simonemartino <https://github.com/SimoneMartino98/>`_
:documentation: https://dynsight.readthedocs.io

Installation
Expand All @@ -10,6 +12,20 @@ To get ``dynsight``, you can install it with pip::
$ pip install dynsight


Developer Setup
===============

1. Install `just`_.
2. In a new virtual environment run using Python 3.10::

$ just dev

3. Run code checks::
$ just check

.. _`just`: https://github.com/casey/just

Examples
========

Expand Down
4 changes: 2 additions & 2 deletions docs/source/onion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ Example: clustering of multivariate time-series

OnionMulti <_autosummary/dynsight.onion.OnionMulti.rst>

The code for performing clustering on multi time-series can be found in ``examples/onion_multi.py``. The only difference in the usage is that when you run the script you have to specify all the input files, each one containing a different variable:
The code for performing clustering on multi time-series can be found in ``examples/onion_multi.py``. The only differences is that the input file has to be an .npy or .npz containing a numpy.ndarray with shape (D, N, T), where D is the number of variables (2 or 3). It is then called with

``python3 onion_multi.py path/to/input/file_0.npy path/to/input/file_1.npy``
``python3 onion_multi.py path/to/input/file.npy``
3 changes: 2 additions & 1 deletion examples/file_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import pathlib
import sys

import dynsight
import h5py
from MDAnalysis import Universe

import dynsight

logging.basicConfig(
level=logging.INFO,
format="%(asctime)s | %(levelname)s | %(message)s",
Expand Down
3 changes: 2 additions & 1 deletion examples/lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import pathlib
import sys

import dynsight
import h5py
import matplotlib.pyplot as plt

import dynsight

logging.basicConfig(
level=logging.INFO,
format="%(asctime)s | %(levelname)s | %(message)s",
Expand Down
3 changes: 2 additions & 1 deletion examples/time_soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import pathlib
import sys

import dynsight
import h5py
import matplotlib.pyplot as plt
import numpy as np

import dynsight

logging.basicConfig(
level=logging.INFO,
format="%(asctime)s | %(levelname)s | %(message)s",
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ build-backend = "setuptools.build_meta"
name = "dynsight"
maintainers = [
{ name = "Andrew Tarzia", email = "andrew.tarzia@gmail.com" },
{ name = "Matteo Becchi", email = "bechmath@gmail.com"},
{ name = "Simone Martino", email = "s.martino0898@gmail.com"},
]

dependencies = [
"cpctools",
"dscribe >1.2.0, <=1.2.2",
"onion-clustering",
]
# Set by cpctools.
requires-python = "<3.11,>=3.8"
Expand All @@ -30,7 +33,6 @@ dev = [
"twine",
"furo",
"numba",
"onion-clustering",
]

[project.urls]
Expand Down
3 changes: 2 additions & 1 deletion tests/lens/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import pathlib # noqa: TCH003

import dynsight
import MDAnalysis
import numpy as np
import pytest

import dynsight


def fewframeuniverse(
trajectory: list[list[list[int]]],
Expand Down
3 changes: 2 additions & 1 deletion tests/lens/test_count_neigh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

from typing import TYPE_CHECKING

import dynsight
import MDAnalysis
import numpy as np
from numpy.testing import assert_array_equal

import dynsight

from .utilities import is_sorted

if TYPE_CHECKING:
Expand Down
3 changes: 2 additions & 1 deletion tests/lens/test_emulate_lens.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from typing import TYPE_CHECKING

import dynsight
import numpy as np
from numpy.testing import assert_array_almost_equal

import dynsight

if TYPE_CHECKING:
import pathlib

Expand Down
3 changes: 2 additions & 1 deletion tests/lens/test_lens.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from pathlib import Path

import dynsight
import h5py
import numpy as np

import dynsight


def test_lens_signals() -> None:
"""Test the consistency of LENS calculations with a control calculation.
Expand Down
3 changes: 2 additions & 1 deletion tests/lens/test_special_lens.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import dynsight
import MDAnalysis
import numpy as np
from numpy.testing import assert_array_equal

import dynsight


def test_special_lens(lensfixtures: MDAnalysis.Universe) -> None:
"""Test :class:`.` SOMETHING.
Expand Down
11 changes: 3 additions & 8 deletions tests/onion/output_multi/final_states.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#center_coords, semiaxis, fraction_of_data
[-9.217402795162704, 0.8671904740262623] [33.945254636130386, 22.46005166079635] 0.73
[17.654521861274752, 40.70380484547634] [10.189158728161274, 22.988963620172285] 0.074
[-0.9549435822358326, 21.694181975980854] [42.81775243259092, 10.799453604676156] 0.066
[8.762548476254363, -25.782312046886265] [18.606829594259793, 13.502135433544812] 0.062
[20.888067778317723, 2.4339018657723788] [9.204690309963093, 17.1340229561863] 0.02
[47.46513497795252, -39.11984327088997] [89.66256446734177, 10.351158875005384] 0.01
[40.5609722076551, -1.4023316935773076] [6.597585788934516, 17.391048803811703] 0.008
[-20.557255476627713, 27.57182121053266] [6.737239162308862, 10.523198493586497] 0.004
[-4.884215210771138, 5.875825445555712] [42.49235200752218, 39.105473589727524] 0.992
[16.889434998848554, 42.960777466708876] [23.023489207065, 35.921315853945174] 0.006
[-42.34473154834106, 25.025975116712356] [5.261471202436318, 3.7104547182238203] 0.002
2 changes: 1 addition & 1 deletion tests/onion/output_multi/fraction_0.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# tau_window fraction in ENV0 for different t_smooth
1.000000000000000000e+01 2.600000000000002309e-02
1.000000000000000000e+01 0.000000000000000000e+00
2 changes: 1 addition & 1 deletion tests/onion/output_multi/number_of_states.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# tau_window number_of_states for different t_smooth
10 9
10 3
15 changes: 11 additions & 4 deletions tests/onion/output_uni/final_states.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
####################################
# Mu Sigma A state_fraction
-4.438261940387309 13.803915411767766 4164.151761014315 0.824
32.16777927755445 3.102021970732714 140.28469675425177 0.028
41.3743936963291 3.834727957507484 203.02063626379885 0.044
50.941700398008386 3.7730568339013524 425.21039717312294 0.092
-2.308030920563922 14.897682643328688 4178.444728092517 0.83
33.702615222102075 4.616618331212346 191.09032200086418 0.036
42.128752424262075 4.592969491670723 68.4171470337773 0.026
51.7995729641774 5.435395431244352 490.5824660778189 0.108
####################################
# Mu Sigma A state_fraction
-2.308030920563922 14.897682643328688 4178.444728092517 0.83
33.702615222102075 4.616618331212346 191.09032200086418 0.036
42.128752424262075 4.592969491670723 68.4171470337773 0.026
51.7995729641774 5.435395431244352 490.5824660778189 0.108
2 changes: 1 addition & 1 deletion tests/onion/output_uni/fraction_0.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# tau_window fraction in ENV0 for different t_smooth
1.000000000000000000e+01 1.200000000000001066e-02
1.000000000000000000e+01 0.000000000000000000e+00
2 changes: 1 addition & 1 deletion tests/onion/output_uni/number_of_states.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# tau_window number_of_states for different t_smooth
10 5
10 4
5 changes: 3 additions & 2 deletions tests/onion/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from pathlib import Path
from typing import Generator

import dynsight
import numpy as np
import pytest

import dynsight


@pytest.fixture()
@pytest.fixture
def original_wd() -> Generator[Path, None, None]:
original_dir = Path.cwd()

Expand Down
5 changes: 3 additions & 2 deletions tests/onion/test_uni.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from pathlib import Path
from typing import Generator

import dynsight
import numpy as np
import pytest

import dynsight


@pytest.fixture()
@pytest.fixture
def original_wd() -> Generator[Path, None, None]:
original_dir = Path.cwd()

Expand Down
3 changes: 2 additions & 1 deletion tests/soap/test_soap.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from pathlib import Path

import dynsight
import h5py
import numpy as np

import dynsight


def test_soap_vectors() -> None:
"""Test the consistency of SOAP calculations with a control calculation.
Expand Down
3 changes: 2 additions & 1 deletion tests/soap/test_tsoap.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from pathlib import Path

import dynsight
import h5py
import numpy as np

import dynsight


def test_time_soap_vectors() -> None:
"""Test the consistency of tSOAP calculations with a control calculation.
Expand Down

0 comments on commit 6e4d1ba

Please sign in to comment.