def _make_coverage_map(self, coverage_paths): """Make a map with the sum of images covering each pixel.""" configs = dict(self._configs) configs.update({"COMBINE_TYPE": "SUM", "RESAMPLE": "N", "SUBTRACT_BACK": "N"}) name = os.path.basename(os.path.splitext(self._mosaic_path)[0]) \ + ".coverage.fits" swarp = Swarp(coverage_paths, name, configs=configs, workDir=os.path.dirname(self._mosaic_path)) swarp.set_target_fits(self._mosaic_path) swarp.run() coadd_path, coadd_weight_path = swarp.mosaic_paths() os.remove(coadd_weight_path) return coadd_path
def _make_var_sum_map(self, variance_paths, coverage_paths): """Make a map with the sum of variances.""" configs = dict(self._configs) configs.update({"COMBINE_TYPE": "SUM", "RESAMPLE": "N", "WEIGHT_TYPE": "MAP_WEIGHT", "SUBTRACT_BACK": "N"}) name = os.path.basename(os.path.splitext(self._mosaic_path)[0]) \ + ".varsum.fits" swarp = Swarp(variance_paths, name, weightPaths=coverage_paths, configs=configs, workDir=os.path.dirname(self._mosaic_path)) swarp.set_target_fits(self._mosaic_path) swarp.run() coadd_path, coadd_weight_path = swarp.mosaic_paths() os.remove(coadd_weight_path) return coadd_path
def _coadd_frames(self): """Swarps images together as their arithmetic mean.""" imagePathList = [] weightPathList = [] for frame in self._current_offset_paths: imagePathList.append(self._current_offset_paths[frame]) weightPathList.append(self.weight_paths[frame]) configs = dict(self._swarp_configs) configs.update({'RESAMPLE': 'N', 'SUBTRACT_BACK': 'N'}) swarp = Swarp(imagePathList, self.stack_name, weightPaths=weightPathList, configs=configs, workDir=self.workdir) swarp.run() coaddPath, coaddWeightPath = swarp.mosaic_paths() coaddHeader = astropy.io.fits.getheader(coaddPath, 0) coaddFrame = ResampledWCS(coaddHeader) return coaddPath, coaddWeightPath, coaddFrame