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

DM-21098: Isolate outdated Gen 3 methods in gen2tasks #134

Merged
merged 3 commits into from
Oct 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 0 additions & 40 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import unittest

import astropy.units as u
from astropy.tests.helper import assert_quantity_allclose

from lsst.afw.table import SourceCatalog
import lsst.utils.tests
Expand Down Expand Up @@ -69,23 +68,6 @@ def testMissingData(self):
meas = result.measurement
self.assertIsNone(meas)

def testGetInputDatasetTypes(self):
config = self.taskClass.ConfigClass()
types = self.taskClass.getInputDatasetTypes(config)
# dict.keys() is a collections.abc.Set, which has a narrower interface than __builtins__.set...
self.assertSetEqual(set(types.keys()), {"sources"})
self.assertEqual(types["sources"], "src")

def testFineGrainedMetric(self):
catalog = _makeDummyCatalog(3)
inputData = {"sources": catalog}
inputDataIds = {"sources": {"visit": 42, "ccd": 1}}
outputDataId = {"measurement": {"visit": 42, "ccd": 1}}
measDirect = self.task.run(catalog).measurement
measIndirect = self.task.adaptArgsAndRun(inputData, inputDataIds, outputDataId).measurement

assert_quantity_allclose(measIndirect.quantity, measDirect.quantity)


class TestFractionDiaSources(MetricTaskTestCase):

Expand Down Expand Up @@ -133,28 +115,6 @@ def testSemiMissingData(self):
meas = result.measurement
self.assertIsNone(meas)

def testGetInputDatasetTypes(self):
config = self.taskClass.ConfigClass()
types = self.taskClass.getInputDatasetTypes(config)
# dict.keys() is a collections.abc.Set, which has a narrower interface than __builtins__.set...
self.assertSetEqual(set(types.keys()), {"sciSources", "diaSources"})
self.assertEqual(types["sciSources"], "src")
self.assertEqual(types["diaSources"], "deepDiff_diaSrc")

# TODO: add a test for the templating in FractionDiaSourcesToSciSourcesMetricConfig
# once we've migrated to PipelineTaskConfig

def testFineGrainedMetric(self):
sciCatalog = _makeDummyCatalog(5)
diaCatalog = _makeDummyCatalog(1)
inputData = {"sciSources": sciCatalog, "diaSources": diaCatalog}
inputDataIds = {"sciSources": {"visit": 42, "ccd": 1}, "diaSources": {"visit": 42, "ccd": 1}}
outputDataId = {"measurement": {"visit": 42, "ccd": 1}}
measDirect = self.task.run(sciCatalog, diaCatalog).measurement
measIndirect = self.task.adaptArgsAndRun(inputData, inputDataIds, outputDataId).measurement

assert_quantity_allclose(measIndirect.quantity, measDirect.quantity)


# Hack around unittest's hacky test setup system
del MetricTaskTestCase
Expand Down