Skip to main content

Python library for parsing OTDR files in Telcordia SR-4731 Version 2 format

Project description

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 just a single class with a .parse2() method (and a now legacy parse() method).
  • It only supports Version 2 of the Telcordia SR-4731 standard.
  • It is assumed that the OTDR file contains only a single trace.
  • 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.

The otdrparser library consists of a single class with a .parse2() method.

import otdrparser
with open('my_trace_file.sor', 'rb') as fp:
    blocks = otdrparser.parse2(fp)
  • Each "block" has a name attribute which describes its type.
  • The .parse2() method returns the parsed trace file as a dictionary, keyed by the name of the block.
  • Data points are included as a list of (distance, dBm) pairs.
  • 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)"

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

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otdrparser-0.2.1.tar.gz (633.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otdrparser-0.2.1-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file otdrparser-0.2.1.tar.gz.

File metadata

  • Download URL: otdrparser-0.2.1.tar.gz
  • Upload date:
  • Size: 633.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for otdrparser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8e9cb704fa75e457fbdd4bd50c24980db5b69c3f4920158bdbba01f61cf0040e
MD5 8068025c4a1f664d289612e30b96ac26
BLAKE2b-256 b52a28400c329b7ebe36f300cb4b0379249ede08e4d742ee1ad0715458659a46

See more details on using hashes here.

File details

Details for the file otdrparser-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: otdrparser-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for otdrparser-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a7145571fb837d8e277f8fd5b11af7b113f7111b6d43653a28e61a6917713af4
MD5 3a3afda2c21c379c8c11084be5519914
BLAKE2b-256 c8984b40c0a35b7279023fc7ff7feaf0c9d1bf083502331b1d4ed32f637956c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page