Skip to content

Commit c8bebf0

Browse files
robertodrilfreddy
authored andcommitted
Make plot_cavity.py Python 3 compatible
1 parent cc8e3c9 commit c8bebf0

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ doc/gfx/cloc_tools.py.in licensefile=.githooks/LICENSE-Python
7575
src/make_cmake_files.py licensefile=.githooks/LICENSE-Python
7676
tools/codata.py.in licensefile=.githooks/LICENSE-Python
7777
tools/pcmsolver.py.in licensefile=.githooks/LICENSE-Python
78-
tools/plot_cavity.py.in licensefile=.githooks/LICENSE-Python
78+
tools/plot_cavity.py licensefile=.githooks/LICENSE-Python
7979
tests/make_cmake_files.py licensefile=.githooks/LICENSE-Python

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
- Documentation building on ReadTheDocs is fully functional again, thanks @arnfinn :tada:
4747
The build had been failing for a while since docs were generated for all files, including
4848
documentation files from previous build. Besides, source code doxygen blocks were not
49-
exctracted when inside namespaces.
49+
extracted when inside namespaces.
5050
- Compiler warning in the `Sphere` class due to a redeclaration of `operator<<`.
51+
- The `plot_cavity.py` script is now Python 3 compatible.
5152

5253
### Removed
5354

tools/plot_cavity.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def plot(cavity_npz, surf_func_npy=None):
116116

117117
cavity = np.load(cavity_npz)
118118

119-
nElements = cavity['elements']
119+
nElements = cavity['elements'][0]
120120
centroids = cavity['centers']
121121

122122
# Plot collocation points
@@ -134,7 +134,9 @@ def plot(cavity_npz, surf_func_npy=None):
134134
colors = mappable.to_rgba(surf_func.flatten())
135135
# Generate list of vertices
136136
vertices = [
137-
zip(cavity['vertices_' + str(i)][0, :], cavity['vertices_' + str(i)][1, :], cavity['vertices_' + str(i)][2, :])
137+
list(zip(cavity['vertices_' + str(i)][0, :],
138+
cavity['vertices_' + str(i)][1, :],
139+
cavity['vertices_' + str(i)][2, :]))
138140
for i in range(nElements)
139141
]
140142
elements = Poly3DCollection(vertices, facecolors=colors)

0 commit comments

Comments
 (0)