def make_chunks(ID_bounds):
    i = 0 
    (left_bound, right_bound) = ID_bounds[i]
    cur_chunk = []
    for line in open('particles.txt'):
        particle = [float(val) for val in line.split()]
        cur_ID = particle[1]
        if (cur_ID >= left_bound and cur_ID <= right_bound):
            cur_chunk.append(particle)
        else: 
            # time to save chunk
            os.chdir(chunk_dir)
            filename = get_filename(left_bound, right_bound)
            print '\nsaving array of length',len(cur_chunk),'to file:',filename
            print '\t Progress:',100*len(ID_bounds)/(i+1.),'%'
            assert len(cur_chunk) > 0
            np.savetxt(filename, cur_chunk)
            os.chdir('..')
            # start new chunk
            i += 1
            (left_bound, right_bound) = ID_bounds[i]
            cur_chunk = [] # reset to blank chunk
            if (cur_ID >= left_bound and cur_ID <= right_bound):
                cur_chunk.append(particle)
dataset/ETHPy150Open alklein/cosmo-ML/chunk_manager.py/make_chunks/swapped operands of `/`