Created
September 4, 2018 14:10
-
-
Save bhishanpdl/6581b03afb7efd47eb5f3be3fbb2b043 to your computer and use it in GitHub Desktop.
Add two fits files from jedisim outputs with jedism settings headers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# -*- coding: utf-8 -*-# | |
""" | |
Create fitsfile. | |
Author : Bhishan Poudel | |
Date : Sep 4, 2018 | |
Combine two fitsfile keeping their fitsheaders. | |
""" | |
# Imports | |
import numpy as np | |
from astropy import wcs | |
from astropy.io import fits | |
import sys | |
def add_fits(in1,in2,out,z): | |
data1,hdr = fits.getdata(in1,header=True) | |
data2 = fits.getdata(in2) | |
hdr['REDSHIFT'] = float(z) | |
hdr['EXPTIME'] = 6000 | |
hdr['NGALS'] = (20000, 'jedisim simulation galaxies') | |
hdr['Z-LENS'] = (0.3, 'redshift of lens') | |
hdr['SIM-PIX'] = (0.06, 'simulation pix scale of HST') | |
hdr['F-PIX'] = (0.2, 'final pixscale of LSST in jedisim') | |
fits.writeto(out,data1+data2,overwrite=True, header=hdr) | |
def main(): | |
"""Run main function.""" | |
print('Usage: python fits_combine.py infits1 infits2 outfits redshift') | |
in1 = sys.argv[1] | |
in2 = sys.argv[2] | |
out = sys.argv[3] | |
z = float(sys.argv[4]) | |
add_fits(in1,in2,out,z) | |
print('Output: ', out) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment