pylas/point/record.py
def from_stream(cls, stream, point_format, count):
        """ Construct the point record by reading the points from the stream
        """
        points_dtype = point_format.dtype
        point_data_buffer = bytearray(stream.read(count * points_dtype.itemsize))

        try:
            data = np.frombuffer(point_data_buffer, dtype=points_dtype, count=count)
        except ValueError:
            expected_bytes_len = count * points_dtype.itemsize
            if len(point_data_buffer) % points_dtype.itemsize != 0:
                missing_bytes_len = expected_bytes_len - len(point_data_buffer)
                raise_not_enough_bytes_error(
                    expected_bytes_len,
                    missing_bytes_len,
                    len(point_data_buffer),
                    points_dtype,
                )
            else:
                actual_count = len(point_data_buffer) // points_dtype.itemsize
                logger.critical(
                    "Expected {} points, there are {} ({} missing)".format(
                        count, actual_count, count - actual_count
                    )
                )
                data = np.frombuffer(
                    point_data_buffer, dtype=points_dtype, count=actual_count
                )

        return cls(data, point_format)
def from_stream(cls, stream, point_format, count):
        points_dtype = point_format.dtype
        point_data_buffer = bytearray(stream.read(count * points_dtype.itemsize))

        try:
            data = np.frombuffer(point_data_buffer, dtype=points_dtype, count=count)
        except ValueError:
            expected_bytes_len = count * points_dtype.itemsize
            if len(point_data_buffer) % points_dtype.itemsize != 0:
                missing_bytes_len = expected_bytes_len - len(point_data_buffer)
                raise_not_enough_bytes_error(
                    expected_bytes_len,
                    missing_bytes_len,
                    len(point_data_buffer),
                    points_dtype,
                )
            else:
                actual_count = len(point_data_buffer) // points_dtype.itemsize
                logger.critical(
                    "Expected {} points, there are {} ({} missing)".format(
                        count, actual_count, count - actual_count
                    )
                )
                data = np.frombuffer(
                    point_data_buffer, dtype=points_dtype, count=actual_count
                )

        return cls(data, point_format)
def from_stream ( cls , stream , point_format , count ) : points_dtype = point_format . dtype point_data_buffer = bytearray ( stream . read ( count * points_dtype . itemsize ) ) try : data = np . frombuffer ( point_data_buffer , dtype = points_dtype , count = count ) except ValueError : expected_bytes_len = count * points_dtype . itemsize if len ( point_data_buffer ) % points_dtype . itemsize != 0 : missing_bytes_len = expected_bytes_len - len ( point_data_buffer ) raise_not_enough_bytes_error ( expected_bytes_len , missing_bytes_len , len ( point_data_buffer ) , points_dtype , ) else : actual_count = len ( point_data_buffer ) // points_dtype . itemsize logger . critical ( "Expected {} points, there are {} ({} missing)" . format ( count , actual_count , count - actual_count ) ) data = np . frombuffer ( point_data_buffer , dtype = points_dtype , count = actual_count ) return cls ( data , point_format )
Construct the point record by reading the points from the stream
Construct the point record by reading the points from the stream