def test_statistic_matrix_single_pandas(): spatial_weight_matrix = checkerboard_similarity() known_arrangements = get_spatial_vectors_df()[["A", "B"]] known_answers = get_known_answers()[0:2, 0:2] passes = np.allclose( known_answers, leesl.statistic_matrix(known_arrangements, spatial_weight_matrix)) assert passes
def test_statistic_matrix_single_numpy(): # Switch from pandas to numpy. spatial_weight_matrix = checkerboard_similarity().values known_arrangements_np = get_spatial_vectors_df()[["A", "B"]].values known_answers = get_known_answers()[0:2, 0:2] passes = np.allclose( known_answers, leesl.statistic_matrix(known_arrangements_np, spatial_weight_matrix)) assert passes
def test_statistic_matrix_many_numpy(): # Switch from pandas to numpy. spatial_weight_matrix = checkerboard_similarity().values known_attrs = get_spatial_vectors_df().values known_answers = get_known_answers() passes = np.allclose( known_answers, leesl.statistic_matrix(known_attrs, spatial_weight_matrix)) assert passes
def test_statistic_matrix_both_sides_np(): spatial_weight_matrix = checkerboard_similarity() known_arrangements_np = get_spatial_vectors_df().values known_answers = get_known_answers() passes = np.allclose( known_answers, leesl.statistic_matrix(known_arrangements_np, spatial_weight_matrix, known_arrangements_np)) assert passes