def test_lazy_two_time():
    setup()
    # run the correlation on the full stack
    full_gen = lazy_two_time(rois, img_stack, stack_size,
                             stack_size, 1)
    for full_state in full_gen:
        pass
    final_result = two_time_state_to_results(full_state)

    # make sure we have essentially zero correlation in the images,
    # since they are random integers
    assert 0.01 < np.average(final_result.g2-1)

    # run the correlation on the first half
    gen_first_half = lazy_two_time(rois, img_stack[:stack_size//2], stack_size,
                                   num_bufs=stack_size, num_levels=1)
    for first_half_state in gen_first_half:
        pass
    # run the correlation on the second half by passing in the state from the
    # first half
    gen_second_half = lazy_two_time(rois, img_stack[stack_size//2:],
                                    stack_size, num_bufs=stack_size,
                                    num_levels=1,
                                    two_time_internal_state=first_half_state)

    for second_half_state in gen_second_half:
        pass
    result = two_time_state_to_results(second_half_state)

    assert np.all(full_state.g2 == result.g2)
dataset/ETHPy150Open scikit-beam/scikit-beam/skbeam/core/tests/test_correlation.py/test_lazy_two_time/swapped operands of `<`