diff --git a/GCRCatalogs/dc2_object.py b/GCRCatalogs/dc2_object.py index 6f9e6de1..a83c2616 100644 --- a/GCRCatalogs/dc2_object.py +++ b/GCRCatalogs/dc2_object.py @@ -276,8 +276,10 @@ def _subclass_init(self, **kwargs): dm_schema_version = 1 elif any(col.endswith('_fluxErr') for col in self._schema): dm_schema_version = 2 - else: + elif any(col == 'base_Blendedness_abs_instFlux' for col in self._schema): dm_schema_version = 3 + else: + dm_schema_version = 4 bands = [col[0] for col in self._schema if len(col) == 5 and col.endswith('_mag')] @@ -291,25 +293,25 @@ def __del__(self): @staticmethod def _generate_modifiers(pixel_scale=0.2, bands='ugrizy', - has_modelfit_mag=True, dm_schema_version=3): + has_modelfit_mag=True, dm_schema_version=4): """Creates a dictionary relating native and homogenized column names Args: pixel_scale (float): Scale of pixels in coadd images bands (list): List of photometric bands as strings has_modelfit_mag (bool): Whether or not pre-calculated model fit magnitudes are present - dm_schema_version (int): DM schema version (1, 2, or 3) + dm_schema_version (int): DM schema version (1, 2, 3, 4) Returns: A dictionary of the form {: , ...} """ - if dm_schema_version not in (1, 2, 3): - raise ValueError('Only supports dm_schema_version == 1, 2, or 3') + if dm_schema_version not in (1, 2, 3, 4): + raise ValueError('Only supports dm_schema_version == 1, 2, 3, 4') FLUX = 'flux' if dm_schema_version <= 2 else 'instFlux' ERR = 'Sigma' if dm_schema_version <= 1 else 'Err' - + BLENDEDNESS_SUFFIX = '_%s' % FLUX if dm_schema_version <= 3 else '' modifiers = { 'objectId': 'id', @@ -323,7 +325,7 @@ def _generate_modifiers(pixel_scale=0.2, bands='ugrizy', 'xy_flag': 'base_SdssCentroid_flag', 'psNdata': 'base_PsfFlux_area', 'extendedness': 'base_ClassificationExtendedness_value', - 'blendedness': 'base_Blendedness_abs_{}'.format(FLUX), + 'blendedness': 'base_Blendedness_abs{}'.format(BLENDEDNESS_SUFFIX), } not_good_flags = (