Created
January 15, 2019 14:33
-
-
Save briehanlombaard/e14a8718221657b56a1b30675f4ce760 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import argparse | |
import numpy as np | |
from astropy.io import fits | |
def create(name, w, h, dtype, overwrite=True): | |
a = np.random.randn(w, h).astype(dtype) | |
hdu = fits.PrimaryHDU(a) | |
hdul = fits.HDUList([hdu]) | |
hdul.writeto(name, overwrite=overwrite) | |
if __name__ == '__main__': | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--filename', default='data.fits') | |
parser.add_argument('--width', default=1024, type=int) | |
parser.add_argument('--height', default=1024, type=int) | |
parser.add_argument('--dtype', default='uint16') | |
arguments = parser.parse_args() | |
create( | |
arguments.filename, | |
arguments.width, | |
arguments.height, | |
arguments.dtype | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment