-
Notifications
You must be signed in to change notification settings - Fork 2
/
cosmics.py
executable file
·34 lines (24 loc) · 960 Bytes
/
cosmics.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
import os, sys, podi_cython, numpy
from astropy.io import fits
if __name__ == "__main__":
hdulist = fits.open(sys.argv[1])
data = hdulist['SKYSUB.OPT'].data
gain = 1.5
readnoise = 6
sigclip = 5.0
sigfrac = 0.3
objlim = 5.0
saturation_limit=65000
crj = podi_cython.lacosmics(data.astype(numpy.float64),
gain=gain,
readnoise=readnoise,
niter=3,
sigclip=sigclip, sigfrac=sigfrac, objlim=objlim,
saturation_limit=saturation_limit,
verbose=False)
cell_cleaned, cell_mask, cell_saturated = crj
hdulist.append(fits.ImageHDU(data=cell_cleaned,
header=hdulist['SCI.RAW'].header,
name="PODI.CRJ"))
hdulist.writeto(sys.argv[1][:-5]+".odicrj.fits", clobber=True)