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-13757: enable jointcal config writing #131

Merged
merged 3 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 3 additions & 5 deletions python/lsst/jointcal/jointcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,9 @@ def __init__(self, butler=None, profile_jointcal=False, **kwargs):
# To hold various computed metrics for use by tests
self.job = Job.load_metrics_package(subset='jointcal')

# We don't need to persist config and metadata at this stage.
# In this way, we don't need to put a specific entry in the camera mapper policy file
def _getConfigName(self):
return None

erykoff marked this conversation as resolved.
Show resolved Hide resolved
# We don't currently need to persist the metadata.
# If we do in the future, we will have to add appropriate dataset templates
# to each obs package (the metadata template should look like `jointcal_wcs`).
def _getMetadataName(self):
return None

Expand Down
18 changes: 18 additions & 0 deletions tests/test_jointcal_cfht_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ def setup_module(module):


class JointcalTestCFHTMinimal(jointcalTestBase.JointcalTestBase, lsst.utils.tests.TestCase):
"""
Test with a stripped down CFHT dataset containing 3 stars, so by-hand
calculation of metrics is possible.

See `notebooks/cfht_minimal_direct_calculation.ipynb` for numpy-based
computations of chi2, etc. using this dataset.
"""
@classmethod
def setUpClass(cls):
cls.data_dir = os.path.join(lsst.utils.getPackageDir('jointcal'), 'tests/data')
Expand Down Expand Up @@ -79,6 +86,8 @@ def test_jointcalTask_2_visits_photometry(self):

# The output repo is named after this method.
caller = inspect.stack()[0].function
# we use _runJointcalTask instead of _test here because we aren't doing
# full calulation of PA1: the above chi2 is exact.
self._runJointcalTask(2, caller, metrics=metrics)

# Check that the Hessian/gradient files were written.
Expand All @@ -91,6 +100,15 @@ def test_jointcalTask_2_visits_photometry(self):
self.assertTrue(os.path.exists("photometry_postinit-grad.txt"))
os.remove("photometry_postinit-grad.txt")

# Check that the config was persisted, we can read it, and it matches the settings above
output_dir = os.path.join('.test', self.__class__.__name__, caller)
self.assertTrue(os.path.exists(os.path.join(output_dir, 'config/jointcal.py')))
butler = lsst.daf.persistence.Butler(output_dir)
config = butler.get('jointcal_config')
self.assertEqual(config.photometryModel, self.config.photometryModel)
self.assertEqual(config.doAstrometry, self.config.doAstrometry)
self.assertEqual(config.writeInitMatrix, self.config.writeInitMatrix)

def test_jointcalTask_2_visits_photometry_magnitude(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryModel = "simpleMagnitude"
Expand Down