Skip to content

Commit

Permalink
Make it compatible with scikit-image version >= 0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fevangelista committed Feb 22, 2022
1 parent 46ba1ee commit f43dd9a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 15 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ pip install fortecubeview
```

## Dependencies
forte4cubeview requires [pythreejs](https://github.com/jupyter-widgets/pythreejs).
forte4cubeview requires [pythreejs](https://github.com/jupyter-widgets/pythreejs) and [scikit-image](https://github.com/scikit-image/scikit-image).

To install pythreejs via pip:
```
pip install pythreejs
```

To install pythreejs via conda:
```
conda install -c conda-forge pythreejs
conda install nodejs -c conda-forge --repodata-fn=repodata.json
```

And then install the extension for jupyter notebooks
```
jupyter nbextension install --py --symlink --sys-prefix pythreejs
Expand Down
30 changes: 18 additions & 12 deletions examples/psi4/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# fortecubeview\n",
"# How to use `fortecubeview`\n",
"\n",
"fortecubeview is a simple cube file viewer. It is designed to work with `psi4` and `forte`. However, it should work with any cube file.\n",
"---\n",
"\n",
"`fortecubeview` is a simple cube file viewer. It is designed to work with `psi4` and `forte`. However it is compatible with any other code that can generate standard cube files.\n",
"\n",
"The cube file in this directory were generated with the following psi4 input file:\n",
"This directory contains the following cube files:\n",
"\n",
"```bash\n",
"Da.cube\n",
"Db.cube\n",
"Ds.cube\n",
"Dt.cube\n",
"Psi_a_5_1-B1.cube\n",
"Psi_a_6_4-A1.cube\n",
"```\n",
"\n",
"These were generated with the following psi4 input file:\n",
"\n",
"```python\n",
"import psi4\n",
"\n",
"h2o = psi4.geometry(\"\"\"\n",
Expand Down Expand Up @@ -136,18 +149,11 @@
"source": [
"fortecubeview.vib('output.nh3.molden_normal_modes')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -161,7 +167,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
"version": "3.9.9"
}
},
"nbformat": 4,
Expand Down
8 changes: 7 additions & 1 deletion fortecubeview/py3js_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,13 @@ def __compute_isosurface(self, data, level, color, extent=None):
-------
a tuple of vertices and faces
"""
values = skimage.measure.marching_cubes_lewiner(data, level * 0.995)
# call the appropriate version of skimage's marching cubes
from packaging.version import parse as parse_version
if parse_version(skimage.__version__) >= parse_version('0.19.0'):
values = skimage.measure.marching_cubes(data, level)
else:
values = skimage.measure.marching_cubes_lewiner(data, level)

sk_verts, sk_faces, normals, values = values
x, y, z = sk_verts.T

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pythreejs
scikit-image
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="fortecubeview",
version="0.2.2",
version="0.2.3",
author="Francesco Evangelista",
author_email="",
description="A geometry, cube file, and vibrational modes viewer for Psi4 and Forte",
Expand Down

0 comments on commit f43dd9a

Please sign in to comment.