예제 #1
0
def test_lag_count_category(data):
    """Test transition counts by lag for within-category transitions."""
    # within category
    actual, possible = transitions.count_lags(
        data['list_length'],
        [data['pool_position']],
        [data['output_position']],
        pool_test=[data['pool_category']],
        recall_test=[data['output_category']],
        test=lambda x, y: x == y,
    )
    np.testing.assert_array_equal(
        actual.to_numpy(),
        np.array([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0]))
    np.testing.assert_array_equal(
        possible.to_numpy(),
        np.array([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 1, 0, 0]))

    # across category
    actual, possible = transitions.count_lags(
        data['list_length'],
        [data['pool_position']],
        [data['output_position']],
        pool_test=[data['pool_category']],
        recall_test=[data['output_category']],
        test=lambda x, y: x != y,
    )
    np.testing.assert_array_equal(
        actual.to_numpy(),
        np.array([0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0]))
    np.testing.assert_array_equal(
        possible.to_numpy(),
        np.array([0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1]))
예제 #2
0
def test_lag_count_block_unique(data):
    """Test transition counts by unique block lag."""
    actual, possible = transitions.count_lags(data['n_block'],
                                              [data['pool_block']],
                                              [data['output_block']],
                                              count_unique=True)
    np.testing.assert_array_equal(actual.to_numpy(),
                                  np.array([0, 0, 2, 1, 1, 1, 0]))
    np.testing.assert_array_equal(possible.to_numpy(),
                                  np.array([2, 0, 4, 3, 3, 3, 1]))
예제 #3
0
def test_lag_count(data):
    """Test transition counts by serial position lag."""
    actual, possible = transitions.count_lags(data['list_length'],
                                              [data['pool_position']],
                                              [data['output_position']])
    np.testing.assert_array_equal(
        actual.to_numpy(),
        np.array([0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0]))
    np.testing.assert_array_equal(
        possible.to_numpy(),
        np.array([0, 1, 1, 0, 1, 2, 3, 0, 3, 3, 3, 3, 2, 1, 1]))
예제 #4
0
    def test_lag_count_category(self):
        actual, possible = transitions.count_lags(
            self.list_length, [self.pool_position], [self.output_position],
            pool_test=[self.pool_category],
            recall_test=[self.output_category],
            test=lambda x, y: x == y)

        np.testing.assert_array_equal(
            actual.to_numpy(),
            np.array([0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0]))

        np.testing.assert_array_equal(
            possible.to_numpy(),
            np.array([0, 0, 0, 0, 1, 1, 3, 0, 2, 1, 1, 0, 0, 0, 0]))
예제 #5
0
    def test_lag_count(self):
        actual, possible = transitions.count_lags(
            self.list_length,
            [self.pool_position],
            [self.output_position],
        )

        np.testing.assert_array_equal(
            actual.to_numpy(),
            np.array([0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0]))

        np.testing.assert_array_equal(
            possible.to_numpy(),
            np.array([0, 1, 1, 0, 1, 2, 3, 0, 3, 3, 3, 3, 2, 1, 1]))