Skip to content

Instantly share code, notes, and snippets.

@mileslucas
Created April 9, 2020 02:39
Show Gist options
  • Save mileslucas/54cdcaa59da10a378fd9eb3adfefce6f to your computer and use it in GitHub Desktop.
Save mileslucas/54cdcaa59da10a378fd9eb3adfefce6f to your computer and use it in GitHub Desktop.
Simple Image Reprojection
from reproject import reproject_interp
from astropy.io import fits
from glob import glob
import numpy as np
# get the header for the file we want to reproject to
hdr = fits.getheader("NEP5281_r_0_new.fits")
# get the filenames as a list for each filter
rfiles = glob("*r*_new.fits")
ifiles = glob("*i*_new.fits")
zfiles = glob("*z*_new.fits")
# here is an example projection and reduction for just the r frames. You'll need to do the rest
reprojected_r = [reproject_interp(fname, hdr, return_footprint=False) for fname in rfiles]
combined_r = np.median(reprojected_r, axis=0)
fits.writeto("NEP5281_r_master.fits", combined_r, header=hdr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment