Пример #1
0
    def make_frameqa(self, make_plots=False, clobber=False):
        """ Work through the exposures and make QA for all frames

        Parameters:
            make_plots: bool, optional
              Remake the plots too?
            clobber: bool, optional
        Returns:

        """
        # imports
        from desispec.qa.qa_frame import qaframe_from_frame
        from desispec.io.qa import qafile_from_framefile

        # Loop on nights
        for night in self.mexp_dict.keys():
            for exposure in self.mexp_dict[night]:
                # Object only??
                for camera, frame_fil in self.mexp_dict[night][exposure].items(
                ):
                    # Load frame
                    qafile, _ = qafile_from_framefile(
                        frame_fil, qaprod_dir=self.qaprod_dir)
                    if os.path.isfile(qafile) and (not clobber) and (
                            not make_plots):
                        continue
                    qaframe_from_frame(frame_fil,
                                       make_plots=make_plots,
                                       qaprod_dir=self.qaprod_dir,
                                       clobber=clobber)
Пример #2
0
    def make_frameqa(self, make_plots=False, clobber=False):
        """ Work through the exposures and make QA for all frames

        Parameters:
            make_plots: bool, optional
              Remake the plots too?
            clobber: bool, optional
        Returns:

        """
        # imports
        from desispec.qa.qa_frame import qaframe_from_frame
        from desispec.io.qa import qafile_from_framefile

        # Loop on nights
        for night in self.mexp_dict.keys():
            for exposure in self.mexp_dict[night]:
                # Object only??
                for camera,frame_fil in self.mexp_dict[night][exposure].items():
                    # Load frame
                    qafile, _ = qafile_from_framefile(frame_fil, qaprod_dir=self.qaprod_dir)
                    if os.path.isfile(qafile) and (not clobber) and (not make_plots):
                        continue
                    qaframe_from_frame(frame_fil, make_plots=make_plots, qaprod_dir=self.qaprod_dir,
                                       clobber=clobber)
Пример #3
0
    def build_qa_data(self, rebuild=False):
        """
        Build or re-build QA data


        Args:
            rebuild: bool, optional

        :return:
            Data is loaded in self.data
        """
        frame_files = desiio.get_files(filetype='frame',
                                       night=self.night,
                                       expid=self.expid,
                                       specprod_dir=self.specprod_dir)
        # Load into frames
        for camera, frame_file in frame_files.items():
            if rebuild:
                qafile, qatype = qafile_from_framefile(frame_file)
                if os.path.isfile(qafile):
                    os.remove(qafile)
            # Generate qaframe (and figures?)
            _ = qaframe_from_frame(frame_file,
                                   specprod_dir=self.specprod_dir,
                                   make_plots=False)
        # Reload
        self.load_qa_data()
Пример #4
0
    def make_frameqa(self,
                     make_plots=False,
                     clobber=False,
                     restrict_nights=None):
        """ Work through the exposures and make QA for all frames

        Parameters:
            make_plots: bool, optional
              Remake the plots too?
            clobber: bool, optional
            restrict_nights: list, optional
              Only perform QA on the input list of nights
        Returns:

        """
        # imports
        from desispec.qa.qa_frame import qaframe_from_frame
        from desispec.io.qa import qafile_from_framefile

        # Loop on nights
        for night in self.mexp_dict.keys():
            if restrict_nights is not None:
                if night not in restrict_nights:
                    continue
            for exposure in self.mexp_dict[night]:
                # Object only??
                for camera, frame_fil in self.mexp_dict[night][exposure].items(
                ):
                    # QA filename
                    qafile, _ = qafile_from_framefile(
                        frame_fil, qaprod_dir=self.qaprod_dir)
                    if os.path.isfile(qafile) and (not clobber) and (
                            not make_plots):
                        continue
                    # Make QA
                    qaframe_from_frame(frame_fil,
                                       make_plots=make_plots,
                                       qaprod_dir=self.qaprod_dir,
                                       clobber=clobber,
                                       specprod_dir=self.specprod_dir)
Пример #5
0
def main(args) :

    from desispec.io import meta
    from desispec.qa.qa_frame import qaframe_from_frame
    log=get_logger()

    log.info("starting")
    if args.specprod_dir is None:
        specprod_dir = meta.specprod_root()
    else:
        specprod_dir = args.specprod_dir

    # Generate qaframe (and figures?)
    qaframe = qaframe_from_frame(args.frame_file, specprod_dir=specprod_dir, make_plots=args.make_plots,
                           output_dir=args.output_dir)
Пример #6
0
    def make_frameqa(self, make_plots=False, clobber=True):
        """ Work through the Production and make QA for all frames

        Parameters:
            make_plots: bool, optional
              Remake the plots too?
            clobber: bool, optional
        Returns:

        """
        # imports
        from desispec.io import meta
        from desispec.io.qa import load_qa_frame, write_qa_frame
        from desispec.io.fiberflat import read_fiberflat
        from desispec.io.sky import read_sky
        from desispec.io.fluxcalibration import read_flux_calibration
        from desispec.qa import qa_plots
        from desispec.qa.qa_frame import qaframe_from_frame
        from desispec.io.fluxcalibration import read_stdstar_models
        log = get_logger()

        # Loop on nights
        path_nights = glob.glob(self.specprod_dir + '/exposures/*')
        nights = [ipathn[ipathn.rfind('/') + 1:] for ipathn in path_nights]
        for night in nights:
            for exposure in get_exposures(night,
                                          specprod_dir=self.specprod_dir):
                # Object only??
                frames_dict = get_files(filetype=str('frame'),
                                        night=night,
                                        expid=exposure,
                                        specprod_dir=self.specprod_dir)
                for camera, frame_fil in frames_dict.items():
                    # Load frame
                    qaframe_from_frame(frame_fil, make_plots=make_plots)
                    '''
Пример #7
0
def main(args):

    from desispec.io import meta
    from desispec.qa.qa_frame import qaframe_from_frame
    log = get_logger()

    log.info("starting")
    if args.specprod_dir is None:
        specprod_dir = meta.specprod_root()
    else:
        specprod_dir = args.specprod_dir

    # Generate qaframe (and figures?)
    _ = qaframe_from_frame(args.frame_file,
                           specprod_dir=specprod_dir,
                           make_plots=args.make_plots,
                           output_dir=args.output_dir)