Пример #1
0
    def _ingestImages(cls):

        # Generate the camera mapper
        camDataCollector = CamDataCollector(cls.dataDir.name)
        camDataCollector.genPhoSimMapper()

        # Ingest the E image
        imgFilesEimg = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "repackagedFiles",
            "lsst_e_9006001_f1_R22_S00_E000.fits.gz",
        )
        camDataCollector.ingestEimages(imgFilesEimg)

        # Ingest the amplifier image
        imgFilesRaw = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "repackagedFiles",
            "lsst_a_20_f5_R00_S22_E000.fits",
        )
        camDataCollector.ingestImages(imgFilesRaw)
    def step1_ingestEimg(self):

        # Generate the PhoSim mapper
        self.wepCntlr.getDataCollector().genPhoSimMapper()

        intraImgFiles = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "phosimOutput",
            "realComCam",
            "repackagedFiles",
            "intra",
            "lsst_e*.fits*",
        )
        extraImgFiles = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "phosimOutput",
            "realComCam",
            "repackagedFiles",
            "extra",
            "lsst_e*.fits*",
        )

        self.wepCntlr.getDataCollector().ingestEimages(intraImgFiles)
        self.wepCntlr.getDataCollector().ingestEimages(extraImgFiles)
Пример #3
0
    def step2_ingestExp(self):

        intraImgFiles = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "phosimOutput",
            "realComCam",
            "repackagedFiles",
            "intra",
            "lsst_a*.fits",
        )
        extraImgFiles = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "phosimOutput",
            "realComCam",
            "repackagedFiles",
            "extra",
            "lsst_a*.fits",
        )

        self.wepCntlr.getDataCollector().ingestImages(intraImgFiles)
        self.wepCntlr.getDataCollector().ingestImages(extraImgFiles)
Пример #4
0
    def testDoIsr(self):

        # Generate the camera mapper
        camDataCollector = CamDataCollector(self.isrDir)
        camDataCollector.genPhoSimMapper()

        # Generate the fake flat images
        fakeFlatDir = os.path.join(self.dataDir, "fake_flats")
        self._makeDir(fakeFlatDir)

        detector = "R00_S22"
        self._genFakeFlat(fakeFlatDir, detector)

        # Ingest the calibration images
        calibFiles = os.path.join(fakeFlatDir, "*")
        camDataCollector.ingestCalibs(calibFiles)

        # Ingest the raw images
        imgFiles = os.path.join(getModulePath(), "tests", "testData",
                                "repackagedFiles",
                                "lsst_a_20_f5_R00_S22_E000.fits")
        camDataCollector.ingestImages(imgFiles)

        # Do the ISR configuration
        self._doIsrConfig()

        # Do the ISR
        rerunName = "run1"
        self.camIsrWrapper.doISR(self.isrDir, rerunName=rerunName)

        # Check the condition
        postIsrCcdDir = os.path.join(self.isrDir, "rerun", rerunName,
                                     "postISRCCD")
        self.assertTrue(os.path.exists(postIsrCcdDir))
Пример #5
0
    def setUp(self):

        self.dataDir = os.path.join(getModulePath(), "tests", "tmpIsr")
        self.isrDir = os.path.join(self.dataDir, "input")
        self._makeDir(self.isrDir)

        self.camIsrWrapper = CamIsrWrapper(self.isrDir)
Пример #6
0
    def setUp(self):

        self.dataDir = os.path.join(getModulePath(), "tests", "tmp")
        self.isrDir = os.path.join(self.dataDir, "input")
        self._makeDir(self.isrDir)

        self.camDataCollector = CamDataCollector(self.isrDir)
Пример #7
0
    def _configSourceSelector(self, camType, bscDbType, settingFileName):
        """Configue the source selector.

        Parameters
        ----------
        camType : enum 'CamType'
            Camera type.
        bscDbType : enum 'BscDbType'
            Bright star catalog (BSC) database type.
        settingFileName : str
            Setting file name.

        Returns
        -------
        SourceSelector
            Configured source selector.

        Raises
        ------
        ValueError
            WEPCalculation does not support this bscDbType yet.
        """

        sourSelc = SourceSelector(camType, bscDbType,
                                  settingFileName=settingFileName)
        sourSelc.setFilter(FilterType.REF)

        if (bscDbType == BscDbType.LocalDbForStarFile):
            dbAdress = os.path.join(getModulePath(), "tests", "testData",
                                    "bsc.db3")
            sourSelc.connect(dbAdress)
        else:
            raise ValueError("WEPCalculation does not support %s yet." % bscDbType)

        return sourSelc
Пример #8
0
    def setUp(self):

        modulePath = getModulePath()
        testDataPath = os.path.join(
            modulePath, "tests", "testData", "testDonutTemplates"
        )
        # Specify location of test Phosim donut templates in testData
        extraTemplateName = "extra_template-R22_S11.txt"
        self.templateExtra = np.genfromtxt(
            os.path.join(testDataPath, extraTemplateName)
        )
        intraTemplateName = "intra_template-R22_S11.txt"
        self.templateIntra = np.genfromtxt(
            os.path.join(testDataPath, intraTemplateName)
        )
        self.templateMaker = DonutTemplatePhosim()

        # Specify template location for test
        self.defaultTemplatePath = os.path.join(
            modulePath, "policy", "cwfs", "donutTemplateData", "phosimTemplates"
        )

        # Copy test templates to phosim template folder. R99 is a fake
        # raft so it will not overwrite existing templates in the folder.
        shutil.copyfile(
            os.path.join(testDataPath, extraTemplateName),
            os.path.join(self.defaultTemplatePath, "extra_template-R99_S99.txt"),
        )
        shutil.copyfile(
            os.path.join(testDataPath, intraTemplateName),
            os.path.join(self.defaultTemplatePath, "intra_template-R99_S99.txt"),
        )
Пример #9
0
    def testGetAbsPath(self):

        filePath = "README.md"
        self.assertFalse(os.path.isabs(filePath))

        filePathAbs = ParamReader.getAbsPath(filePath, getModulePath())
        self.assertTrue(os.path.isabs(filePathAbs))
Пример #10
0
    def testGetAmpImagesFromDir(self):

        # path to repackaged phosim files
        # with amplifier images and e-images
        defocalImgDir = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "phosimOutput",
            "realComCam",
            "repackagedFiles",
            "extra",
        )
        # test that there are e-images in that dir
        filesInDir = os.listdir(defocalImgDir)
        self.assertTrue("MC_H_20211231_006001_R22_S11_e.fits.gz" in filesInDir)
        self.assertTrue("MC_H_20211231_006001_R22_S10_e.fits.gz" in filesInDir)

        # get names of amp files
        ampFiles = getAmpImagesFromDir(defocalImgDir)

        # assert the returned content
        self.assertIsInstance(ampFiles, list)

        # assert that amp images are on the returned list
        self.assertTrue("MC_H_20211231_006001_R22_S10.fits" in ampFiles)
        self.assertTrue("MC_H_20211231_006001_R22_S11.fits" in ampFiles)

        # assert that no other files are there
        # by checking that the length of list corresponds to
        # two files tested above
        self.assertEqual(len(ampFiles), 2)
Пример #11
0
    def setUp(self):

        # Set the database address
        modulePath = getModulePath()
        dbAdress = os.path.join(modulePath, "tests", "testData", "bsc.db3")

        # Set up local database
        self.localDatabase = LocalDatabase()
        self.localDatabase.connect(dbAdress)

        # Set the filter
        self.filterType = FilterType.G

        # Set up neighboring star map
        stars = StarData(
            [123, 456, 789],
            [0.1, 0.2, 0.3],
            [2.1, 2.2, 2.3],
            [2.0, 3.0, 4.0],
            [2.0, 3.0, 4.0],
            [2.0, 3.0, 4.0],
            [2.0, 3.0, 4.0],
            [2.0, 3.0, 4.0],
            [2.0, 3.0, 4.0],
        )
        stars.setRaInPixel(stars.getRA() * 10)
        stars.setDeclInPixel(stars.getDecl() * 10)
        self.neighboringStar = stars.getNeighboringStar([0], 3,
                                                        self.filterType, 99)
    def setUp(self):

        self.modulePath = getModulePath()

        testDir = os.path.join(self.modulePath, "tests")
        self.dataDir = tempfile.TemporaryDirectory(dir=testDir)
        self.butlerInput = tempfile.TemporaryDirectory(dir=self.dataDir.name)
        self.opdDir = os.path.join(
            self.modulePath, "tests", "testData", "opdOutput", "9005000"
        )

        # Configurate the WEP components
        dataCollector = CamDataCollector(self.butlerInput.name)
        sourSelc = self._configSourceSelector()
        sourProc = SourceProcessor()
        wfEsti = self._configWfEstimator()

        # Instantiate the WEP controller
        self.wepCntlr = WepController(dataCollector, None, sourSelc, sourProc, wfEsti)

        # Intemediate data used in the test
        self.filter = FilterType.REF

        self.neighborStarMap = dict()
        self.starMap = dict()
        self.wavefrontSensors = dict()

        self.wfsImgMap = dict()
        self.donutMap = dict()
        self.masterDonutMap = dict()
Пример #13
0
    def setUp(self):

        self.modulePath = getModulePath()

        # Query the database to get the star maps
        self.sourSelc = SourceSelector(CamType.ComCam, BscDbType.LocalDb)
        self.sourSelc.setObsMetaData(0.0, 63, 0.0)
        self.sourSelc.configNbrCriteria(63.0, 2.5, maxNeighboringStar=99)
        self.sourSelc.setFilter(FilterType.U)

        dbAdress = os.path.join(self.modulePath, "tests", "testData",
                                "bsc.db3")
        self.sourSelc.connect(dbAdress)
        neighborStarMap, starMap, wavefrontSensors = self.sourSelc.getTargetStar(
            offset=0)
        self.sourSelc.disconnect()

        # Collect the data for the test of plot functions
        self.wavefrontSensors = wavefrontSensors
        self.starMap = starMap
        self.neighborStarMap = neighborStarMap

        # Save image files directory
        self.dataDir = os.path.join(self.modulePath, "tests", "tmp")
        self._makeDir(self.dataDir)
Пример #14
0
    def testDoIsr(self):

        # Generate the camera mapper
        camDataCollector = CamDataCollector(self.isrDir)
        camDataCollector.genPhoSimMapper()

        # Generate the fake flat images
        fakeFlatDir = os.path.join(self.dataDir, "fake_flats")
        self._makeDir(fakeFlatDir)

        detector = "R00_S22"
        self._genFakeFlat(fakeFlatDir, detector)

        # Ingest the calibration images
        calibFiles = os.path.join(fakeFlatDir, "*")
        camDataCollector.ingestCalibs(calibFiles)

        # Ingest the raw images
        imgFiles = os.path.join(getModulePath(), "tests", "testData",
                                "repackagedFiles",
                                "lsst_a_20_f5_R00_S22_E000.fits")
        camDataCollector.ingestImages(imgFiles)

        # Do the ISR configuration
        self._doIsrConfig()

        # Do the ISR
        rerunName = "run1"
        self.camIsrWrapper.doISR(self.isrDir, rerunName=rerunName)

        # Check the condition
        postIsrCcdDir = os.path.join(self.isrDir, "rerun", rerunName,
                                     "postISRCCD")
        self.assertTrue(os.path.exists(postIsrCcdDir))
    def setUp(self):

        self.modulePath = getModulePath()
        self.dataDir = os.path.join(self.modulePath, "tests", "tmp")
        self.isrDir = os.path.join(self.dataDir, "input")
        self.opdDir = os.path.join(self.modulePath, "tests", "testData",
                                   "opdOutput", "9005000")

        self._makeDir(self.isrDir)

        # Configurate the WEP components
        dataCollector = CamDataCollector(self.isrDir)
        isrWrapper = CamIsrWrapper(self.isrDir)
        sourSelc = self._configSourceSelector()
        sourProc = self._configSourceProcessor()
        wfsEsti = self._configWfEstimator()

        # Instantiate the WEP controller
        self.wepCntlr = WepController(dataCollector, isrWrapper, sourSelc,
                                      sourProc, wfsEsti)

        # Intemediate data used in the test
        self.filter = FilterType.REF

        self.neighborStarMap = dict()
        self.starMap = dict()
        self.wavefrontSensors = dict()

        self.wfsImgMap = dict()
        self.donutMap = dict()
        self.masterDonutMap = dict()
Пример #16
0
    def setUpClass(cls):

        dataDirPath = os.path.join(getModulePath(), "tests")
        cls.dataDir = tempfile.TemporaryDirectory(dir=dataDirPath)
        cls._ingestImages()

        cls.butlerWrapper = ButlerWrapper(cls.dataDir.name)
Пример #17
0
    def setUp(self):

        self.dataDir = os.path.join(getModulePath(), "tests", "tmpIsr")
        self.isrDir = os.path.join(self.dataDir, "input")
        self._makeDir(self.isrDir)

        self.camIsrWrapper = CamIsrWrapper(self.isrDir)
Пример #18
0
    def setUp(self):

        testImageDataDir = os.path.join(
            getModulePath(), "tests", "testData", "testImages"
        )
        self.testImgDir = os.path.join(testImageDataDir, "lsstfam")
        self.validationDir = os.path.join(testImageDataDir, "validation", "lsstfam")
Пример #19
0
    def setUp(self):

        self.dataDir = os.path.join(getModulePath(), "tests", "tmp")
        self.isrDir = os.path.join(self.dataDir, "input")
        self._makeDir(self.isrDir)

        self.camDataCollector = CamDataCollector(self.isrDir)
Пример #20
0
    def setUp(self):

        boresightRa = 0.0
        boresightDec = 0.0
        boresightRotAng = 0.0
        self.refCatInterface = RefCatalogInterface(boresightRa, boresightDec,
                                                   boresightRotAng)

        moduleDir = getModulePath()
        self.testDataDir = os.path.join(moduleDir, "tests", "testData")
        self.repoDir = os.path.join(self.testDataDir, "gen3TestRepo")
        self.butler = dafButler.Butler(self.repoDir)
        self.registry = self.butler.registry

        shardIds = self.refCatInterface.getHtmIds()
        self.catalogName = "cal_ref_cat"
        self.collections = ["refcats/gen2"]
        dataRefs, dataIds = self.refCatInterface.getDataRefs(
            shardIds, self.butler, self.catalogName, self.collections)
        self.dataRefs = dataRefs
        self.dataIds = dataIds

        self.config = GenerateDonutCatalogOnlineTaskConfig()

        self.camera = self.butler.get("camera",
                                      instrument="LSSTCam",
                                      collections=["LSSTCam/calib/unbounded"])
Пример #21
0
    def setUpClass(cls):
        """
        Generate donutCatalog needed for task.
        """

        moduleDir = getModulePath()
        cls.testDataDir = os.path.join(moduleDir, "tests", "testData")
        testPipelineConfigDir = os.path.join(cls.testDataDir,
                                             "pipelineConfigs")
        cls.repoDir = os.path.join(cls.testDataDir, "gen3TestRepo")
        cls.runName = "run1"

        # Check that run doesn't already exist due to previous improper cleanup
        butler = dafButler.Butler(cls.repoDir)
        registry = butler.registry
        collectionsList = list(registry.queryCollections())
        if cls.runName in collectionsList:
            cleanUpCmd = writeCleanUpRepoCmd(cls.repoDir, cls.runName)
            runProgram(cleanUpCmd)

        collections = "refcats/gen2,LSSTCam/calib,LSSTCam/raw/all"
        instrument = "lsst.obs.lsst.LsstCam"
        cls.cameraName = "LSSTCam"
        pipelineYaml = os.path.join(testPipelineConfigDir,
                                    "testBasePipeline.yaml")

        pipeCmd = writePipetaskCmd(cls.repoDir,
                                   cls.runName,
                                   instrument,
                                   collections,
                                   pipelineYaml=pipelineYaml)
        runProgram(pipeCmd)
Пример #22
0
    def setUp(self):

        self.testDataDir = os.path.join(getModulePath(), "tests", "testData")
        self.imgFile = os.path.join(self.testDataDir, "testImages",
                                    "LSST_NE_SN25", "z11_0.25_intra.txt")

        self.img = Image()
        self.img.setImg(imageFile=self.imgFile)
Пример #23
0
    def setUp(self):

        testDir = os.path.join(getModulePath(), "tests")
        self.dataDir = tempfile.TemporaryDirectory(dir=testDir)

        self.isrDir = tempfile.TemporaryDirectory(dir=self.dataDir.name)

        self.camDataCollector = CamDataCollector(self.isrDir.name)
Пример #24
0
    def setUp(self):

        self.testDataDir = os.path.join(getModulePath(), "tests", "testData")
        self.imgFile = os.path.join(self.testDataDir, "testImages",
                                    "LSST_NE_SN25", "z11_0.25_intra.txt")

        self.img = Image()
        self.img.setImg(imageFile=self.imgFile)
Пример #25
0
    def setUp(self):

        testDir = os.path.join(getModulePath(), "tests")
        self.dataDir = tempfile.TemporaryDirectory(dir=testDir)
        self.isrDir = tempfile.TemporaryDirectory(dir=self.dataDir.name)

        self.repackagedTestData = os.path.join(testDir, "testData", "repackagedFiles")

        self.camIsrWrapper = CamIsrWrapper(self.isrDir.name)
Пример #26
0
    def setUp(self):

        self.filterType = FilterType.G
        self.db = LocalDatabaseForStarFile()

        self.modulePath = getModulePath()
        dbAdress = os.path.join(self.modulePath, "tests", "testData",
                                "bsc.db3")
        self.db.connect(dbAdress)
Пример #27
0
    def setUp(self):

        self.modulePath = getModulePath()
        self.testDataDir = os.path.join(self.modulePath, "tests", "testData")
        self.dataDir = os.path.join(self.modulePath, "tests", "tmp")
        self.isrDir = os.path.join(self.dataDir, "input")
        self._makeDir(self.isrDir)

        self.wepCalculation = WEPCalculation(AstWcsSol(), CamType.ComCam,
                                             self.isrDir)
Пример #28
0
    def setUp(self):

        # Get the path of module
        self.modulePath = getModulePath()

        # Set the source processor
        self.sourProc = SourceProcessor()

        # Set the configuration
        self.sourProc.config(sensorName="R00_S22_C0")
Пример #29
0
    def setUp(self):

        testDir = os.path.join(getModulePath(), "tests")
        self.configDir = os.path.join(testDir, "testData")
        self.fileName = "testConfigFile.yaml"

        filePath = os.path.join(self.configDir, self.fileName)
        self.paramReader = ParamReader(filePath=filePath)

        self.testTempDir = tempfile.TemporaryDirectory(dir=testDir)
Пример #30
0
    def setUp(self):

        # Get the path of module
        self.modulePath = getModulePath()

        # Set the source processor
        self.sourProc = SourceProcessor()

        # Set the configuration
        self.sourProc.config(sensorName="R00_S22_C0")
Пример #31
0
    def setUp(self):

        self.config = DonutSourceSelectorTaskConfig()
        self.task = DonutSourceSelectorTask()

        moduleDir = getModulePath()
        self.testDataDir = os.path.join(moduleDir, "tests", "testData")
        self.repoDir = os.path.join(self.testDataDir, "gen3TestRepo")

        self.butler = dafButler.Butler(self.repoDir)
        self.registry = self.butler.registry
Пример #32
0
    def _getTemplate(self):

        imageFilePath = os.path.join(
            getModulePath(),
            "tests",
            "testData",
            "testImages",
            "LSST_NE_SN25",
            "z11_0.25_intra.txt",
        )
        return np.loadtxt(imageFilePath)
Пример #33
0
    def setUp(self):

        testImageDataDir = os.path.join(getModulePath(), "tests", "testData",
                                        "testImages")
        self.testImgDir = os.path.join(testImageDataDir, "auxTel")
        self.validationDir = os.path.join(testImageDataDir, "validation",
                                          "auxTel")

        self.offset = 80
        self.tolMax = 6
        self.tolRms = 2
Пример #34
0
    def setUp(self):

        # Get the path of module
        modulePath = getModulePath()

        # Define the instrument folder
        self.instruFolder = os.path.join(modulePath, "configData", "cwfs",
                                         "instruData")

        # Define the instrument name
        self.instruName = "lsst"
Пример #35
0
    def setUp(self):

        testDir = os.path.join(getModulePath(), "tests")
        self.configDir = os.path.join(testDir, "testData")
        self.fileName = "testConfigFile.yaml"

        filePath = os.path.join(self.configDir, self.fileName)
        self.paramReader = ParamReader(filePath=filePath)

        self.testTempDir = os.path.join(testDir, "tmp")
        self._makeDir(self.testTempDir)
    def testInsertDataByFile(self):

        self._createTable()
        idAll = self.db.getAllId(self.filterType)
        self.assertEqual(len(idAll), 0)

        skyFilePath = os.path.join(getModulePath(), "tests", "testData",
                                   "skyComCamInfo.txt")
        idAll = self._insertDataToDbAndGetAllId(skyFilePath)

        self.assertEqual(len(idAll), 4)
Пример #37
0
    def _getConfigDataPath(self):
        """Get the configuration data path.

        Returns
        -------
        str
            Configuration data path
        """

        configDataPath = os.path.join(getModulePath(), "configData")

        return configDataPath
Пример #38
0
    def createBscTest(self):
        """Create the bright star catalog (BSC) used in the test."""

        # Create a temporary test directory
        testDir = os.path.join(getModulePath(), "tests")
        self._tempDir = tempfile.TemporaryDirectory(dir=testDir)

        # Copy the db3 database
        dbAdressSrc = os.path.join(testDir, "testData", "bsc.db3")
        self._dbAdress = os.path.join(self._tempDir.name, "bsc.db3")

        shutil.copy(dbAdressSrc, self._dbAdress)
    def setUp(self):

        self.modulePath = getModulePath()

        self.dataDir = os.path.join(self.modulePath, "tests", "tmp")
        self._makeDir(self.dataDir)

        self.filterType = FilterType.G
        self.db = LocalDatabaseForStarFile()

        dbAdress = os.path.join(self.modulePath, "tests", "testData",
                                "bsc.db3")
        self.db.connect(dbAdress)
Пример #40
0
    def setUp(self):

        # Get the path of module
        self.modulePath = getModulePath()

        # Define the image folder and image names
        # Image data -- Don't know the final image format.
        # It is noted that image.readFile inuts is based on the txt file
        imageFolderPath = os.path.join(self.modulePath, "tests", "testData",
                                       "testImages", "LSST_NE_SN25")
        intra_image_name = "z11_0.25_intra.txt"
        extra_image_name = "z11_0.25_extra.txt"

        # Define fieldXY: [1.185, 1.185] or [0, 0]
        # This is the position of donut on the focal plane in degree
        fieldXY = [1.185, 1.185]

        # Define the optical model: "paraxial", "onAxis", "offAxis"
        self.opticalModel = "offAxis"

        # Image files Path
        intra_image_file = os.path.join(imageFolderPath, intra_image_name)
        extra_image_file = os.path.join(imageFolderPath, extra_image_name)

        # Theree is the difference between intra and extra images
        # I1: intra_focal images, I2: extra_focal Images
        self.I1 = CompensableImage()
        self.I2 = CompensableImage()

        self.I1.setImg(fieldXY, DefocalType.Intra, imageFile=intra_image_file)
        self.I2.setImg(fieldXY, DefocalType.Extra, imageFile=extra_image_file)

        # Set up the instrument
        cwfsConfigDir = os.path.join(getConfigDir(), "cwfs")

        instDir = os.path.join(cwfsConfigDir, "instData")
        self.inst = Instrument(instDir)

        self.inst.config(CamType.LsstCam, self.I1.getImgSizeInPix(),
                         announcedDefocalDisInMm=1.0)

        # Set up the algorithm
        algoDir = os.path.join(cwfsConfigDir, "algo")

        self.algoExp = Algorithm(algoDir)
        self.algoExp.config("exp", self.inst)

        self.algoFft = Algorithm(algoDir)
        self.algoFft.config("fft", self.inst)
Пример #41
0
    def testIngestImages(self):

        self._genMapper()

        imgFiles = os.path.join(getModulePath(), "tests", "testData",
                                "repackagedFiles",
                                "lsst_a_20_f5_R00_S22_E000.fits")
        self.camDataCollector.ingestImages(imgFiles)

        # Check the ingested calibration products
        registryFilePath = os.path.join(self.isrDir, "registry.sqlite3")
        self.assertTrue(os.path.exists(registryFilePath))

        rawDir = os.path.join(self.isrDir, "raw")
        self.assertTrue(os.path.exists(rawDir))
Пример #42
0
    def setUp(self):

        # Set the path of module and the setting directories
        modulePath = getModulePath()

        cwfsConfigDir = os.path.join(getConfigDir(), "cwfs")
        self.instFolder = os.path.join(cwfsConfigDir, "instData")
        self.algoFolderPath = os.path.join(cwfsConfigDir, "algo")
        self.imageFolderPath = os.path.join(modulePath, "tests", "testData",
                                            "testImages")

        # Set the tolerance
        self.tor = 3

        # Restart time
        self.startTime = time.time()
        self.difference = 0
        self.validationDir = os.path.join(modulePath, "tests", "testData",
                                          "testImages", "validation")
Пример #43
0
    def setUp(self):

        # Get the path of module
        modulePath = getModulePath()

        # Image file
        imageFolderPath = os.path.join(modulePath, "tests", "testData",
                                       "testImages", "LSST_NE_SN25")
        imageName = 'z11_0.25_intra.txt'
        imageFile = os.path.join(imageFolderPath, imageName)

        # Set the image file
        self.adapImage = AdapThresImage()
        self.adapImage.setImg(imageFile=imageFile)

        self.zeroImage = BlendedImageDecorator()
        self.zeroImage.setImg(image=np.zeros([120, 120]))

        self.randImage = BlendedImageDecorator()
        self.randImage.setImg(image=np.random.rand(120, 120))
Пример #44
0
    def setUp(self):

        # Get the path of module
        self.modulePath = getModulePath()

        self.sourSelc = SourceSelector(CamType.ComCam, BscDbType.LocalDb)

        # Set the survey parameters
        ra = 0.0
        dec = 63.0
        rotSkyPos = 0.0
        self.sourSelc.setObsMetaData(ra, dec, rotSkyPos)
        self.sourSelc.setFilter(FilterType.U)

        # Address of local database
        self.dbAdress = os.path.join(self.modulePath, "tests", "testData",
                                     "bsc.db3")

        # Connect to database
        self.sourSelc.connect(self.dbAdress)
Пример #45
0
    def setUp(self):

        cwfsConfigDir = os.path.join(getConfigDir(), "cwfs")
        instDir = os.path.join(cwfsConfigDir, "instData")
        algoDir = os.path.join(cwfsConfigDir, "algo")
        self.wfsEst = WfEstimator(instDir, algoDir)

        # Define the image folder and image names
        # It is noted that image.readFile inuts is based on the txt file.
        self.modulePath = getModulePath()
        imageFolderPath = os.path.join(self.modulePath, "tests", "testData",
                                       "testImages", "LSST_NE_SN25")
        intra_image_name = "z11_0.25_intra.txt"
        extra_image_name = "z11_0.25_extra.txt"

        # Path to image files
        self.intraImgFile = os.path.join(imageFolderPath, intra_image_name)
        self.extraImgFile = os.path.join(imageFolderPath, extra_image_name)

        # Field XY position
        self.fieldXY = (1.185, 1.185)
Пример #46
0
    def setUp(self):

        # Set the database address
        modulePath = getModulePath()
        dbAdress = os.path.join(modulePath, "tests", "testData", "bsc.db3")

        # Set up local database
        self.localDatabase = LocalDatabase()
        self.localDatabase.connect(dbAdress)

        # Set the filter
        self.filterType = FilterType.G

        # Set up neighboring star map
        stars = StarData([123, 456, 789], [0.1, 0.2, 0.3], [2.1, 2.2, 2.3],
                         [2.0, 3.0, 4.0], [2.0, 3.0, 4.0], [2.0, 3.0, 4.0],
                         [2.0, 3.0, 4.0], [2.0, 3.0, 4.0], [2.0, 3.0, 4.0])
        stars.setRaInPixel(stars.getRA() * 10)
        stars.setDeclInPixel(stars.getDecl() * 10)
        self.neighboringStar = stars.getNeighboringStar(
            [0], 3, self.filterType, 99)
Пример #47
0
    def setUp(self):

        self.modulePath = getModulePath()

        # Query the database to get the star maps
        self.sourSelc = SourceSelector(CamType.ComCam, BscDbType.LocalDb)
        self.sourSelc.setObsMetaData(0.0, 63, 0.0)
        self.sourSelc.configNbrCriteria(63.0, 2.5, maxNeighboringStar=99)
        self.sourSelc.setFilter(FilterType.U)

        dbAdress = os.path.join(self.modulePath, "tests", "testData", "bsc.db3")
        self.sourSelc.connect(dbAdress)
        neighborStarMap, starMap, wavefrontSensors = \
            self.sourSelc.getTargetStar(offset=0)
        self.sourSelc.disconnect()

        # Collect the data for the test of plot functions
        self.wavefrontSensors = wavefrontSensors
        self.starMap = starMap
        self.neighborStarMap = neighborStarMap

        # Save image files directory
        self.dataDir = os.path.join(self.modulePath, "tests", "tmp")
        self._makeDir(self.dataDir)
Пример #48
0
import os
import numpy as np

from lsst.ts.wep.deblend.AdapThresImage import AdapThresImage
from lsst.ts.wep.deblend.BlendedImageDecorator import BlendedImageDecorator
from lsst.ts.wep.cwfs.Tool import plotImage
from lsst.ts.wep.Utility import getModulePath


if __name__ == "__main__":

    # Get the path of module
    modulePath = getModulePath()

    # Define the image folder and image names
    # Image data -- Don't know the final image format.
    # It is noted that image.readFile inuts is based on the txt file
    imageFolderPath = os.path.join(modulePath, "tests", "testData",
                                   "testImages", "LSST_NE_SN25")
    imageName = 'z11_0.25_intra.txt'
    imageFile = os.path.join(imageFolderPath, imageName)

    imageIntra = AdapThresImage()
    imageIntra.setImg(imageFile=imageFile)

    # Coefficient of distance between donuts
    # (Space coefficient should be >= 1.2)
    spaceCoef = np.random.rand()*1.5 + 1.2
    print("Random space coeffcient is %f." % spaceCoef)

    # Ratio of magnitude between donuts (If the magnitudes of stars differ by
Пример #49
0
    def testGetConfigDir(self):

        ansConfigDir = os.path.join(getModulePath(), "policy")
        self.assertEqual(getConfigDir(), ansConfigDir)