def run(self, args): """Ingest all specified files and add them to the registry""" if args.filetype == "instcal": root = args.input with self.register.openRegistry(root, create=args.create, dryrun=args.dryrun) as registry: for infile in args.files: fileInfo, hduInfoList = self.parse.getInfo(infile, args.filetype) if len(hduInfoList) > 0: outfileInstcal = os.path.join(root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "instcal")) outfileDqmask = os.path.join(root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "dqmask")) outfileWtmap = os.path.join(root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "wtmap")) ingestedInstcal = self.ingest(fileInfo["instcal"], outfileInstcal, mode=args.mode, dryrun=args.dryrun) ingestedDqmask = self.ingest(fileInfo["dqmask"], outfileDqmask, mode=args.mode, dryrun=args.dryrun) ingestedWtmap = self.ingest(fileInfo["wtmap"], outfileWtmap, mode=args.mode, dryrun=args.dryrun) if not (ingestedInstcal or ingestedDqmask or ingestedWtmap): continue for info in hduInfoList: self.register.addRow(registry, info, dryrun=args.dryrun, create=args.create) self.register.addVisits(registry, dryrun=args.dryrun) elif args.filetype == "raw": IngestTask.run(self, args)
def run(self, args): """Ingest all specified files and add them to the registry""" if args.filetype == "instcal": root = args.input with self.register.openRegistry(root, create=args.create, dryrun=args.dryrun) as registry: for infile in args.files: fileInfo, hduInfoList = self.parse.getInfo(infile, args.filetype) if len(hduInfoList) > 0: outfileInstcal = os.path.join( root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "instcal") ) outfileDqmask = os.path.join( root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "dqmask") ) outfileWtmap = os.path.join( root, self.parse.getDestination(args.butler, hduInfoList[0], infile, "wtmap") ) ingestedInstcal = self.ingest( fileInfo["instcal"], outfileInstcal, mode=args.mode, dryrun=args.dryrun ) ingestedDqmask = self.ingest( fileInfo["dqmask"], outfileDqmask, mode=args.mode, dryrun=args.dryrun ) ingestedWtmap = self.ingest(fileInfo["wtmap"], outfileWtmap, mode=args.mode, dryrun=args.dryrun) if not (ingestedInstcal or ingestedDqmask or ingestedWtmap): continue for info in hduInfoList: info["hdu"] = None self.register.addRow(registry, info, dryrun=args.dryrun, create=args.create) self.register.addVisits(registry, dryrun=args.dryrun) elif args.filetype == "raw": IngestTask.run(self, args)