def domains_to_xyt(xyt, domains):
    """
    This function takes in xyt data and a list of domains and converts the list of domains into a list of
    xyt points within those domains. This list can then be used to graph the domains onto the entire worm
    path, for visualization.
    :param xyt: A list of xyt points.
    :param domains: A list of domains, which are themselves a list of two values, representing time indices
    that frame a period of zero movement in the worm path.
    :return: Three lists, each one representing values of x, y, and t within the given input domains. These can
    be zipped together to get a list of xyt points within the domains.
    """
    x, y, t = zip(*xyt)
    domains_x = []
    domains_y = []
    domains_t = []
    for domain in domains:
        left = domain[0]
        right = domain[1]
        domains_x.extend(x[left:right])
        domains_y.extend(y[left:right])
        domains_t.extend(t[left:right])
    return domains_x, domains_y, domains_t