trim_response_set_and_counts

def trim_response_set_and_counts(response_sets, counts)

Trims all true or all false responses from the response set/counts.

Args

response_set
(2D array) response set by persons obtained by running numpy.unique
counts
counts associated with response set

Returns

response_set
updated response set with removal of undesired response patterns
counts
updated counts to account for removal
Expand source code
def trim_response_set_and_counts(response_sets, counts):
    """ Trims all true or all false responses from the response set/counts.

    Args:
        response_set:  (2D array) response set by persons obtained by running
                        numpy.unique
        counts:  counts associated with response set

    Returns:
        response_set: updated response set with removal of undesired response patterns
        counts: updated counts to account for removal
    """
    # Remove response sets where output is all true/false
    mask = ~(np.nanvar(response_sets, axis=0) == 0)
    response_sets = response_sets[:, mask]
    counts = counts[mask]

    return response_sets, counts