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 legacyparse()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
nameattribute 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=652is 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09698fdb1a20e52c1d8511c293d0f64224f19b1b22c5fa408030991ac4c67952
|
|
| MD5 |
c6880f51acbe48be7a6ffadf55ed9daf
|
|
| BLAKE2b-256 |
a643f8cc322df3881ee56e3db89367b7982562e98650b75b6a9af6fc3e013fb4
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce6dafe35d4539a823e4ffe2f9b02d5e2942e83d70c803a0fce621c884ea2913
|
|
| MD5 |
a64a36a490036d1c202e741823e10d72
|
|
| BLAKE2b-256 |
f9c3018215b7935919d77cf3f4d5eeaeeb065e354aee81bccc6193e0b11af287
|