def delete_snapshots(snapshot_directory='output', snapshot_index_limits=[1, 599], delete_halos=False):
    '\n    Delete all snapshots in given directory within snapshot_index_limits,\n    except for those in snapshot_indices_keep list.\n\n    Parameters\n    ----------\n    snapshot_directory : str : directory of snapshots\n    snapshot_index_limits : list : min and max snapshot indices to delete\n    delete_halos : bool : whether to delete halo catalog files at same snapshot times\n    '
    snapshot_name_base = 'snap*_{:03d}*'
    if (not snapshot_directory):
        snapshot_directory = 'output/'
    halo_name_base = 'halos_{:03d}*'
    halo_directory = 'halo/rockstar_dm/catalog/'
    if (snapshot_directory[(- 1)] != '/'):
        snapshot_directory += '/'
    if ((snapshot_index_limits is None) or (not len(snapshot_index_limits))):
        snapshot_index_limits = [1, 599]
    snapshot_indices = np.arange(snapshot_index_limits[0], (snapshot_index_limits[1] + 1))
    print()
    for snapshot_index in snapshot_indices:
        if (snapshot_index not in snapshot_indices_keep):
            snapshot_name = (snapshot_directory + snapshot_name_base.format(snapshot_index))
            print('* deleting:  {}'.format(snapshot_name))
            os.system('rm -rf {}'.format(snapshot_name))
            if delete_halos:
                halo_name = (halo_directory + halo_name_base.format(snapshot_index))
                print('* deleting:  {}'.format(halo_name))
                os.system('rm -rf {}'.format(halo_name))
    print()
Delete all snapshots in given directory within snapshot_index_limits,
except for those in snapshot_indices_keep list.

Parameters
----------
snapshot_directory : str : directory of snapshots
snapshot_index_limits : list : min and max snapshot indices to delete
delete_halos : bool : whether to delete halo catalog files at same snapshot times
def delete_snapshots(snapshot_directory='output', snapshot_index_limits=[1, 599], delete_halos=False):
    '\n    Delete all snapshots in given directory within snapshot_index_limits,\n    except for those in snapshot_indices_keep list.\n\n    Parameters\n    ----------\n    snapshot_directory : str : directory of snapshots\n    snapshot_index_limits : list : min and max snapshot indices to delete\n    delete_halos : bool : whether to delete halo catalog files at same snapshot times\n    '
    snapshot_name_base = 'snap*_{:03d}*'
    if (not snapshot_directory):
        snapshot_directory = 'output/'
    halo_name_base = 'halos_{:03d}*'
    halo_directory = 'halo/rockstar_dm/catalog/'
    if (snapshot_directory[(- 1)] != '/'):
        snapshot_directory += '/'
    if ((snapshot_index_limits is None) or (not len(snapshot_index_limits))):
        snapshot_index_limits = [1, 599]
    snapshot_indices = np.arange(snapshot_index_limits[0], (snapshot_index_limits[1] + 1))
    print()
    for snapshot_index in snapshot_indices:
        if (snapshot_index not in snapshot_indices_keep):
            snapshot_name = (snapshot_directory + snapshot_name_base.format(snapshot_index))
            print('* deleting:  {}'.format(snapshot_name))
            os.system('rm -rf {}'.format(snapshot_name))
            if delete_halos:
                halo_name = (halo_directory + halo_name_base.format(snapshot_index))
                print('* deleting:  {}'.format(halo_name))
                os.system('rm -rf {}'.format(halo_name))
    print()