Exemplo n.º 1
0
def get_agent_statuses_data():
    base_statuses = [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]

    en_statuses = [
        [[0, 0, 0], [1, 1, 1], [2, 2, 2]],
        [[0, 0, 0], [1, 1, 1], [2, 2, 2]],
        # Uniform across ensemble
        [[0, 1, 2], [0, 1, 2], [0, 1, 2]],
        # Mixed, no majority
        [[0, 0, 0], [1, 1, 1], [2, 2, 2]],
        # Mixed, majority
        [[0, 1, 1], [1, 1, 2], [0, 2, 2]]
    ]

    inclusion = [
        None, AgentIncluder.BASE, AgentIncluder.MODE_EN, AgentIncluder.MODE_EN,
        AgentIncluder.MODE_EN
    ]

    expected = [[False, True, False], [False, True, False],
                [False, True, False], [False, False, False],
                [False, True, False]]

    output = wrap_up([base_statuses, en_statuses, inclusion, expected])
    return output
Exemplo n.º 2
0
def get_make_noise_data():
    shapes = (10, 20)

    R_vectors = (np.ones(shapes[0]), np.full(shapes[1], 1.5))

    output = wrap_up([shapes, R_vectors])
    return output
Exemplo n.º 3
0
def get_state_vector_statuses_data():
    base_statuses = [[0, 1, 2], [0, 1, 2], [0, 1, 2], [0, 1, 2]]

    en_statuses = [[[0, 1, 2], [0, 1, 2], [0, 1, 2]],
                   [[0, 1, 2], [0, 1, 2], [0, 1, 2]],
                   [[1, 0, 2], [1, 0, 2], [1, 0, 2]],
                   [[1, 0, 2], [1, 0, 2], [1, 0, 2]]]

    inclusion = [
        AgentIncluder.BASE, AgentIncluder.BASE, AgentIncluder.MODE_EN,
        AgentIncluder.MODE_EN
    ]

    vector_mode = [
        EnsembleKalmanFilterType.STATE, EnsembleKalmanFilterType.DUAL_EXIT,
        EnsembleKalmanFilterType.STATE, EnsembleKalmanFilterType.DUAL_EXIT
    ]

    expected = [[False, False, True, True, False, False],
                [False, False, False, True, True, True, False, False, False],
                [True, True, False, False, False, False],
                [True, True, True, False, False, False, False, False, False]]

    output = wrap_up(
        [base_statuses, en_statuses, inclusion, vector_mode, expected])
    return output
Exemplo n.º 4
0
def get_np_cov_data():
    arrays = [np.array([[0, 2], [1, 1], [2, 0]]).T]

    expected = [np.array([[1., -1.], [-1., 1.]])]

    outputs = wrap_up([arrays, expected])
    return outputs
Exemplo n.º 5
0
def get_population_mean_max_data():
    diffs = ([0, 3, 1, 4, 2], [0, 0, 3, 3, 0], [1, 1, 1, 1, 1])

    ensemble_actives = ([4, 4, 4, 4, 4], [1, 2, 3, 2, 3], [0, 0, 1, 0, 0])

    expected = (2.5, 2, 5)

    output = wrap_up([diffs, ensemble_actives, expected])
    return output
Exemplo n.º 6
0
def get_population_mean_base_data():
    diffs = ([0, 1, 1, 1, 3], [0, 4, 0, 2, 3], [1, 0, 0, 1, 0])

    active_pops = (3, 2, 2)

    expected = (2, 4.5, 1)

    output = wrap_up([diffs, active_pops, expected])
    return output
Exemplo n.º 7
0
def get_mean_data():
    results = ([2, 5, 3, 6, 4], [3, 6, 9, 12, 15], [0, 0, 0, 0, 0])

    truths = ([2, 2, 2, 2, 2], [3, 6, 6, 9, 15], [1, 1, 1, 1, 1])

    expected = (2, 1.2, 1)

    output = wrap_up([results, truths, expected])
    return output
Exemplo n.º 8
0
def get_distance_error_default_data():
    x_errors = ([0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 2, 3, 4, 5])

    y_errors = ([1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [2, 4, 6, 8, 10])

    expected = (1, 1, 3 * sqrt(5))

    output = wrap_up([x_errors, y_errors, expected])
    return output
Exemplo n.º 9
0
def get_destination_vector_data():
    destinations = ([[0, 100], [100, 0], [50, 50], [300, 100],
                     [125, 225]], [[325, 725], [125, 0], [5, 100], [300, 3],
                                   [17, 23]])

    expected = (np.array([0, 100, 100, 0, 50, 50, 300, 100, 125, 225]),
                np.array([325, 725, 125, 0, 5, 100, 300, 3, 17, 23]))

    outputs = wrap_up([destinations, expected])
    return outputs
Exemplo n.º 10
0
def get_update_status_data():
    m_statuses = [(1, 1, 1, 1, 1), (1, 1, 1, 1, 1), (0, 0, 0, 0, 0),
                  (0, 0, 0, 0, 0), (1, 0, 1, 0, 1), (1, 0, 1, 0, 1)]

    filter_status = (True, False, True, False, True, False)

    expected = (True, True, False, False, True, True)

    output = wrap_up([m_statuses, filter_status, expected])
    return output
Exemplo n.º 11
0
def get_distance_error_base_data():
    x_errors = ([0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 2, 3, 4, 5])

    y_errors = ([1, 1, 1, 1, 1], [0, 0, 0, 0, 0], [2, 4, 6, 8, 10])

    n_active = (1, 2, 3)

    expected = (5, 2.5, 5 * sqrt(5))

    output = wrap_up([x_errors, y_errors, n_active, expected])
    return output
Exemplo n.º 12
0
def get_filter_vector_data():
    vector = [np.arange(5) for _ in range(3)]

    statuses = [[False, False, False, False, False],
                [True, True, True, True, True],
                [True, False, True, False, False]]

    expected = [np.array([]), np.array([0, 1, 2, 3, 4]), np.array([0, 2])]

    output = wrap_up([vector, statuses, expected])
    return output
Exemplo n.º 13
0
def get_update_state_mean_data():
    state_ensembles = (np.array([[11, 10, 9, 9, 11], [5, 5, 5, 4, 6],
                                 [21, 15, 18, 18, 18], [0, 0, 0, 0, 0]]),
                       np.array([[1, 1, 1, 1, 1], [2, 2, 2, 2, 2],
                                 [1, 2, 3, 4, 5]]))

    expected = (np.array([10, 5, 18, 0]), np.array([1, 2, 3]))

    outputs = wrap_up([state_ensembles, expected])

    return outputs
Exemplo n.º 14
0
def get_calculate_rmse_default_data():
    x_truths = ([22, 53, 45], [123, 321, 222])

    y_truths = ([18, 46, 80], [11, 32, 23])

    x_results = ([26, 50, 40], [120, 336, 210])

    y_results = ([15, 50, 80], [15, 40, 18])

    expected = (5, 35 / 3)

    output = wrap_up([x_truths, y_truths, x_results, y_results, expected])
    return output
Exemplo n.º 15
0
def get_origin_vector_data():
    origins = ([[0, 0], [0, 0], [0, 0], [0, 0], [0,
                                                 0]], [[0, 100], [100, 0],
                                                       [300, 125], [125, 300],
                                                       [0, 0]], [[100, 125],
                                                                 [0, 0],
                                                                 [125, 225],
                                                                 [0, 0],
                                                                 [750, 125]])

    statuses = ([0, 0, 0, 0, 0], [1, 1, 1, 1, 1], [1, 0, 1, 0, 1])

    expected = (np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
                np.array([0, 100, 100, 0, 300, 125, 125, 300, 0, 0]),
                np.array([100, 125, 0, 0, 125, 225, 0, 0, 750, 125]))

    outputs = wrap_up([origins, statuses, expected])
    return outputs
Exemplo n.º 16
0
def get_separate_coords_exits_data():
    state_vectors = [
        np.array([10, 20, 3]),
        np.array([10, 12, 15, 20, 35, 25, 3, 4, 5]),
        np.array([10, 12, 15, 9, 5, 20, 35, 25, 4, 13, 3, 4, 5, 7, 2])
    ]

    pop_sizes = (1, 3, 5)

    expected = [(np.array([10]), np.array([20]), np.array([3])),
                (np.array([10, 12, 15]), np.array([20, 35,
                                                   25]), np.array([3, 4, 5])),
                (np.array([10, 12, 15, 9,
                           5]), np.array([20, 35, 25, 4,
                                          13]), np.array([3, 4, 5, 7, 2]))]

    output = wrap_up([state_vectors, pop_sizes, expected])
    return output
Exemplo n.º 17
0
def get_make_gain_matrix_data():
    x = np.array([[5, 6, 4], [10, 11, 9]])
    y = np.array([[11, 10, 10, 9, 10], [5, 6, 4, 4, 6], [21, 15, 18, 18, 18],
                  [0, 0, 0, 0, 0]])
    state_ensembles = (x, y)

    data_covariances = (np.identity(2), np.identity(4))

    Hs = (np.identity(2), np.identity(4))

    ex_x = 1 / 3 * np.ones((2, 2))
    ex_y = np.array([[0.2494382, 0.13932584, 0.12134831, 0.0],
                     [0.13932584, 0.44719101, -0.09438202, 0.0],
                     [0.12134831, -0.09438202, 0.78876404, 0.0],
                     [0.0, 0.0, 0.0, 0.0]])
    expected = (ex_x, ex_y)

    output = wrap_up([state_ensembles, data_covariances, Hs, expected])
    return output
Exemplo n.º 18
0
def get_forecast_error_data():
    # Case 1: None inclusion
    # Case 2: Base inclusion, ensemble var 1
    # Case 3: Base inclusion, ensemble var 2
    # Case 4: Mode inclusion, base var 1
    # Case 5: Mode inclusion, base var 2
    inclusion = [
        None, AgentIncluder.BASE, AgentIncluder.BASE, AgentIncluder.MODE_EN,
        AgentIncluder.MODE_EN
    ]

    base_statuses = [[1, 1, 1], [1, 0, 1], [1, 0, 1], [1, 1, 1], [0, 0, 0]]

    ensemble_statuses = [[[1, 1, 1], [1, 0, 1], [1, 0, 0]],
                         [[1, 1, 1], [1, 1, 1], [1, 1, 1]],
                         [[1, 1, 1], [1, 0, 1], [1, 0, 0]],
                         [[1, 1, 1], [1, 0, 1], [1, 0, 1]],
                         [[1, 1, 1], [1, 0, 1], [1, 0, 1]]]

    t = np.array([1, 1, 5, 10, 22, 76])
    truth = [t for _ in range(5)]

    state_mean = [
        np.array([4, 5, 9, 7, 25, 80]),
        np.array([6, 13, 9, 7, 25, 80]),
        np.array([6, 13, 9, 7, 25, 80]),
        np.array([6, 13, 9, 7, 25, 80]),
        np.array([6, 13, 9, 7, 25, 80])
    ]

    expected = [5, 9, 9, 9, 9]

    output = wrap_up([
        inclusion, base_statuses, ensemble_statuses, truth, state_mean,
        expected
    ])
    return output