Ejemplo n.º 1
0
def index_ingestion_bout_and_homebase_timestamps(t, idx, fbouts, dbouts):
    """returns a mask which excludes timestamps indexes corresponding to ingestion bouts
        and position at homebase
    """
    i_fdb = Intervals(fbouts).union(Intervals(dbouts))
    mask = np.ones(t.shape[0], dtype=bool)
    for timestamp in xrange(t.shape[0]):
        if i_fdb.contains(t[timestamp]):
            mask[timestamp] = False

    mask = mask & idx
    log_text = "locomotion: flagged {} events occurring at homebase and/or during ingestion bouts".format(
        mask.shape[0] - mask.sum())
    return mask, log_text