Skip to content

Commit

Permalink
Merge pull request #15 from zincware/SamTov_summed_mesh
Browse files Browse the repository at this point in the history
Project Updates
  • Loading branch information
SamTov authored Mar 22, 2023
2 parents 0480767 + 2385b02 commit 7fbbc6e
Show file tree
Hide file tree
Showing 31 changed files with 480 additions and 172 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/black.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/flake8.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/isort.yaml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Linting

on:
push:

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Black Check
uses: psf/black@stable

isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install isort
run: |
pip install isort
- name: run isort
run: |
isort --check-only --quiet .
flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install flake8
run: |
pip install flake8
- name: run flake8
run: |
flake8 . --count --show-source --statistics
36 changes: 36 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Python distributions to PyPI

on:
release:
types:
- created

jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
14 changes: 3 additions & 11 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ name: pytest

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
Expand All @@ -19,13 +14,13 @@ jobs:
fail-fast: false
matrix:
python-version:
- 3.7
- 3.8
- 3.9
- "3.10"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -35,8 +30,5 @@ jobs:
run: |
pip install .
- name: Pytest
env:
CUDA_VISIBLE_DEVICES: -1
TF_CPP_MIN_LOG_LEVEL: 3
run: |
pytest .
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
exclude: '.git|.tox'
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-isort]
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"CI"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
26 changes: 1 addition & 25 deletions CI/unit_tests/particle/test_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,4 @@ def test_construct_mesh_dict(self):
self.particle.construct_mesh_dict()

# Check that all particle are in the dict.
self.assertEqual(len(self.particle.mesh_dict), self.particle.position.shape[1])

# Check that they are named correctly.
# Check that they are centered correctly.
for i, item in enumerate(self.particle.mesh_dict):
self.assertEqual(item, f"my_particle_{i}")
np.testing.assert_array_almost_equal(
self.particle.mesh_dict[item].get_center(), self.particle.position[0][i]
)

def test_update_positions(self):
"""
Test the update position method in the Particle module.
Returns
-------
Test whether the positions are updated.
"""
self.particle.construct_mesh_dict()
self.particle.update_position_data(1)

for i, item in enumerate(self.particle.mesh_dict):
np.testing.assert_array_almost_equal(
self.particle.mesh_dict[item].get_center(), self.particle.position[1][i]
)
self.assertEqual(len(self.particle.mesh_dict), self.particle.position.shape[0])
8 changes: 1 addition & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ simulation.
Simply define the particles in the simulation with details including their positions,
colour, direction, and shape, and the visualization engine will display the system
using the Open3D engine.
ZnVis works both from a Python script and in Jupyter!

Installation
^^^^^^^^^^^^
Expand All @@ -33,13 +34,6 @@ Once complete, you will be able to start using the visualizer by importing it as
import znvis
Known limitations
^^^^^^^^^^^^^^^^^
Currently it seems that for medium sized systems (400 particles) running the visualizer
can result in a memory access failure after a while.
This appears to be a fault in the back-end libraries used and has been brought up.
We are working on how to extend ZnVis to arbitrary sized systems.

.. badges
Expand Down
1 change: 0 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ nbsphinx-link
isort
coverage
coveralls
mdanalysis
black
8 changes: 8 additions & 0 deletions docs/source/_developer_docs/_modules/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ZnVis
=====

.. toctree::
:maxdepth: 4

setup
znvis
7 changes: 7 additions & 0 deletions docs/source/_developer_docs/_modules/setup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
setup module
============

.. automodule:: setup
:members:
:undoc-members:
:show-inheritance:
45 changes: 45 additions & 0 deletions docs/source/_developer_docs/_modules/znvis.mesh.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
znvis.mesh package
==================

Submodules
----------

znvis.mesh.custom module
------------------------

.. automodule:: znvis.mesh.custom
:members:
:undoc-members:
:show-inheritance:

znvis.mesh.cylinder module
--------------------------

.. automodule:: znvis.mesh.cylinder
:members:
:undoc-members:
:show-inheritance:

znvis.mesh.mesh module
----------------------

.. automodule:: znvis.mesh.mesh
:members:
:undoc-members:
:show-inheritance:

znvis.mesh.sphere module
------------------------

.. automodule:: znvis.mesh.sphere
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: znvis.mesh
:members:
:undoc-members:
:show-inheritance:
21 changes: 21 additions & 0 deletions docs/source/_developer_docs/_modules/znvis.particle.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
znvis.particle package
======================

Submodules
----------

znvis.particle.particle module
------------------------------

.. automodule:: znvis.particle.particle
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: znvis.particle
:members:
:undoc-members:
:show-inheritance:
22 changes: 22 additions & 0 deletions docs/source/_developer_docs/_modules/znvis.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
znvis package
=============

Subpackages
-----------

.. toctree::
:maxdepth: 4

znvis.mesh
znvis.particle
znvis.testing
znvis.transformations
znvis.visualizer

Module contents
---------------

.. automodule:: znvis
:members:
:undoc-members:
:show-inheritance:
21 changes: 21 additions & 0 deletions docs/source/_developer_docs/_modules/znvis.testing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
znvis.testing package
=====================

Submodules
----------

znvis.testing.znvis\_process module
-----------------------------------

.. automodule:: znvis.testing.znvis_process
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: znvis.testing
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 7fbbc6e

Please sign in to comment.