1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
"""Details about a specific SOR block"""
:
:
:
"""File layout information.
Every SOR file has a MapBlock which acts as a map to the file's contents"""
:
:
:
:
"""General details about this trace"""
:
"""Language code - EN, CN, JP, etc."""
:
"""Cable identifier"""
:
"""Fibre identifier"""
:
"""Fibre type - this is generally coded as the ITU-T standard definition"""
:
"""Nominal test wavelength in nm"""
:
"""Start location for the test"""
:
"""End location for the test"""
:
"""Cable code - free field"""
:
""" NC for new condition, RC for as-repaired, OT as something else"""
:
"""User offset - This is essentially the launch lead length from the front panel offset (provided in the fixed parameters block), in 100ps increments"""
:
"""This is the same as user_offset, but measured in 10x the distance units of FixedParametersBlock.units_of_distance"""
:
"""Operator of the unit for the test"""
:
"""Free comment field"""
"""Details about the OTDR used in the test"""
:
"""Manufacturer of the OTDR"""
:
"""Mainframe model number"""
:
"""Mainframe serial number"""
:
"""Optical module model number"""
:
"""Optical module serial number"""
:
"""Software revision"""
:
"""Free text"""
"""Details about the trace that don't vary between datasets"""
:
"""Datestamp - unix epoch seconds, 32-bit. Remember not to do any OTDR tests after 2038."""
:
"""Units of distance - km, mt, ft, kf, mi, etc. Typically mt (in civilised nations)"""
:
"""Actual wavelength used - normally the factory-calibrated wavelength in nm, or nominal wavelength"""
:
"""Acquisition offset - this is the length of fibre from the OTDR port to the first data point in the DataPoints, in 100ps increments"""
:
"""As acquisition_offset, but as 10x units_of_distance"""
:
"""The total number of pulse widths used, if more than one pulse width's results are stored in the file"""
:
"""The list of pulse widths used, in nanoseconds"""
:
"""Data spacing, time taken to acquire 10,000 points in 100ps increments"""
:
"""Number of points stored for each pulse width"""
:
"""Group index - the refractive index of the fibre, default to 146800 if nothing supplied"""
:
"""Backscatter coefficient -"""
:
"""Number of averages - the number of samples that were averaged to generate the result - may be used instead of averaging time"""
:
"""Averaging time - may be supplied instead of number of averages - in seconds x 10"""
:
"""Acquisition range set by the tester to reach the end of the fibre - as with other distance measurements, 100ps increments"""
:
"""Acquisition range in 10x distance units, as an alternate to acquisition_range"""
:
"""Front panel offset is the time taken, in 100ps increments, between the front-end of the optical TRX and the front panel connector"""
:
"""Noise floor level - the lowest power level for which 98% of the noise data lies below; 5-digit -dB value (e.g. 10200 = -10.2dB)"""
:
"""Scale factor for the noise floor level - defaults to 1"""
:
"""Attenuation in dB*1000 applied by the instrument if done by the instrument"""
:
"""The threshold in dB*1000 for a loss-type event; default 00200"""
:
"""The threshold in -dB*1000 for reflectance events; default -55000"""
:
"""The threshold in dB*1000 for the loss taken to detect the end of the fibre; default 03000"""
:
"""Trace type - identifies if this is a standard one-way trace, a bidirectional trace, reference trace, difference trace, or reversed trace"""
:
"""Window coordinate for the upper right window corner"""
:
"""Power coordinate for the upper right window corner"""
:
"""Window coordinate for the lower left window corner"""
:
"""Power coordinate for the lower left window corner"""
"""Event detected by the OTDR"""
:
"""Event number - this is from 0 to n"""
:
"""Event propogation time is the time in 100ps units from the front panel to the event"""
:
"""The span loss in db/km (as a 5-digit value, i.e. dB*1000) for the fibre entering the event"""
:
"""Loss in dB*1000 for the event"""
:
"""Reflectance in -dB*1000 for the event"""
:
"""Code for the event is a 6-byte string:
Byte 1:
0 = nonreflective, 1 = reflective, 2 = saturated reflective
Byte 2:
A = added by user, M = moved by user, E = end of fibre, F = found
by software, O = out of range, D = modified end of fibre
Remaining bytes are the Landmark number if used - 9s otherwise
"""
:
"""Loss measurement technique - 2P for two point, LS for least squares, OT for other"""
:
"""Marker location - ML1 is the OTDR side for 2P/LS/OT measurements"""
:
"""Marker location - ML2 is the OTDR side for LS measurements, and bounds the event for 2P/OT"""
:
"""Marker location - ML3 is on the far side for LS measurements, and empty for 2P/OT"""
:
"""Marker location - ML4 is on the far side for LS measurements, and empty for 2P/OT"""
:
"""Marker location - ML5 is the reflectance calculation position"""
:
"""Free comment on the event"""
"""Like a KeyEvent, but specific to the last event detected"""
:
:
:
:
:
:
:
:
:
:
:
:
:
# End to end loss is in dB*1000 and measures the loss between the two
# markers defined below
:
# Start of the measurement span - typically user offset
:
# End of the measurement span - typically end of fibre event position
:
# Return loss in dB*1000 for the markers defined below
:
# Start of the measurement span - typically user offset
:
# End of the measurement span - typically end of fibre event position
:
"""The key events the OTDR detected."""
:
:
:
"""The data points for a specific scale factor"""
:
"""Number of points in this block"""
:
"""Scale factor for the data, as 1000*SF"""
:
"""Data points as dB*1000"""
"""The data points for this trace"""
:
:
:
"""Not widely used; a landmark recorded in the trace by the system."""
:
# Landmark code identifies the landmark - see page 27 of the standard for
# the list
:
# Location in 100ps from user offset to the landmark
:
:
:
:
# Fibre correction factor is the difference in 100*% between the optical
# path and the cable length; otherwise known as heliax correction
:
:
:
:
:
:
"""Landmark information for the trace"""
:
:
"""Binary proprietary block data."""
:
:
"""File checksum block."""
:
"""A SOR file.
SORFile describes a full SOR file. All blocks except MapBlock are optional types as we cannot
guarantee the parser will find them, but many blocks are in fact mandatory in the specification,
so compliant instruments will provide them.
"""
:
: | None
: | None
: | None
: | None
: | None
: | None
:
: | None
"""Returns the SOR file as a byte string."""
...
"""Writes the SOR file to the given path."""
...
"""Validates the specified raw bytes using the parsed file data.
Checksums for OTDR data are optional and poorly-defined,
so parsing the file before performing the checksum allows us to be smart about
trying different strategies for how the checksum might have been computed.
Returns an enum. You should generally treat a missing checksum as non-fatal."""
...
"""Load a SOR from the given path and parse it"""
"""Parse a SOR file from the given bytes"""