Ejemplo n.º 1
0
    def teste_initPyrWfs(self):
        config = confParse.Configurator("../conf/sh_8x8.py")
        config.loadSimParams()
        
        mask = aoSimLib.circle(config.sim.pupilSize/2., config.sim.simSize)

        wfs = WFS.Pyramid(config.sim, config.wfss[0], config.atmos, config.lgss[0], mask)
Ejemplo n.º 2
0
    def testf_PyrWfsFrame(self):
        config = confParse.Configurator("../conf/sh_8x8.py")
        config.loadSimParams()
        mask = aoSimLib.circle(config.sim.pupilSize/2., config.sim.simSize)

        wfs = WFS.Pyramid(config.sim, config.wfss[0], config.atmos, config.lgss[0], mask)

        wfs.frame(numpy.zeros((config.sim.simSize, config.sim.simSize)))
Ejemplo n.º 3
0
    def testa_initWfs(self):

        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        wfs = WFS.WFS(config, mask=mask)
Ejemplo n.º 4
0
    def test_sciInit(self):

        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        sci = SCI.PSF(config, 0, mask)
Ejemplo n.º 5
0
    def testd_GradWfsFrame(self):
        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()
        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        wfs = WFS.Gradient(config, mask=mask)

        wfs.frame(numpy.zeros((config.sim.simSize, config.sim.simSize)))
Ejemplo n.º 6
0
    def testa_initDM(self):

        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        wfs = WFS.ShackHartmann(config, mask=mask)
        dm = DM.DM(config, wfss=[wfs], mask=mask)
Ejemplo n.º 7
0
    def testa_initLgs(self):

        config = confParse.Configurator(
            os.path.join(CONFIG_PATH, "sh_8x8_lgs-uplink.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        lgs = LGS.LGS(config.wfss[1], config)
Ejemplo n.º 8
0
    def testd_initPhysLgs(self):
        config = confParse.Configurator(
            os.path.join(CONFIG_PATH, "sh_8x8_lgs-uplink.py"))
        config.loadSimParams()
        config.wfss[1].lgs.propagationMode = "Physical"

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        lgs = LGS.LGS_Physical(config.wfss[1], config)
Ejemplo n.º 9
0
    def testc_geoLgsPsf(self):
        config = confParse.Configurator(
            os.path.join(CONFIG_PATH, "sh_8x8_lgs-uplink.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)
        config.wfss[1].lgs.propagationMode = "Geometric"
        lgs = LGS.LGS_Geometric(config.wfss[1], config)
        psf = lgs.getLgsPsf(
            [numpy.zeros((config.sim.simSize, config.sim.simSize))])
Ejemplo n.º 10
0
    def test_runLOS(self):
        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        # mask = aoSimLib.circle(config.sim.pupilSize/2., config.sim.simSize)
        los = lineofsight.LineOfSight(config.wfss[0], config)

        testPhase = numpy.arange(config.sim.simSize**2).reshape(
            (config.sim.simSize, ) * 2)

        phs = los.frame(testPhase)
Ejemplo n.º 11
0
    def test_sciStrehl(self):
        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        sci = SCI.PSF(config, 0, mask)

        sci.frame(numpy.ones((config.sim.simSize, config.sim.simSize)))

        self.assertTrue(numpy.allclose(sci.instStrehl, 1.))
Ejemplo n.º 12
0
    def teste_physLgsPsf(self):
        config = confParse.Configurator(
            os.path.join(CONFIG_PATH, "sh_8x8_lgs-uplink.py"))
        config.loadSimParams()

        config.wfss[1].lgs.propagationMode = "Physical"
        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        lgs = LGS.LGS_Physical(config.wfss[1], config, nOutPxls=10)
        psf = lgs.getLgsPsf(
            [numpy.zeros((config.sim.simSize, config.sim.simSize))])
Ejemplo n.º 13
0
    def test_PhysWfs(self):

        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()
        config.wfss[0].propagationMode = "Physical"

        mask = aoSimLib.circle(config.sim.pupilSize / 2., config.sim.simSize)

        wfs = WFS.WFS(config, mask=mask)

        wfs.frame([numpy.zeros(
            (config.sim.scrnSize, ) * 2)] * config.atmos.scrnNo)
Ejemplo n.º 14
0
    def test_saveloadScrn(self):
        # test the saving and loading phase screens

        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()
        config.atmos.wholeScrnSize = 512

        atmos = atmosphere.atmos(config)

        # Make a directory to save the screens in
        if os.path.exists('testscrns'):
            shutil.rmtree('testscrns')

        os.makedirs('testscrns')
        atmos.saveScrns('testscrns')
        try:
            # change config to load scrns
            config.atmos.scrnNames = []
            for i in range(config.atmos.scrnNo):
                config.atmos.scrnNames.append(
                    'testscrns/scrn{}.fits'.format(i))

            atmos2 = atmosphere.atmos(config)

            # Check that all scrns are identical

            for i in range(config.atmos.scrnNo):
                assert numpy.allclose(atmos.wholeScrns[i],
                                      atmos2.wholeScrns[i])

            # delete that dir
            shutil.rmtree('testscrns')

        except:
            # always delete that dir - even in case of failure
            shutil.rmtree('testscrns')
            raise
Ejemplo n.º 15
0
    def test_randomAtmos(self):
        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        atmos = atmosphere.atmos(config)
        atmos.randomScrns()
Ejemplo n.º 16
0
    def test_initLOS(self):
        config = confParse.Configurator(os.path.join(CONFIG_PATH, "sh_8x8.py"))
        config.loadSimParams()

        # mask = aoSimLib.circle(config.sim.pupilSize/2., config.sim.simSize)
        los = lineofsight.LineOfSight(config.wfss[0], config)