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

Issues/323 - Update blendedness definition #324

Merged
merged 2 commits into from
Jun 11, 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
16 changes: 9 additions & 7 deletions GCRCatalogs/dc2_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')]

Expand All @@ -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 {<homogenized name>: <native name>, ...}
"""

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',
Expand All @@ -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 = (
Expand Down