Exemplo n.º 1
0
    def testRegisterMetricsExampleChained(self):
        """Regression test for registerMetricsExample having no effect
        on ChainedDatastore.
        """
        temp = makeTestTempDir(TESTDIR)
        try:
            config = lsst.daf.butler.Config()
            config[
                "datastore",
                "cls"] = "lsst.daf.butler.datastores.chainedDatastore.ChainedDatastore"
            config["datastore", "datastores"] = [{
                "cls":
                "lsst.daf.butler.datastores.fileDatastore.FileDatastore",
            }]

            repo = lsst.daf.butler.Butler.makeRepo(temp, config=config)
            butler = lsst.daf.butler.Butler(repo, run="chainedExample")
            registerMetricsExample(butler)
            addDatasetType(butler, "DummyType", {},
                           "StructuredDataNoComponents")

            data = MetricsExample(summary={})
            # Should not raise
            butler.put(data, "DummyType")
        finally:
            shutil.rmtree(temp, ignore_errors=True)
Exemplo n.º 2
0
    def setUpClass(cls):
        super().setUpClass()
        # Repository should be re-created for each test case, but
        # this has a prohibitive run-time cost at present
        cls.root = tempfile.mkdtemp()

        cls.repo = butlerTests.makeTestRepo(cls.root)
        butlerTests.addDataIdValue(cls.repo, "instrument", "notACam")
        butlerTests.addDataIdValue(cls.repo, "visit", 101)
        butlerTests.addDataIdValue(cls.repo, "visit", 102)
        butlerTests.addDataIdValue(cls.repo, "skymap", "sky")
        butlerTests.addDataIdValue(cls.repo, "tract", 42)
        butlerTests.addDataIdValue(cls.repo, "patch", 0)
        butlerTests.addDataIdValue(cls.repo, "patch", 1)
        butlerTests.registerMetricsExample(cls.repo)

        for typeName in {"VisitA", "VisitB", "VisitOutA", "VisitOutB"}:
            butlerTests.addDatasetType(cls.repo, typeName,
                                       {"instrument", "visit"},
                                       "StructuredData")
        for typeName in {"PatchA", "PatchOut"}:
            butlerTests.addDatasetType(cls.repo, typeName,
                                       {"skymap", "tract", "patch"},
                                       "StructuredData")
        butlerTests.addDatasetType(cls.repo, "PatchB", {"skymap", "tract"},
                                   "StructuredData")
        for typeName in {"PixA", "PixOut"}:
            butlerTests.addDatasetType(cls.repo, typeName, {"htm7"},
                                       "StructuredData")
        butlerTests.addDatasetType(cls.repo, "VisitInitIn", set(),
                                   "StructuredData")
Exemplo n.º 3
0
    def setUpClass(cls):
        # Repository should be re-created for each test case, but
        # this has a prohibitive run-time cost at present
        cls.root = tempfile.mkdtemp(dir=TESTDIR)

        dataIds = {
            "instrument": ["notACam", "dummyCam"],
            "physical_filter": ["k2020", "l2019"],
            "visit": [101, 102],
            "detector": [5]
        }
        cls.creatorButler = makeTestRepo(cls.root, dataIds)

        registerMetricsExample(cls.creatorButler)
        addDatasetType(cls.creatorButler, "DataType1", {"instrument"},
                       "StructuredDataNoComponents")
        addDatasetType(cls.creatorButler, "DataType2", {"instrument", "visit"},
                       "StructuredData")
Exemplo n.º 4
0
    def setUpClass(cls):
        # Repository should be re-created for each test case, but
        # this has a prohibitive run-time cost at present
        cls.root = makeTestTempDir(TESTDIR)

        cls.creatorButler = makeTestRepo(cls.root)
        addDataIdValue(cls.creatorButler, "instrument", "notACam")
        addDataIdValue(cls.creatorButler, "instrument", "dummyCam")
        addDataIdValue(cls.creatorButler, "physical_filter", "k2020", band="k", instrument="notACam")
        addDataIdValue(cls.creatorButler, "physical_filter", "l2019", instrument="dummyCam")
        addDataIdValue(cls.creatorButler, "visit", 101, instrument="notACam", physical_filter="k2020")
        addDataIdValue(cls.creatorButler, "visit", 102, instrument="notACam", physical_filter="k2020")
        addDataIdValue(cls.creatorButler, "detector", 5)
        # Leave skymap/patch/tract undefined so that tests can assume
        # they're missing.

        registerMetricsExample(cls.creatorButler)
        addDatasetType(cls.creatorButler, "DataType1", {"instrument"}, "StructuredDataNoComponents")
        addDatasetType(cls.creatorButler, "DataType2", {"instrument", "visit"}, "StructuredData")
Exemplo n.º 5
0
    def setUpClass(cls):
        super().setUpClass()
        # Repository should be re-created for each test case, but
        # this has a prohibitive run-time cost at present
        cls.root = tempfile.mkdtemp()

        dataIds = {
            "instrument": ["notACam"],
            "physical_filter": ["k2020"],  # needed for expandUniqueId(visit)
            "visit": [101, 102],
            "skymap": ["sky"],
            "tract": [42],
            "patch": [0, 1],
        }
        cls.repo = butlerTests.makeTestRepo(cls.root, dataIds)
        butlerTests.registerMetricsExample(cls.repo)

        for typeName in {"VisitA", "VisitB", "VisitOutA", "VisitOutB"}:
            butlerTests.addDatasetType(cls.repo, typeName, {"instrument", "visit"}, "StructuredData")
        for typeName in {"PatchA", "PatchOut"}:
            butlerTests.addDatasetType(cls.repo, typeName, {"skymap", "tract", "patch"}, "StructuredData")
        butlerTests.addDatasetType(cls.repo, "PatchB", {"skymap", "tract"}, "StructuredData")
        for typeName in {"PixA", "PixOut"}:
            butlerTests.addDatasetType(cls.repo, typeName, {"htm7"}, "StructuredData")