# Check for any errors with initializing commands
    log_all_events(tcp_socket)

    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # wait until the channel is fully ramped
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # check for all events and measure readings on Channel 1 once per second for 10 seconds,
    # it is best practice to do this to ensure Channel 1 is on and does not have any errors
    time_end = time.time() + 10
    while time.time() < time_end:
        log_all_events(tcp_socket)
        log_memory_table_read(tcp_socket)
        wait(1)

    # set Channel 1's current to 200 mA while running
    tcp_socket.send_scpi_command('SOUR1:CURR 0.2')

    # set Channel 1's Pulse On Time to 100µs dynamically while channel is operating. Check events and measure readings
    tcp_socket.send_scpi_command('SOUR1:PULS:TON 0.0001')
    log_all_events(tcp_socket)
    log_memory_table_read(tcp_socket)
    wait(1)

    # set Channel 1's Pulse Off Time to 100µs dynamically while channel is operating. Check events and measure readings
    tcp_socket.send_scpi_command('SOUR1:PULS:TOFF 0.0001')

    # after dynamically applying all new settings, check for all events and measure readings on Channel 1 once per second for 5 seconds
    time_end = time.time() + 5
    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # Wait until channel is ready for a trigger command
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # Output 1ms pulse for Channel 1
    tcp_socket.send_scpi_command('OUTP1:TRIG')

    # check for all events and measure readings on the channel once per second for 2 seconds,
    # it is best practice to do this to ensure the channel is on and does not have any errors
    time_end = time.time() + 2
    while time.time() < time_end:
        log_all_events(tcp_socket)
        log_memory_table_read(tcp_socket)
        wait(1)

    # check that the Multi Pulse output has ended
    hasMultiPulseEndedString = ''
    while hasMultiPulseEndedString != 'TRUE':
        tcp_socket.send_scpi_command('SOUR1:PULS:END?')
        hasMultiPulseEndedString = tcp_socket.read_data()
        wait(0.5)

    # set the Force Sense Selector Switch state to Auxiliary to disconnect the SpikeSafe output from the DUT
    # this action can be performed as long as no pulses are actively being outputted from the SpikeSafe. The channel may be enabled
    tcp_socket.send_scpi_command('OUTP1:CONN AUX')

    # Show a message box so any tasks using the Auxiliary source may be performed before adjusting the switch back to Primary
    # The SpikeSafe is not electrically connected to the DUT at this time
    messagebox.showinfo(
    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # wait until Channel 1 is ready to pulse
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    log_and_print_to_console(
        '\nMeasurement Current is currently outputting to the DUT.\n\nPress \'Enter\' in the console once temperature has been stabilized at T1, then record V1 and T1.'
    )
    input()
    log_and_print_to_console('Enter T1 (in °C):')
    temperature_one = float(receive_user_input_and_log())
    log_and_print_to_console('Enter V1 (in V):')
    voltage_one = float(receive_user_input_and_log())

    wait(2)

    log_and_print_to_console(
        '\nMeasurement Current is currently outputting to the DUT.\n\nChange the control temperature to T2.\n\nPress \'Enter\' in the console once temperature has been stabilized at T2, then record V2 and T2.'
    )
    input()
    log_and_print_to_console('Enter T2 (in °C):')
    temperature_two = float(receive_user_input_and_log())
    log_and_print_to_console('Enter V2 (in °C):')
    voltage_two = float(receive_user_input_and_log())

    k_factor = (voltage_two - voltage_one) / (temperature_two -
                                              temperature_one)
    log_and_print_to_console('K-factor: {} V/°C'.format(k_factor))

    # turn off Channel 1
    # turn on Channel 1 
    tcp_socket.send_scpi_command('OUTP1 1')

    # wait until Channel 1 is ready to pulse
    read_until_event(tcp_socket, 100) # event 100 is "Channel Ready"

    # output the Digitizer hardware output trigger. 10µs after this signal is outputted, the Multi Pulse sequence will start
    tcp_socket.send_scpi_command('VOLT:OUTP:TRIG')

    # check that the Multi Pulse output has ended
    has_multi_pulse_ended = ''
    while has_multi_pulse_ended != 'TRUE':
        tcp_socket.send_scpi_command('SOUR1:PULS:END?')
        has_multi_pulse_ended =  tcp_socket.read_data()
        wait(0.5)

    # output the Digitizer hardware output trigger. As long as the SpikeSafe is ready to pulse, this can be done continuously
    tcp_socket.send_scpi_command('VOLT:OUTP:TRIG')

    # check that the Multi Pulse output has ended
    has_multi_pulse_ended = ''
    while has_multi_pulse_ended != 'TRUE':
        tcp_socket.send_scpi_command('SOUR1:PULS:END?')
        has_multi_pulse_ended =  tcp_socket.read_data()
        wait(0.5)

    # wait for the Digitizer measurements to complete 
    wait_for_new_voltage_data(tcp_socket, 0.5)

    # fetch the Digitizer voltage readings using VOLT:FETC? query
    # Check for any errors with initializing commands
    log_all_events(tcp_socket)

    # turn on Channel 1
    tcp_socket.send_scpi_command('OUTP1 1')

    # wait until the channel is fully ramped
    read_until_event(tcp_socket, 100)  # event 100 is "Channel Ready"

    # check for all events and measure readings on Channel 1 once per second for 5 seconds,
    # it is best practice to do this to ensure Channel 1 is on and does not have any errors
    time_end = time.time() + 5
    while time.time() < time_end:
        log_all_events(tcp_socket)
        log_memory_table_read(tcp_socket)
        wait(1)

    # set Channel 1's Pulse Hold to Period. Setting any pulse-related setting will not re-calculate Pulse Period
    tcp_socket.send_scpi_command('SOUR1:PULS:HOLD PER')
    log_and_print('Held Pulse Period')

    # set Channel 1's Pulse Width to 8ms. Since Period is being held, the Period will remain at 10ms
    pulse_width_seconds = 0.008
    tcp_socket.send_scpi_command(
        'SOUR1:PULS:WIDT {}'.format(pulse_width_seconds))
    log_and_print('Set Pulse Width to {}s'.format(pulse_width_seconds))

    # verify that the expected updates are made to the pulse settings
    verify_current_pulse_settings(tcp_socket)

    # wait two seconds while running with the newly updated settings