コード例 #1
0
ファイル: procalgs.py プロジェクト: gnizq64/desispec
    def run_pa(self,
               input_frame,
               psfbootfile,
               outfile,
               usesigma,
               linelist=None,
               npoly=2,
               nbins=2,
               domain=None):
        from desispec.quicklook.arcprocess import process_arc, write_psffile
        from desispec.quicklook.palib import get_resolution
        from desispec.psf import PSF

        wcoeffs = process_arc(input_frame,
                              linelist=linelist,
                              npoly=npoly,
                              nbins=nbins,
                              domain=domain)

        #- write out the psf outfile
        wstep = input_frame.meta["WAVESTEP"]
        write_psffile(psfbootfile, wcoeffs, outfile, wavestepsize=wstep)
        log.debug("Wrote psf file {}".format(outfile))

        #- update the arc frame resolution from new coeffs
        newpsf = PSF(outfile)
        input_frame.resolution_data = get_resolution(input_frame.wave,
                                                     input_frame.nspec,
                                                     newpsf,
                                                     usesigma=usesigma)

        return input_frame
コード例 #2
0
    def run(self,*args,**kwargs):
        if len(args) == 0 :
            raise qlexceptions.ParameterException("Missing input parameter")
        if not self.is_compatible(type(args[0])):
            raise qlexceptions.ParameterException("Incompatible input. Was expecting %s got %s"%(type(self.__inpType__),type(args[0])))
        if not kwargs["PSFbootfile"]:
             raise qlexceptions.ParameterException("Missing psfbootfile in the arguments")

        if "PSFoutfile" not in kwargs:
             raise qlexceptions.ParameterException("Missing psfoutfile in the arguments")

        psfoutfile=kwargs["PSFoutfile"]
        psfbootfile=kwargs["PSFbootfile"] 

        from desispec.psf import PSF
        psfboot=PSF(psfbootfile)
        domain=(psfboot.wmin,psfboot.wmax)

        input_frame=args[0]

        linelist=None
        if "Linelist" in kwargs:
            linelist=kwargs["Linelist"]

        npoly=2
        if "NPOLY" in kwargs:
            npoly=kwargs["NPOLY"]
        nbins=2
        if "NBINS" in kwargs:
            nbins=kwargs["NBINS"]

        return self.run_pa(input_frame, psfbootfile, psfoutfile, linelist=linelist, npoly=npoly, nbins=nbins,domain=domain)
コード例 #3
0
ファイル: test_bootcalib.py プロジェクト: gnizq64/desispec
    def test_main(self):
        if self.data_unavailable:
            self.skipTest("Failed to download test data.")
        argstr = [
            '--fiberflat',
            self.testflat,
            '--arcfile',
            self.testarc,
            '--outfile',
            self.testout,
            '--qafile',
            self.qafile,
        ]
        args = bootscript.parse(options=argstr)
        bootscript.main(args)

        #- Ensure the PSF class can read that file
        from desispec.psf import PSF
        psf = PSF(self.testout)

        #- While we're at it, test some PSF accessor functions
        w = psf.wavelength()
        w = psf.wavelength(ispec=0)
        w = psf.wavelength(ispec=[0, 1])
        w = psf.wavelength(ispec=[0, 1], y=0)
        w = psf.wavelength(ispec=[0, 1], y=[0, 1])

        x = psf.x()
        x = psf.x(ispec=0)
        x = psf.x(ispec=[0, 1])
        x = psf.x(ispec=None, wavelength=psf.wmin)
        x = psf.x(ispec=1, wavelength=psf.wmin)
        x = psf.x(ispec=[0, 1], wavelength=psf.wmin)
        x = psf.x(ispec=[0, 1], wavelength=[psf.wmin, psf.wmin + 1])

        y = psf.y(ispec=None, wavelength=psf.wmin)
        y = psf.y(ispec=0, wavelength=psf.wmin)
        y = psf.y(ispec=[0, 1], wavelength=psf.wmin)
        y = psf.y(ispec=[0, 1], wavelength=[psf.wmin, psf.wmin + 1])

        t = psf.invert()