Ext_offset help script

Hello, I am new in this topic
can someone check if the script is correct

whether the ext_offset fault will properly arm after the reset

nrst and tio4 connected together to reset

will it count correctly after tio4?

The oscilloscope shows correctly

It wants to attack different lengths and offsets

#Initial Setup
#scope.adc.offset = 0
scope.clock.adc_src = "clkgen_x1"
scope.trigger.triggers = "tio4"
scope.io.glitch_hp = True
scope.io.hs2 = None

#scope.glitch.width = 40
scope.adc.basic_mode = "rising_edge"
scope.clock.clkgen_freq = 80E6 * freq_multiplier
scope.glitch.clk_src = "clkgen"
scope.glitch.trigger_src = "ext_single"
scope.glitch.output = "enable_only"


%matplotlib notebook
import matplotlib.pylab as plt
import numpy as np

Range = namedtuple("Range", ["min", "max", "step"])
offset_range = Range(79431*freq_multiplier, 79985*freq_multiplier, 1)
repeat_range = Range(126*freq_multiplier, 146*freq_multiplier, 1)

scope.glitch.repeat = repeat_range.min


import time

print("Attempting to glitch LPC Target")

scope.io.target_pwr = False
time.sleep(0.2)
scope.io.target_pwr = True
time.sleep(0.2)



done = False
while done == False:
    scope.glitch.ext_offset = offset_range.min
    if scope.glitch.repeat >= repeat_range.max:
        scope.glitch.repeat = repeat_range.min
    while scope.glitch.ext_offset < offset_range.max:
        time.sleep(0.75)
        scope.io.nrst = 'low'
        scope.arm()
        scope.io.nrst = 'high'
        #time.sleep(4.05)

        print("Glitch offset %4d, width %d.."%(scope.glitch.ext_offset, scope.glitch.repeat), end="")

       
    
        scope.glitch.ext_offset += offset_range.step

    scope.glitch.repeat += repeat_range.step

The second thing is how to calculate offset T to B?

Can someone help me