Skip to main content

otdrparser

otdrparser is a Python library for parsing OTDR traces in Telcordia SR-4731 Version 2 format (*.sor files).

It is a simplified re-implementation of the pyOTDR project. Its author, Hsin-Yu Sidney Li, together with several others deserve a lot of credit for reverse-engineering the Telcordia SR-4731 standard as it is not freely available.

The otdrparser library differs from the pyOTDR project in multiple ways.

  • It's a small module with a parse2() function (and a now legacy parse() function).
  • It only supports Version 2 of the Telcordia SR-4731 standard.
  • Only single-trace OTDR files are supported. Multi-trace input is rejected explicitly.
  • The checksum block is read but not verified.
  • No attempt is made to accomodate vendor specific blocks.
  • I am certain otdrparser contains bugs. Please open a Github Issue if you find any.

Both parser functions accept any binary file-like object, including an open file or an io.BytesIO instance.

import io
import otdrparser

with open('my_trace_file.sor', 'rb') as fp:
    blocks = otdrparser.parse2(fp)

blocks_from_memory = otdrparser.parse2(io.BytesIO(sor_bytes))
  • Each "block" has a name attribute which describes its type.
  • The parse2() function returns the parsed trace file as a dictionary, keyed by the name of the block.
  • Data points are included as a list of (distance in metres, dB) pairs.
  • Data-point and key-event distances are expressed in metres. The encoded FxdParams.range field follows the SOR convention and is expressed in kilometres.
  • FxdParams.averaging_time is expressed in seconds.
  • Vendor proprietary blocks are included as raw bytes.
  • Some data is interpreted. For example fibre_type=652 is also interpreted as "ITU-T G.652 (standard single-mode fiber)"
  • Truncated, malformed, and unsupported input raises OTDRParserError.

Output of the .parse2() method converted into JSON: example-parse2.json.

The otdrparser.parse() function is now considered legacy. It returns the blocks as a list.

Output of the .parse() method converted into JSON: example-parse.json).

Metadata

Release files for otdrparser 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for otdrparser 0.2.3
File Size Uploaded Provenance Actions
otdrparser-0.2.3.tar.gz 7.7 kB Without provenance Details for otdrparser-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for otdrparser 0.2.3
File Interpreter ABI Platform Actions
otdrparser-0.2.3-py2.py3-none-any.whl Python 3, Python 2 none any Details for otdrparser-0.2.3-py2.py3-none-any.whl

Total release size: 16.0 kB

Release files / otdrparser-0.2.3.tar.gz

Download URL otdrparser-0.2.3.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6a470c1110e72553c714a5622b984f9be265536ee914bc2e63d1668a8f9b48fc
BLAKE2b-256 checksum
How to use checksums
4c68d09031837c08a889b956ed36bb93f71ff7546689552ade536e02b52560de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / otdrparser-0.2.3-py2.py3-none-any.whl

Download URL otdrparser-0.2.3-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a20441d625bd85a8bdf6f1178f353fc0444d8c7f74561feb7b2ad8fbb8a3da91
BLAKE2b-256 checksum
How to use checksums
79582e8b8608189a4d6bef5f9333a5cb9059a37bf429a8657a22bc3d74df7c80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for otdrparser 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page