Exemple #1
0
    def slurp(self, make_frameqa=False, remove=True, **kwargs):
        """ Slurp all the individual QA files into one master QA file
        Args:
            make_frameqa: bool, optional
              Regenerate the individual QA files (at the frame level first)
            remove: bool, optional
              Remove

        Returns:

        """
        from desispec.io import meta
        from desispec.qa import QA_Exposure
        from desispec.io import write_qa_prod
        import pdb
        log = get_logger()
        # Remake?
        if make_frameqa:
            self.make_frameqa(**kwargs)
        # Loop on nights
        path_nights = glob.glob(self.specprod_dir + '/exposures/*')
        nights = [ipathn[ipathn.rfind('/') + 1:] for ipathn in path_nights]
        # Reset
        log.info("Resetting qa_exps in qa_prod")
        self.qa_exps = []
        # Loop
        for night in nights:
            # Loop on exposures
            for exposure in get_exposures(night,
                                          specprod_dir=self.specprod_dir):
                frames_dict = get_files(filetype=str('frame'),
                                        night=night,
                                        expid=exposure,
                                        specprod_dir=self.specprod_dir)
                if len(frames_dict) == 0:
                    continue
                # Load any frame (for the type)
                key = list(frames_dict.keys())[0]
                frame_fil = frames_dict[key]
                frame = read_frame(frame_fil)
                qa_exp = QA_Exposure(exposure,
                                     night,
                                     frame.meta['FLAVOR'],
                                     specprod_dir=self.specprod_dir,
                                     remove=remove)
                # Append
                self.qa_exps.append(qa_exp)
        # Write
        outroot = self.specprod_dir + '/' + self.prod_name + '_qa'
        write_qa_prod(outroot, self)
Exemple #2
0
    def slurp(self, make_frameqa=False, remove=True, **kwargs):
        """ Slurp all the individual QA files into one master QA file
        Args:
            make_frameqa: bool, optional
              Regenerate the individual QA files (at the frame level first)
            remove: bool, optional
              Remove

        Returns:

        """
        from desispec.io import meta
        from desispec.qa import QA_Exposure
        from desispec.io import write_qa_prod
        import pdb
        # Remake?
        if make_frameqa:
            self.make_frameqa(**kwargs)
        # Loop on nights
        path_nights = glob.glob(self.specprod_dir+'/exposures/*')
        nights = [ipathn[ipathn.rfind('/')+1:] for ipathn in path_nights]
        # Reset
        log.info("Resetting qa_exps in qa_prod")
        self.qa_exps = []
        # Loop
        for night in nights:
            # Loop on exposures
            for exposure in get_exposures(night, specprod_dir = self.specprod_dir):
                frames_dict = get_files(filetype = str('frame'), night = night,
                                        expid = exposure, specprod_dir = self.specprod_dir)
                if len(frames_dict.keys()) == 0:
                    continue
                # Load any frame (for the type)
                key = frames_dict.keys()[0]
                frame_fil = frames_dict[key]
                frame = read_frame(frame_fil)
                qa_exp = QA_Exposure(exposure, night, frame.meta['FLAVOR'],
                                         specprod_dir=self.specprod_dir, remove=remove)
                # Append
                self.qa_exps.append(qa_exp)
        # Write
        outroot = self.specprod_dir+'/'+self.prod_name+'_qa'
        write_qa_prod(outroot, self)