Closed SBCV closed 3 years ago
I've just made a simple timing comparison and it looks like there is a drastic performance difference between laspy
and pylas
when reading laz
files
laspy: elapsed time: 14.988102674484253
pylas: elapsed time: 0.7680809497833252
I think that difference stems from the fact that laspy
calls the command line tool of laszip
Hola @SBCV !
I've just made a simple timing comparison and it looks like there is a drastic performance difference between
laspy
andpylas
when readinglaz
fileslaspy: elapsed time: 14.988102674484253 pylas: elapsed time: 0.7680809497833252
I think that difference stems from the fact that
laspy
calls the command line tool oflaszip
Nice!. I did not know about the existence of pylas (I think it did not exist back when the .las reader was added). It looks like a good and more active alternative, would be nice for a P.R.
In order to add the requested test to test_from_file.py , I opened diamond.las with Cloudcompare and stored the imported point cloud as diamond.laz
.
When running the tests the following error message is thrown:
tests/integration/io/test_from_file.py:51:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = PyntCloud
6 points with 10 scalar fields
0 faces in mesh
0 kdtrees
0 voxelgrids
Centroid: 0.5, 0.5, 0.5
Other attributes:
las_header: <class 'laspy.header.HeaderManager'>
def assert_points_xyz(data):
assert np.isclose(data.points['x'][0], 0.5)
assert np.isclose(data.points['y'][0], 0)
assert np.isclose(data.points['z'][0], 0.5)
> assert str(data.points["x"].dtype) == 'float32'
E AssertionError: assert 'float64' == 'float32'
E - float64
E + float32
tests/integration/io/test_from_file.py:13: AssertionError
Do you know, if it is it possible to create laz files with 32 bit floats? Or should we change the assertions? Any recommendations?
In order to add the requested test to test_from_file.py , I opened diamond.las with Cloudcompare and stored the imported point cloud as
diamond.laz
. When running the tests the following error message is thrown:tests/integration/io/test_from_file.py:51: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ data = PyntCloud 6 points with 10 scalar fields 0 faces in mesh 0 kdtrees 0 voxelgrids Centroid: 0.5, 0.5, 0.5 Other attributes: las_header: <class 'laspy.header.HeaderManager'> def assert_points_xyz(data): assert np.isclose(data.points['x'][0], 0.5) assert np.isclose(data.points['y'][0], 0) assert np.isclose(data.points['z'][0], 0.5) > assert str(data.points["x"].dtype) == 'float32' E AssertionError: assert 'float64' == 'float32' E - float64 E + float32 tests/integration/io/test_from_file.py:13: AssertionError
Do you know, if it is it possible to create laz files with 32 bit floats? Or should we change the assertions? Any recommendations?
I'm guessing that CloudCompare is exporting with float64: http://www.danielgm.net/cc/forum/viewtopic.php?t=4167#p18933
I don't know if you can change the exported precission.
Rather than changing assertions, I think that the best option would be to cast the point coordinates to float32 (maybe using a default argument in order to let someone get float64 if needed):
https://github.com/daavoo/pyntcloud/blob/master/pyntcloud/io/las.py#L28
Rather than changing assertions, I think that the best option would be to cast the point coordinates to float32 (maybe using a default argument in order to let someone get float64 if needed):
Added default arguments for float and color. The test case for pytest runs now successfully (including color information). Squashed the commits to keep it in a clean state.
Thank you for merging.
Regarding pylas
/ lazperf
: Do think it would be better to provide an alternative to laspy
or should we replace it entirely?
The
laspy
library allows to read not onlylas
but alsolaz
files (assuming thatlaszip
is installed)Btw: Are you aware of the pylas / lazperf libraries? They also allow to read
las
/laz
files and can be installed usingpip
(which is more convenient than the installation oflaspy
andlaszip
)