def dphi_dop_chunked(t, profile, r0_vec, v_vec, d_hat, use_form=False, use_chunk=False, chunk_size=10000, verbose=False, form_fun=None, interp_table=None, time_end=np.inf):
    '\n\n    Compute dphi but in chunks over the subhalos, use when Nt x N is too large an array to\n    store in memory\n\n    '
    num_objects = len(list(profile.items())[0][1])
    dphi = np.zeros(len(t))
    if (use_chunk == True):
        if ((num_objects % chunk_size) == 0):
            num_chunks = (num_objects // chunk_size)
        else:
            num_chunks = ((num_objects // chunk_size) + 1)
        if verbose:
            print(('   Chunking data (%d chunks) ... ' % num_chunks))
            print()
        for i in range(num_chunks):
            if (time() > time_end):
                raise TimeoutError
            r0_c = r0_vec[(i * chunk_size):((i + 1) * chunk_size)]
            v_c = v_vec[(i * chunk_size):((i + 1) * chunk_size)]
            profile_c = {}
            for key in list(profile):
                profile_c[key] = profile[key][(i * chunk_size):((i + 1) * chunk_size)]
            dphi += dphi_dop(t, profile_c, r0_c, v_c, d_hat, use_form=use_form, form_fun=form_fun, interp_table=interp_table)
    else:
        dphi += dphi_dop(t, profile, r0_vec, v_vec, d_hat, use_form=use_form, form_fun=form_fun, interp_table=interp_table)
    return dphi
Compute dphi but in chunks over the subhalos, use when Nt x N is too large an array to
store in memory
def dphi_dop_chunked(t, profile, r0_vec, v_vec, d_hat, use_form=False, use_chunk=False, chunk_size=10000, verbose=False, form_fun=None, interp_table=None, time_end=np.inf):
    '\n\n    Compute dphi but in chunks over the subhalos, use when Nt x N is too large an array to\n    store in memory\n\n    '
    num_objects = len(list(profile.items())[0][1])
    dphi = np.zeros(len(t))
    if (use_chunk == True):
        if ((num_objects % chunk_size) == 0):
            num_chunks = (num_objects // chunk_size)
        else:
            num_chunks = ((num_objects // chunk_size) + 1)
        if verbose:
            print(('   Chunking data (%d chunks) ... ' % num_chunks))
            print()
        for i in range(num_chunks):
            if (time() > time_end):
                raise TimeoutError
            r0_c = r0_vec[(i * chunk_size):((i + 1) * chunk_size)]
            v_c = v_vec[(i * chunk_size):((i + 1) * chunk_size)]
            profile_c = {}
            for key in list(profile):
                profile_c[key] = profile[key][(i * chunk_size):((i + 1) * chunk_size)]
            dphi += dphi_dop(t, profile_c, r0_c, v_c, d_hat, use_form=use_form, form_fun=form_fun, interp_table=interp_table)
    else:
        dphi += dphi_dop(t, profile, r0_vec, v_vec, d_hat, use_form=use_form, form_fun=form_fun, interp_table=interp_table)
    return dphi