pylas.point.record module

Contains the classes that manages Las PointRecords Las PointRecords are represented using Numpy’s structured arrays, The PointRecord classes provide a few extra things to manage these arrays in the context of Las point data

pylas.point.record.scale_dimension(array_dim, scale, offset)[source]
pylas.point.record.unscale_dimension(array_dim, scale, offset)[source]
pylas.point.record.raise_not_enough_bytes_error(expected_bytes_len, missing_bytes_len, point_data_buffer_len, points_dtype) → NoReturn[source]
class pylas.point.record.PackedPointRecord(data: numpy.ndarray, point_format: pylas.point.format.PointFormat)[source]

Bases: object

In the PackedPointRecord, fields that are a combinations of many sub-fields (fields stored on less than a byte) are still packed together and are only de-packed and re-packed when accessed.

This uses of less memory than if the sub-fields were unpacked

>>> #return number is a sub-field
>>> from pylas import PointFormat
>>> packed_point_record = PackedPointRecord.zeros(PointFormat(0), 10)
>>> return_number = packed_point_record['return_number']
>>> return_number
<SubFieldView([0 0 0 0 0 0 0 0 0 0])>
>>> return_number[:] = 1
>>> np.alltrue(packed_point_record['return_number'] == 1)
True
point_size

Returns the point size in bytes taken by each points of the record

Returns:The point size in byte
Return type:int
classmethod zeros(point_format, point_count)[source]

Creates a new point record with all dimensions initialized to zero

Parameters:
  • point_format (PointFormat) – The point format id the point record should have
  • point_count (int) – The number of point the point record should have
Returns:

Return type:

PackedPointRecord

classmethod empty(point_format)[source]

Creates an empty point record.

Parameters:point_format (pylas.PointFormat) – The point format id the point record should have
Returns:
Return type:PackedPointRecord
classmethod from_point_record(other_point_record: pylas.point.record.PackedPointRecord, new_point_format: pylas.point.format.PointFormat) → pylas.point.record.PackedPointRecord[source]

Construct a new PackedPointRecord from an existing one with the ability to change to point format while doing so

classmethod from_buffer(buffer, point_format, count, offset=0)[source]
copy_fields_from(other_record: pylas.point.record.PackedPointRecord) → None[source]

Tries to copy the values of the current dimensions from other_record

memoryview() → memoryview[source]
resize(new_size: int) → None[source]
pylas.point.record.apply_new_scaling(record, scales: numpy.ndarray, offsets: numpy.ndarray) → None[source]
class pylas.point.record.ScaleAwarePointRecord(array, point_format, scales, offsets)[source]

Bases: pylas.point.record.PackedPointRecord

change_scaling(scales=None, offsets=None) → None[source]