enthought / enthought/mayavi

Small correction in MTriangularMeshSource

Open
#392 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

Dear Mayavi developers,

I noticed that the class MTriangularMeshSource is missing a features, it is not possible to set the scalars argument to the triangles, only to the facet. After a bit of searching, I finally managed to correct this, here is what I propose (it is stating in line 815 of file mayavi/tools/sources.py)

815 if scalars is not None and len(scalars) > 0:
816 if not scalars.flags.contiguous:
817 scalars = scalars.copy()
818 self.set(scalars=scalars, trait_change_notify=False)
819 if x.shape == scalars.shape:
820 pd.point_data.scalars = scalars.ravel()
821 pd.point_data.scalars.name = 'scalars'
822 elif triangles.shape[0] == scalars.shape[0]:
823 pd.cell_data.scalars = scalars.ravel()
824 pd.cell_data.scalars.name = 'scalars'
825 else:
826 print('x.shape = ', x.shape)
827 print('triangles.shape = ', triangles.shape)
828 print('scalars.shape = ', scalars.shape)
829 raise ValueError('scalars.shape must be equal to x.shape or triangles.shape[0]')

It is a very small correction, so I'm lazy to download the code with git and to propose a pull request (mainly because I don't know how to do it). So maybe one of you can take this change, see if it is correct and pull it.

Thank you for this very nice program,
Marc Barbry

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.