def get_ID_bounds(halo_file, max_chunk_sz = None, chunk_dir = 'pchunks'):
    halos = np.loadtxt(halo_file)
    if not max_chunk_sz: max_chunk_sz = halos[0][N200a]

    cur_sum = halos[0][N200a]
    left_bound = halos[0][ID]
    right_bound = halos[0][ID]
    
    ID_bounds = []
    for h in halos:
        cur_id, num_p = h[ID], h[N200a]
        if cur_sum + num_p > max_chunk_sz:
            ID_bounds.append((left_bound, right_bound))
            left_bound = cur_id
            right_bound = cur_id
            cur_sum = num_p
        else: 
            cur_sum += num_p
            right_bound += 1
    if (max_chunk_sz == halos[0][N200a]): return ID_bounds[1:]
    else: return ID_bounds
dataset/ETHPy150Open alklein/cosmo-ML/chunk_manager.py/get_ID_bounds/original