Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
add sphinx's doctest extension & fix example in index.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Aug 2, 2019
1 parent a1a8439 commit 36653fc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'sphinx.ext.doctest',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
29 changes: 17 additions & 12 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ pylas reads and writes these formats and provides a Python API via Numpy Arrays.

Here is an example of reading in LAZ data and getting some simple summaries of the pointcloud:

.. code:: python
.. testcode::

import numpy as np
import pylas

with pylas.open('simple.laz') as fh:
print('Points from Header:', fh.header.number_of_point_records)
with pylas.open('pylastests/simple.laz') as fh:
print('Points from Header:', fh.header.point_count)
las = fh.read()
print(las)
print('Points from data:', len(las.points))
Expand All @@ -30,15 +30,20 @@ Here is an example of reading in LAZ data and getting some simple summaries of t
for r,c in zip(bins,counts):
print(' {}:{}'.format(r,c))

# Prints:
# Points from Header: 1065
# LasData(1.2, point fmt: 3, 1065 points, 0 vlrs)
# Points from data: 1065
# Ground Point Return Number distribution:
# 1:239
# 2:25
# 3:11
# 4:1

Would output:

.. testoutput::

Points from Header: 1065
<LasData(1.2, point fmt: <PointFormat(3)>, 1065 points, 0 vlrs)>
Points from data: 1065
Ground Point Return Number distribution:
1:239
2:25
3:11
4:1


User Guide
==========
Expand Down

0 comments on commit 36653fc

Please sign in to comment.