Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make native_filters backward compatible for truth catalog #309

Merged
merged 1 commit into from
May 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion GCRCatalogs/dc2_truth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import warnings
import sqlite3
import numpy as np
import h5py
import warnings
from GCR import BaseGenericCatalog
from .utils import md5, is_string_like

Expand Down Expand Up @@ -67,6 +67,16 @@ def _native_qty_getter(qty_name):
return file_handle[qty_name].value
yield _native_qty_getter

def get_quantities(self, quantities, filters=None, native_filters=None, return_iterator=False):
if native_filters is not None:
warnings.warn('For this particular truth catalog, `native_filters` is no longer supported.\n'
'Please use `filters` instead. For now this code will include your `native_filters` in `filters`.\n'
'(Note that `native_filters` still works for other GCR catalogs.)')
filters = self._preprocess_filters(native_filters) & self._preprocess_filters(filters)
native_filters = None

return super().get_quantities(quantities, filters, native_filters, return_iterator)


class DC2TruthCatalogReader(BaseGenericCatalog):
"""
Expand Down