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.0.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.0-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: otdrparser-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 09698fdb1a20e52c1d8511c293d0f64224f19b1b22c5fa408030991ac4c67952
MD5 c6880f51acbe48be7a6ffadf55ed9daf
BLAKE2b-256 a643f8cc322df3881ee56e3db89367b7982562e98650b75b6a9af6fc3e013fb4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: otdrparser-0.2.0-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.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ce6dafe35d4539a823e4ffe2f9b02d5e2942e83d70c803a0fce621c884ea2913
MD5 a64a36a490036d1c202e741823e10d72
BLAKE2b-256 f9c3018215b7935919d77cf3f4d5eeaeeb065e354aee81bccc6193e0b11af287

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