Skip to content

Commit

Permalink
Merge branch 'tickets/DM-30497'
Browse files Browse the repository at this point in the history
  • Loading branch information
mrawls committed Jun 9, 2021
2 parents ba660ad + c85d079 commit 65ce80c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
16 changes: 8 additions & 8 deletions data/DiaSource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ funcs:
functor: Ratio
args:
- slot_ApFlux_instFlux
- slot_ApFlux_instFluxErr
- slot_ApFlux_instFluxErr
psFlux:
functor: LocalNanojansky
args:
Expand Down Expand Up @@ -176,48 +176,48 @@ funcs:

# These values below work but need a new functor for converting pixel^2
# units to arcsec^2 DM-
Ixx:
ixx:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_Shape_xx
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_2_2
Iyy:
iyy:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_Shape_yy
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_2_2
Ixy:
ixy:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_Shape_xy
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_2_2
# Icov not implemented
IxxPsf:
# icov not implemented
ixxPSF:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_PsfShape_xx
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_2_2
IyyPsf:
iyyPSF:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_PsfShape_xy
- base_LocalWcs_CDMatrix_1_1
- base_LocalWcs_CDMatrix_1_2
- base_LocalWcs_CDMatrix_2_1
- base_LocalWcs_CDMatrix_2_2
IxyPsf:
ixyPSF:
functor: ConvertPixelSqToArcsecondsSq
args:
- slot_PsfShape_xy
Expand Down
24 changes: 24 additions & 0 deletions tests/test_loadDiaCatalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import pandas as pd
import tempfile
import unittest
import yaml

from lsst.afw.cameraGeom.testUtils import DetectorWrapper
import lsst.afw.geom as afwGeom
Expand Down Expand Up @@ -295,6 +296,10 @@ def setUp(self):
self.apdb.storeDiaObjects(self.diaObjects,
self.dateTime)

# These columns are not in the DPDD, yet do appear in DiaSource.yaml.
# We don't need to check them against the default APDB schema.
self.ignoreColumns = ["filterName", "bboxSize", "isDipole"]

def tearDown(self):
os.close(self.db_file_fd)
os.remove(self.db_file)
Expand Down Expand Up @@ -390,6 +395,25 @@ def testGetPixelRanges(self):
self.assertEqual(normPix, testPix)
self.assertEqual(flipPix, testPix)

def test_apdbSchema(self):
"""Test that the default DiaSource schema from dax_apdb agrees with the
column names defined here in ap_association/data/DiaSource.yaml.
"""
functorFile = _data_file_name("DiaSource.yaml", "ap_association")
apdbSchemaFile = _data_file_name("apdb-schema.yaml", "dax_apdb")
with open(apdbSchemaFile) as yaml_stream:
table_list = list(yaml.safe_load_all(yaml_stream))
for table in table_list:
if table['table'] == 'DiaSource':
apdbSchemaColumns = [column['name'] for column in table['columns']]
break
with open(functorFile) as yaml_stream:
diaSourceFunctor = yaml.safe_load_all(yaml_stream)
for functor in diaSourceFunctor:
diaSourceColumns = [column for column in list(functor['funcs'].keys())
if column not in self.ignoreColumns]
self.assertLess(set(diaSourceColumns), set(apdbSchemaColumns))


class MemoryTester(lsst.utils.tests.MemoryTestCase):
pass
Expand Down

0 comments on commit 65ce80c

Please sign in to comment.