Skip to content

Commit cc09407

Browse files
authored
Merge pull request #59 from MrClock8163/feature-apps
First applications
2 parents c163af0 + d76ba21 commit cc09407

34 files changed

+2889
-58
lines changed

.github/workflows/run-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
python-version: ${{ matrix.python-version }}
2424

2525
- name: Build and install package
26-
run: python -m pip install .
26+
run: python -m pip install .[all]
2727

2828
- name: Test with pytest
2929
run: |
@@ -47,11 +47,11 @@ jobs:
4747
python-version: 3.x
4848

4949
- name: Build and install package
50-
run: python -m pip install .
50+
run: python -m pip install .[all]
5151

5252
- name: Running ${{ matrix.tool }}
5353
run: |
5454
python -m pip install --upgrade pip
5555
python -m pip install --group linting
5656
python -c "print('=========== ${{ matrix.tool }} ===========')"
57-
python -m ${{ matrix.tool }} src/ tests/ examples/
57+
python -m ${{ matrix.tool }} src/ tests/

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build:
88
pre_build:
99
- python -m pip install --upgrade pip
1010
- python -m pip install --group documentation
11-
- python -m pip install .
11+
- python -m pip install .[all]
1212

1313
sphinx:
1414
configuration: docs/conf.py

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v0.7.0
4+
5+
### Added
6+
7+
- `retry` option to `open_serial`
8+
- Morse CLI application (`geocompy.apps.morse`)
9+
- Interactive Terminal CLI application (`geocompy.apps.terminal`)
10+
- Set Measurement CLI applications (`geocompy.apps.setmeasurement...`)
11+
312
## v0.6.0
413

514
### Added

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ the GSI Online command set is used for communication.
2929
- Primitives for relevant data
3030
- Command building and parsing through function calls
3131
- Multiple supported protocols (e.g. GeoCom, GSI Online)
32+
- Command line applications
3233

3334
## Requirements
3435

3536
To use the package, Python 3.11 or higher is required.
37+
3638
For the platform independent serial communication, GeoComPy relies on the
3739
[pySerial](https://pypi.org/project/pyserial/) package to provide the
3840
necessary abstractions.
3941

42+
The command line applications might require additional dependencies, that
43+
are not installed by default. The requirements for these can be found in
44+
the relevant documentation.
45+
4046
## Installation
4147

4248
The preferred method to install GeoComPy is through PyPI, where both wheel
@@ -46,6 +52,14 @@ and source distributions are made available.
4652
python -m pip install geocompy
4753
```
4854

55+
The dependencies of the command line applications are not installed by
56+
default. To make the CLI apps usable either install the dependencies
57+
manually, or install GeoComPy with the ``apps`` extra.
58+
59+
```shell
60+
python -m pip install geocompy[apps]
61+
```
62+
4963
If not yet published changes/fixes are needed, that are only available in
5064
source, GeoComPy can also be installed locally from source, without any
5165
external tools. Once the repository is cloned to a directory, it can be

docs/apps/morse.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Morse
2+
=====
3+
4+
.. versionadded:: 0.7.0
5+
6+
.. code-block:: shell
7+
:caption: Invoking the application
8+
9+
python -m geocompy.apps.morse
10+
11+
The Morse CLI application is a (admittedly not very useful) demo program,
12+
that relays a Morse encoded ASCII message through the speakers of a total
13+
station. The signals are played with the man-machine interface beep signals
14+
of the instrument.
15+
16+
Usage
17+
-----
18+
19+
.. argparse::
20+
:module: geocompy.apps.morse
21+
:func: cli

docs/apps/setmeasurement/index.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Set Measurement
2+
===============
3+
4+
.. versionadded:: 0.6.0
5+
6+
The set measurement CLI applications provide a simple way to conduct monitoring
7+
measurements to a set of predefined target points, using a GeoCom capable
8+
total station.
9+
10+
.. note::
11+
12+
The various subcommands are available as CLI submodules.
13+
14+
.. toctree::
15+
:maxdepth: 1
16+
17+
setup
18+
measure
19+
process
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Measure
2+
=======
3+
4+
.. code-block:: shell
5+
:caption: Invoking the application
6+
7+
python -m geocompy.apps.setmeasurement.measure -h
8+
9+
Once the target definition JSON is created, the measurement sets can
10+
be started. In each measurement session the time, internal temperature
11+
and battery level are recorded at start. For each target the horizontal angle,
12+
zenith angle and slope distance are recorded.
13+
14+
Order
15+
-----
16+
17+
The measurement order can have a significant effect on the time it takes to
18+
complete a full cycle. The fastest order of face 1-2 measurement pairs is
19+
``ABba`` or ``ABab``, that involve the smallest number of face changes. Other
20+
orders might be benefitial if the targets cannot be occupied for the duration
21+
of the full cycle. The figure below illustrates the different supported
22+
measurement patterns. The default order is ``ABba``.
23+
24+
.. note::
25+
26+
The measurement order has the most significant effect on overall cycle
27+
duration with older instruments, where the switch between two faces is
28+
usuallay takes around 5-6 seconds. These small intervals can add up over
29+
long sets or surveys.
30+
31+
.. image:: order.png
32+
:width: 400
33+
:align: center
34+
:alt: Set measurement order
35+
36+
Results
37+
-------
38+
39+
The results from each session are saved into a separate JSON file. These
40+
can be later merged for processing if necessary.
41+
42+
Scheduling
43+
----------
44+
45+
Periodic measurement sessions can be echieved by settings up a scheduled
46+
task in the scheduler tool of the respective operating system of the
47+
controlling computer (e.g. Task Scheduler on Windows, crontab on Linux).
48+
49+
Examples
50+
--------
51+
52+
.. code-block:: shell
53+
:caption: Logging to file
54+
55+
python -m geocompy.apps.setmeasurement.measure --debug COM3 targets.json results >> tps.log 2>&1
56+
57+
.. code-block:: shell
58+
:caption: Enabling connection retries and timeout recovery attempts (might be useful with bluetooth connections)
59+
60+
python -m geocompy.apps.setmeasurement.measure -r 3 -sat COM3 targets.json results
61+
62+
.. code-block:: shell
63+
:caption: Measuring to just a subset of the targets
64+
65+
python -m geocompy.apps.setmeasurement.measure -pt "P1,P2,P8" COM3 targets.json results
66+
67+
.. code-block:: shell
68+
:caption: Measuring in face 1 only
69+
70+
python -m geocompy.apps.setmeasurement.measure -o ABCD COM3 targets.json results
71+
72+
Usage
73+
-----
74+
75+
.. argparse::
76+
:module: geocompy.apps.setmeasurement.measure
77+
:func: cli

docs/apps/setmeasurement/order.png

176 KB
Loading
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
Process
2+
=======
3+
4+
.. code-block:: shell
5+
:caption: Invoking the application
6+
7+
python -m geocompy.apps.setmeasurement.process -h
8+
9+
.. caution::
10+
:class: warning
11+
12+
The Set Measurement processing requires
13+
`jsonschema <https://pypi.org/project/jsonschema/>`_ and
14+
`jmespath <https://pypi.org/project/jmespath/>`_ to be installed.
15+
16+
Install them manually, or install GeoComPy with the ``apps`` extra.
17+
18+
.. code-block:: shell
19+
20+
pip install geocompy[apps]
21+
22+
After set measurements are done, the results need to be processed. Thanks
23+
to the easily usable JSON format, this can be done with custom scripts if
24+
needed. For more general use cases, a few processing commands are available
25+
here.
26+
27+
Merging
28+
-------
29+
30+
The results of every set measurement session are saved to a separate file.
31+
When multiple sessions are measured using the same targets from the same
32+
station, the data files need to be merged to process them together.
33+
34+
.. note::
35+
36+
The merge will be refused if the station information, or the target
37+
points do not match between the targeted sessions.
38+
39+
Validation
40+
----------
41+
42+
After the measurement sessions are finished, it might be useful to validate,
43+
that each session succeeded, no points were skipped.
44+
45+
Calculation
46+
-----------
47+
48+
The most common calculation needed after set measurements is the determination
49+
of the target coordinates, from results of multiple measurement sessions and/or
50+
cycles. The resulting coordinates (as well as their deviations) are saved
51+
to a simple CSV file.
52+
53+
Usage
54+
-----
55+
56+
.. argparse::
57+
:module: geocompy.apps.setmeasurement.process
58+
:func: cli

docs/apps/setmeasurement/setup.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Setup
2+
=====
3+
4+
.. code-block:: shell
5+
:caption: Invoking the application
6+
7+
python -m geocompy.apps.setmeasurement.setup -h
8+
9+
The targets first must be defined in a JSON format, providing the point
10+
IDs, prism types and their 3D coordinates in an arbitrary coordinate
11+
system. This module can be used to create such a definition.
12+
13+
.. note::
14+
15+
A station setup and orientation must be in the same system as the
16+
targets. If there is no predefined coordinate system, an arbitrary
17+
local, station centered setup can be used as well.
18+
19+
Usage
20+
-----
21+
22+
.. argparse::
23+
:module: geocompy.apps.setmeasurement.setup
24+
:func: cli
25+
26+
measure : @replace
27+
The program will give instructions in the terminal at each step. For
28+
each point an ID is requested, then the target must be aimed at.
29+
30+
.. caution::
31+
:class: warning
32+
33+
The appropriate prism type needs to be set on the instrument before
34+
recording each target point. The program will automatically request
35+
the type from the instrument after the point is measured.
36+
37+
import : @replace
38+
If a coordinate list already exists with the target points, it can
39+
be imported from CSV format.
40+
41+
As a CSV file may contain any number and types of columns, the
42+
mapping to the relevant columns can be given with a column spec.
43+
A column spec is a string, with each character representing a
44+
column type.
45+
46+
- ``P``: point ID
47+
- ``E``: easting
48+
- ``N``: northing
49+
- ``Z``: up/height
50+
- ``_``: ignore/skip column
51+
52+
Every column spec must specify the ``PENZ`` fields in the appropriate
53+
order.
54+
55+
Examples:
56+
57+
- ``PENZ``: standard column order
58+
- ``P_ENZ``: skipping 2nd column containing point codes
59+
- ``EN_Z_P``: mixed column order and skipping

0 commit comments

Comments
 (0)