Skip to content

Commit a5b7937

Browse files
Merge branch 'master' into modif_github_actions
# Conflicts: # setup.py
2 parents 6ec1677 + ca54d10 commit a5b7937

28 files changed

+1285
-801
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os: ['ubuntu-20.04','ubuntu-22.04']
10-
python-version: ["3.8", "3.9", "3.10"]
10+
python-version: ["3.8", "3.9"]
1111
exclude:
1212
- os: 'ubuntu-22.04'
1313
python-version: '3.6'

.github/workflows/publish.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@ on:
33
release:
44
types: [published]
55
jobs:
6-
pypi:
6+
7+
build-n-publish-pypi:
8+
name: Build and publish Python to PyPI
79
runs-on: ubuntu-latest
10+
811
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v3
11-
with:
12-
fetch-depth: 0
13-
- run: python3 -m pip install --upgrade build && python3 -m build
14-
- name: Publish package
15-
uses: pypa/gh-action-pypi-publish@release/v1
16-
with:
17-
password: ${{ secrets.PYPI_API_TOKEN }}
12+
- uses: actions/checkout@master
13+
- name: Set up Python 3.10.5
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.10.5
17+
- name: Install pypa/build
18+
run: >-
19+
python -m
20+
pip install
21+
build
22+
--user
23+
- name: Build a binary wheel and a source tarball
24+
run: >-
25+
python -m
26+
build
27+
--sdist
28+
--wheel
29+
--outdir dist/
30+
31+
- name: Publish distribution to PyPI
32+
if: startsWith(github.ref, 'refs/tags')
33+
uses: pypa/gh-action-pypi-publish@master
34+
with:
35+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,3 @@ venv.bak/
144144
# modules.xml
145145
# .idea/misc.xml
146146
# *.ipr
147-
148-
curv_py.py
149-
.gitignore
150-
slam/plot.py

doc/conf.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
import sys
2121
from datetime import date
2222

23-
from visbrain.config import CONFIG
2423
import sphinx_gallery # noqa
2524
from sphinx_gallery.sorting import FileNameSortKey
2625
import sphinx_bootstrap_theme
2726

28-
CONFIG["MPL_RENDER"] = True
29-
3027

3128
curdir = os.path.dirname(__file__)
3229
sys.path.append(os.path.abspath(os.path.join(curdir, "..")))
@@ -204,11 +201,5 @@
204201
"filename_pattern": "^((?!sgskip).)*$",
205202
"backreferences_dir": "generated",
206203
"within_subsection_order": FileNameSortKey,
207-
"reference_url": {
208-
"numpy": "http://docs.scipy.org/doc/numpy-1.9.1",
209-
"scipy": "http://docs.scipy.org/doc/scipy-0.17.0/reference",
210-
"trimesh": "https://github.com/mikedh/trimesh",
211-
"visbrain": "https://github.com/EtienneCmb/visbrain",
212-
"nibabel": "https://nipy.org/nibabel",
213-
},
204+
"reference_url": {},
214205
}

environment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ name: base
22

33
dependencies:
44
- pip:
5-
- numpy
5+
- numpy==1.19.5
66
- scipy
77
- trimesh
88
- nibabel>=2.1
9-
- networkx
9+
- networkx
10+
- tvb-gdist

examples/example_basics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Authors: Guillaume Auzias <[email protected]>
1010

11-
# License: BSD (3-clause)
11+
# License: MIT
1212
# sphinx_gallery_thumbnail_number = 2
1313

1414

@@ -108,7 +108,7 @@
108108
###############################################################################
109109
# boundary of the mesh or list of faces
110110
# this functionnality requires to install the optional package shapely
111-
mesh.outline()
111+
# mesh.outline()
112112

113113
###############################################################################
114114
# the convex hull is another Trimesh object that is available as a property

examples/example_curvature.py

Lines changed: 73 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
# Authors: Guillaume Auzias <[email protected]>
1010
# Julien Barrès <[email protected]>
1111

12-
# License: BSD (3-clause)
12+
# License: MIT
1313
# sphinx_gallery_thumbnail_number = 2
1414

15-
1615
###############################################################################
16+
# NOTE: there is no visualization tool in slam, but we provide at the
17+
# end of this script exemplare code to do the visualization with
18+
# an external solution
19+
###############################################################################
20+
1721
# importation of slam modules
1822
import slam.utils as ut
1923
import numpy as np
2024
import slam.generate_parametric_surfaces as sgps
2125
import slam.io as sio
22-
import slam.plot as splt
2326
import slam.curvature as scurv
2427

2528
###############################################################################
@@ -29,9 +32,8 @@
2932

3033
###############################################################################
3134
# Comptue estimations of principal curvatures
32-
PrincipalCurvatures, PrincipalDir1, PrincipalDir2 = scurv.curvatures_and_derivatives(
33-
mesh
34-
)
35+
PrincipalCurvatures, PrincipalDir1, PrincipalDir2 \
36+
= scurv.curvatures_and_derivatives(mesh)
3537

3638
###############################################################################
3739
# Comptue Gauss curvature from principal curvatures
@@ -41,47 +43,12 @@
4143
# Comptue mean curvature from principal curvatures
4244
mean_curv = 0.5 * (PrincipalCurvatures[0, :] + PrincipalCurvatures[1, :])
4345

44-
###############################################################################
45-
# Plot mean curvature
46-
visb_sc = splt.visbrain_plot(
47-
mesh=mesh, tex=mean_curv, caption="mean curvature", cblabel="mean curvature"
48-
)
49-
visb_sc.preview()
50-
51-
###############################################################################
52-
# Plot Gauss curvature
53-
visb_sc = splt.visbrain_plot(
54-
mesh=mesh,
55-
tex=gaussian_curv,
56-
caption="Gaussian curvature",
57-
cblabel="Gaussian curvature",
58-
cmap="hot",
59-
)
60-
visb_sc.preview()
61-
6246
###############################################################################
6347
# Decomposition of the curvatures into ShapeIndex and Curvedness
6448
# Based on 'Surface shape and curvature scales
6549
# Jan JKoenderink & Andrea Jvan Doorn'
6650
shapeIndex, curvedness = scurv.decompose_curvature(PrincipalCurvatures)
6751

68-
###############################################################################
69-
# Plot of ShapeIndex and Curvedness
70-
visb_sc = splt.visbrain_plot(
71-
mesh=mesh,
72-
tex=shapeIndex,
73-
caption="ShapeIndex",
74-
cblabel="ShapeIndex",
75-
cmap="coolwarm",
76-
)
77-
visb_sc.preview()
78-
79-
visb_sc = splt.visbrain_plot(
80-
mesh=mesh, tex=curvedness, caption="Curvedness", cblabel="Curvedness", cmap="hot"
81-
)
82-
visb_sc.preview()
83-
84-
8552
###############################################################################
8653
# Estimation error on the principal curvature length
8754
K = [1, 0]
@@ -137,17 +104,6 @@
137104
k1_relative_change = abs((k1_analytic - k1_estim) / k1_analytic)
138105
k1_absolute_change = abs((k1_analytic - k1_estim))
139106

140-
###############################################################################
141-
# Error plot
142-
143-
visb_sc = splt.visbrain_plot(
144-
mesh=quadric,
145-
tex=k_mean_absolute_change,
146-
caption="K_mean absolute error",
147-
cblabel="K_mean absolute error",
148-
)
149-
visb_sc.preview()
150-
151107
###############################################################################
152108
# Estimation error on the curvature directions
153109
# commented because there is a bug:
@@ -190,21 +146,70 @@
190146
)
191147
angular_error_1 = 180 * angular_error_1 / np.pi
192148

149+
#############################################################################
150+
# VISUALIZATION USING EXTERNAL TOOLS
151+
#############################################################################
152+
# import visbrain # visu using visbrain
153+
# Plot mean curvature
154+
# visb_sc = splt.visbrain_plot(
155+
# mesh=mesh,
156+
# tex=mean_curv,
157+
# caption="mean curvature",
158+
# cblabel="mean curvature"
159+
# )
160+
# visb_sc.preview()
161+
#############################################################################
162+
# # Plot Gauss curvature
163+
# visb_sc = splt.visbrain_plot(
164+
# mesh=mesh,
165+
# tex=gaussian_curv,
166+
# caption="Gaussian curvature",
167+
# cblabel="Gaussian curvature",
168+
# cmap="hot",
169+
# )
170+
# visb_sc.preview()
171+
###############################################################################
172+
# Plot of ShapeIndex and Curvedness
173+
# visb_sc = splt.visbrain_plot(
174+
# mesh=mesh,
175+
# tex=shapeIndex,
176+
# caption="ShapeIndex",
177+
# cblabel="ShapeIndex",
178+
# cmap="coolwarm",
179+
# )
180+
# visb_sc.preview()
181+
#
182+
# visb_sc = splt.visbrain_plot(
183+
# mesh=mesh,
184+
# tex=curvedness,
185+
# caption="Curvedness",
186+
# cblabel="Curvedness",
187+
# cmap="hot"
188+
# )
189+
# visb_sc.preview()
193190
###############################################################################
194191
# Error plot
195-
196-
visb_sc = splt.visbrain_plot(
197-
mesh=quadric,
198-
tex=angular_error_0,
199-
caption="Angular error 0",
200-
cblabel="Angular error 0",
201-
)
202-
visb_sc.preview()
203-
204-
visb_sc = splt.visbrain_plot(
205-
mesh=quadric,
206-
tex=angular_error_1,
207-
caption="Angular error 1",
208-
cblabel="Angular error 1",
209-
)
210-
visb_sc.preview()
192+
# visb_sc = splt.visbrain_plot(
193+
# mesh=quadric,
194+
# tex=k_mean_absolute_change,
195+
# caption="K_mean absolute error",
196+
# cblabel="K_mean absolute error",
197+
# )
198+
# visb_sc.preview()
199+
# ###############################################################################
200+
# # Error plot
201+
# visb_sc = splt.visbrain_plot(
202+
# mesh=quadric,
203+
# tex=angular_error_0,
204+
# caption="Angular error 0",
205+
# cblabel="Angular error 0",
206+
# )
207+
# visb_sc.preview()
208+
#
209+
# visb_sc = splt.visbrain_plot(
210+
# mesh=quadric,
211+
# tex=angular_error_1,
212+
# caption="Angular error 1",
213+
# cblabel="Angular error 1",
214+
# )
215+
# visb_sc.preview()

0 commit comments

Comments
 (0)