From 95b0bf214ff1608082c85ab4182277934c424d76 Mon Sep 17 00:00:00 2001 From: Yao-Yuan Mao Date: Thu, 30 May 2019 12:40:14 -0400 Subject: [PATCH] make get_quantities backward compatible for truth catalog --- GCRCatalogs/dc2_truth.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/GCRCatalogs/dc2_truth.py b/GCRCatalogs/dc2_truth.py index d4b9e09e..065ad81d 100644 --- a/GCRCatalogs/dc2_truth.py +++ b/GCRCatalogs/dc2_truth.py @@ -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 @@ -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): """