Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc 1.1.1 #58

Merged
merged 12 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"editor.formatOnSave": true,
"modulename": "${workspaceFolderBasename}",
"distname": "${workspaceFolderBasename}",
"moduleversion": "1.1.0"
"moduleversion": "1.1.1"
}
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,13 @@ Attributes within repeating groups are parsed with a two-digit suffix (`DF419_01
Helper methods are available to interpret the individual datafields:

```python
from pyrtcm import RTCM_DATA_FIELDS, datasiz, datascale, datadesc
from pyrtcm import RTCM_DATA_FIELDS, datadesc
dfname = "DF012"
print(RTCM_DATA_FIELDS[dfname])
print(datasiz(dfname))
print(datascale(dfname))
print(datadesc(dfname))
```
```
(INT20, 0.0001, "GPS L1 PhaseRange - L1 Pseudorange")
20
0.0001
'GPS L1 PhaseRange - L1 Pseudorange'
```

Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# pyrtcm Release Notes

### RELEASE 1.1.1

ENHANCEMENTS:

semuadmin marked this conversation as resolved.
Show resolved Hide resolved
1. Internal enhancements to logging and exception handling.

### RELEASE 1.1.0

ENHANCEMENTS:
Expand Down
16 changes: 16 additions & 0 deletions docs/pyrtcm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ pyrtcm.rtcmtypes\_get module
:undoc-members:
:show-inheritance:

pyrtcm.rtcmtypes\_get\_igs module
---------------------------------

.. automodule:: pyrtcm.rtcmtypes_get_igs
:members:
:undoc-members:
:show-inheritance:

pyrtcm.rtcmtypes\_get\_msm module
---------------------------------

.. automodule:: pyrtcm.rtcmtypes_get_msm
:members:
:undoc-members:
:show-inheritance:

pyrtcm.socket\_stream module
----------------------------

Expand Down
2 changes: 1 addition & 1 deletion examples/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def benchmark(**kwargs) -> float:
:raises: UBXStreamError
"""

cyc = int(kwargs.get("cycles", 10000))
cyc = int(kwargs.get("cycles", 1000))
txnc = len(RTCMMESSAGES)
txnt = txnc * cyc

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pyrtcm"
authors = [{ name = "semuadmin", email = "semuadmin@semuconsulting.com" }]
maintainers = [{ name = "semuadmin", email = "semuadmin@semuconsulting.com" }]
description = "RTCM3 protocol parser"
version = "1.1.0"
version = "1.1.1"
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.8"
Expand Down
2 changes: 2 additions & 0 deletions src/pyrtcm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pyrtcm.rtcmreader import RTCMReader
from pyrtcm.rtcmtypes_core import *
from pyrtcm.rtcmtypes_get import *
from pyrtcm.rtcmtypes_get_igs import *
from pyrtcm.rtcmtypes_get_msm import *
from pyrtcm.socket_stream import SocketStream

version = __version__ # pylint: disable=invalid-name
2 changes: 1 addition & 1 deletion src/pyrtcm/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
:license: BSD 3-Clause
"""

__version__ = "1.1.0"
__version__ = "1.1.1"
103 changes: 9 additions & 94 deletions src/pyrtcm/rtcmhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ def att2idx(att: str) -> int:
"""

try:
return int(att[att.rindex("_") - len(att) + 1 :])
att = att.split("_")
ln = len(att)
if ln == 2: # one group level
return int(att[1])
if ln > 2: # nested group level(s)
return tuple(int(att[i]) for i in range(1, ln))
return 0 # not grouped
except ValueError:
return 0

Expand All @@ -42,45 +48,7 @@ def att2name(att: str) -> str:
:rtype: str
"""

try:
return att[: att.rindex("_")]
except ValueError:
return att


def bits2val(att: str, scale: float, bitfield: int) -> object:
"""
Convert bitfield to value for given attribute type.

:param str att: attribute type e.g. "UNT008"
:param float scale: scaling factor (where defined)
:param int bitfield: attribute as integer
:return: value
:rtype: object (int, float, char, bool)
"""

typ = atttyp(att)
siz = attsiz(att)
val = msb = 0

if typ in ("SNT", "INT"):
msb = 2 ** (siz - 1)
if typ == "SNT": # int, MSB indicates sign
val = bitfield & msb - 1
if bitfield & msb:
val *= -1
else: # all other types
val = bitfield
if typ == "INT" and (bitfield & msb): # 2's compliment -ve int
val = val - (1 << siz)
if typ in ("CHA", "UTF"): # ASCII or UTF-8 character
val = chr(val)
# apply any scaling factor
else:
if scale not in (0, 1):
val *= scale

return val
return att.split("_")[0]


def calc_crc24q(message: bytes) -> int:
Expand Down Expand Up @@ -135,59 +103,6 @@ def len2bytes(payload: bytes) -> bytes:
return len(payload).to_bytes(2, "big")


def atttyp(att: str) -> str:
"""
Get attribute type as string.

:param str att: attribute type e.g. 'UNT002'
:return: type of attribute as string e.g. 'UNT'
:rtype: str

"""

return att[0:3]


def attsiz(att: str) -> int:
"""
Get attribute size in bits.

:param str att: attribute type e.g. 'U002'
:return: size of attribute in bits
:rtype: int

"""

return int(att[-3:])


def datasiz(datafield: str) -> int:
"""
Get data field size in bits.

:param str datafield: datafield e.g. 'DF234'
:return: size of data field in bits
:rtype: int

"""

(att, _, _) = RTCM_DATA_FIELDS[datafield[0:5]]
return attsiz(att)


def datascale(datafield: str) -> float:
"""
Get scaling factor of data field.

:param str datafield: datafield e.g. 'DF234'
:return: datafield scale factor or 0 if N/A
:rtype: float
"""

(_, res, _) = RTCM_DATA_FIELDS[datafield[0:5]]
return res


def datadesc(datafield: str) -> str:
"""
Get description of data field.
Expand All @@ -197,7 +112,7 @@ def datadesc(datafield: str) -> str:
:rtype: str
"""

(_, _, desc) = RTCM_DATA_FIELDS[datafield[0:5]]
(_, _, _, desc) = RTCM_DATA_FIELDS[datafield[0:5]]
return desc


Expand Down
Loading