Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bool dtype support for PLY files #321

Merged

Conversation

Nicholas-Autio-Mitchell
Copy link
Contributor

@Nicholas-Autio-Mitchell Nicholas-Autio-Mitchell commented Jan 3, 2022

This PR addresses #309 and adds support for the file reader to deal with Boolean fields (writing boolean fields was already not an issue). It also adds a new test fixture file and a simple unit test.

The new test data PLY file contains the following header:
diamond with bool points dtypes

which loads to give the following dataframe - notice the newly inserted is_green column of type bool:

green blue nx ny nz is green

Copy link
Owner

@daavoo daavoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nicholas-mitchell 🚀 !

@@ -242,7 +248,7 @@ def describe_element(name, df):
-------
element: list[str]
"""
property_formats = {'f': 'float', 'u': 'uchar', 'i': 'int'}
property_formats = {'f': 'float', 'u': 'uchar', 'i': 'int', 'b': 'bool'}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a test for write_ply with bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

@daavoo daavoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor thing. Adding test for write_ply

@Nicholas-Autio-Mitchell Nicholas-Autio-Mitchell force-pushed the nicholas/bool_support_for_ply branch from 5a85c8f to ba545d4 Compare January 3, 2022 22:08
@Nicholas-Autio-Mitchell
Copy link
Contributor Author

Nicholas-Autio-Mitchell commented Jan 3, 2022

@daavoo - I've added a test that writes a PLY file containing Boolean data

https://github.com/daavoo/pyntcloud/pull/321/files#diff-021377fee185787af295603466e9f1f3fec039246017a515213eb7c2f2115888

@Nicholas-Autio-Mitchell Nicholas-Autio-Mitchell force-pushed the nicholas/bool_support_for_ply branch from ba545d4 to 0e1372c Compare January 3, 2022 22:16
@daavoo daavoo merged commit 977b8d2 into daavoo:master Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants