wfc3tools 1.6.0__py3-none-any.whl → 1.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wfc3tools/calwf3.py +13 -12
- wfc3tools/embedsub.py +29 -31
- wfc3tools/pstack.py +11 -14
- wfc3tools/pstat.py +31 -23
- wfc3tools/sampinfo.py +17 -19
- wfc3tools/sub2full.py +16 -17
- wfc3tools/util.py +39 -35
- wfc3tools/version.py +3 -3
- wfc3tools/wf32d.py +29 -19
- wfc3tools/wf3ccd.py +27 -18
- wfc3tools/wf3cte.py +5 -6
- wfc3tools/wf3ir.py +5 -5
- wfc3tools/wf3rej.py +29 -16
- {wfc3tools-1.6.0.dist-info → wfc3tools-1.6.1.dist-info}/METADATA +12 -21
- wfc3tools-1.6.1.dist-info/RECORD +19 -0
- {wfc3tools-1.6.0.dist-info → wfc3tools-1.6.1.dist-info}/WHEEL +1 -1
- wfc3tools-1.6.0.dist-info/RECORD +0 -19
- {wfc3tools-1.6.0.dist-info → wfc3tools-1.6.1.dist-info}/licenses/LICENSE.txt +0 -0
- {wfc3tools-1.6.0.dist-info → wfc3tools-1.6.1.dist-info}/top_level.txt +0 -0
wfc3tools/calwf3.py
CHANGED
|
@@ -29,11 +29,13 @@ import subprocess
|
|
|
29
29
|
|
|
30
30
|
# STSCI
|
|
31
31
|
from stsci.tools import parseinput
|
|
32
|
+
|
|
32
33
|
from .util import error_code
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
def calwf3(
|
|
36
|
-
|
|
36
|
+
def calwf3(
|
|
37
|
+
input=None, printtime=False, save_tmp=False, verbose=False, debug=False, parallel=True, version=False, log_func=print
|
|
38
|
+
):
|
|
37
39
|
"""
|
|
38
40
|
Run the calwf3.e executable as from the shell.
|
|
39
41
|
|
|
@@ -137,33 +139,32 @@ def calwf3(input=None, printtime=False, save_tmp=False,
|
|
|
137
139
|
|
|
138
140
|
"""
|
|
139
141
|
|
|
140
|
-
call_list = [
|
|
142
|
+
call_list = ["calwf3.e"]
|
|
141
143
|
return_code = None
|
|
142
144
|
|
|
143
145
|
if printtime:
|
|
144
|
-
call_list.append(
|
|
146
|
+
call_list.append("-t")
|
|
145
147
|
|
|
146
148
|
if save_tmp:
|
|
147
|
-
call_list.append(
|
|
149
|
+
call_list.append("-s")
|
|
148
150
|
|
|
149
151
|
if verbose:
|
|
150
|
-
call_list.append(
|
|
152
|
+
call_list.append("-v")
|
|
151
153
|
|
|
152
154
|
if version:
|
|
153
|
-
call_list.append(
|
|
155
|
+
call_list.append("--version")
|
|
154
156
|
|
|
155
157
|
if debug:
|
|
156
|
-
call_list.append(
|
|
158
|
+
call_list.append("-d")
|
|
157
159
|
|
|
158
160
|
if not parallel:
|
|
159
|
-
call_list.append(
|
|
161
|
+
call_list.append("-1")
|
|
160
162
|
|
|
161
163
|
infiles, dummy = parseinput.parseinput(input)
|
|
162
164
|
if (len(parseinput.irafglob(input)) == 0) and not version:
|
|
163
165
|
raise IOError("No valid image specified")
|
|
164
166
|
if len(parseinput.irafglob(input)) > 1:
|
|
165
|
-
raise IOError("calwf3 can only accept 1 file
|
|
166
|
-
"input at a time: {0}".format(infiles))
|
|
167
|
+
raise IOError("calwf3 can only accept 1 file forinput at a time: {0}".format(infiles))
|
|
167
168
|
|
|
168
169
|
for image in infiles:
|
|
169
170
|
if not os.path.exists(image):
|
|
@@ -180,7 +181,7 @@ def calwf3(input=None, printtime=False, save_tmp=False,
|
|
|
180
181
|
|
|
181
182
|
if log_func is not None:
|
|
182
183
|
for line in proc.stdout:
|
|
183
|
-
log_func(line.decode(
|
|
184
|
+
log_func(line.decode("utf8"))
|
|
184
185
|
|
|
185
186
|
return_code = proc.wait()
|
|
186
187
|
ec = error_code(return_code)
|
wfc3tools/embedsub.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import numpy
|
|
2
2
|
|
|
3
3
|
# STDLIB
|
|
4
4
|
from astropy.io import fits
|
|
5
|
-
import os
|
|
6
|
-
import numpy
|
|
7
5
|
|
|
8
6
|
# STSCI
|
|
9
7
|
from stsci.tools import parseinput
|
|
10
8
|
|
|
9
|
+
from .sub2full import sub2full
|
|
10
|
+
|
|
11
11
|
__taskname__ = "embedsub"
|
|
12
12
|
|
|
13
13
|
|
|
@@ -36,14 +36,13 @@ def embedsub(files):
|
|
|
36
36
|
|
|
37
37
|
# process all the input subarrays
|
|
38
38
|
for filename in infiles:
|
|
39
|
-
|
|
40
39
|
# Make sure the input name conforms to normal style
|
|
41
|
-
if
|
|
40
|
+
if "_flt" not in filename:
|
|
42
41
|
print("Warning: Can't properly parse '%s'; Skipping" % files)
|
|
43
42
|
|
|
44
43
|
# Extract the root name and build SPT and output file names
|
|
45
|
-
root = filename[0:filename.find(
|
|
46
|
-
full = root[0:len(root)-1] +
|
|
44
|
+
root = filename[0 : filename.find("_flt")]
|
|
45
|
+
full = root[0 : len(root) - 1] + "f_flt.fits"
|
|
47
46
|
|
|
48
47
|
try:
|
|
49
48
|
# open input file read-only
|
|
@@ -51,14 +50,13 @@ def embedsub(files):
|
|
|
51
50
|
except EnvironmentError:
|
|
52
51
|
print("Problem opening fits file %s" % (filename))
|
|
53
52
|
|
|
54
|
-
detector = flt[0].header[
|
|
55
|
-
if
|
|
53
|
+
detector = flt[0].header["DETECTOR"]
|
|
54
|
+
if "UVIS" in detector:
|
|
56
55
|
uvis = True
|
|
57
56
|
|
|
58
57
|
# compute subarray corners assuming the raw image location
|
|
59
58
|
x1, x2, y1, y2 = sub2full(filename, fullExtent=True)[0]
|
|
60
|
-
print("Subarray image section [x1,x2,y1,y2] = [%d:%d,%d:%d]" % (x1, x2,
|
|
61
|
-
y1, y2))
|
|
59
|
+
print("Subarray image section [x1,x2,y1,y2] = [%d:%d,%d:%d]" % (x1, x2, y1, y2))
|
|
62
60
|
|
|
63
61
|
if uvis:
|
|
64
62
|
xaxis = uvis_full_x
|
|
@@ -74,44 +72,44 @@ def embedsub(files):
|
|
|
74
72
|
err = numpy.zeros([xaxis, yaxis], dtype=numpy.float32)
|
|
75
73
|
dq = numpy.zeros([xaxis, yaxis], dtype=numpy.int16) + 4
|
|
76
74
|
|
|
77
|
-
sci[y1-1:y2, x1-1:x2] = flt[1].data
|
|
78
|
-
err[y1-1:y2, x1-1:x2] = flt[2].data
|
|
79
|
-
dq[y1-1:y2, x1-1:x2] = flt[3].data
|
|
75
|
+
sci[y1 - 1 : y2, x1 - 1 : x2] = flt[1].data
|
|
76
|
+
err[y1 - 1 : y2, x1 - 1 : x2] = flt[2].data
|
|
77
|
+
dq[y1 - 1 : y2, x1 - 1 : x2] = flt[3].data
|
|
80
78
|
|
|
81
79
|
if not uvis:
|
|
82
80
|
samp = numpy.zeros([xaxis, yaxis], dtype=numpy.int16)
|
|
83
81
|
time = numpy.zeros([xaxis, yaxis], dtype=numpy.float32)
|
|
84
|
-
samp[y1-1:y2, x1-1:x2] = flt[4].data
|
|
85
|
-
time[y1-1:y2, x1-1:x2] = flt[5].data
|
|
82
|
+
samp[y1 - 1 : y2, x1 - 1 : x2] = flt[4].data
|
|
83
|
+
time[y1 - 1 : y2, x1 - 1 : x2] = flt[5].data
|
|
86
84
|
|
|
87
85
|
# Reset a few WCS values to make them appropriate for a
|
|
88
86
|
# full-chip image
|
|
89
|
-
crpix1 = flt[1].header[
|
|
90
|
-
crpix2 = flt[1].header[
|
|
87
|
+
crpix1 = flt[1].header["CRPIX1"]
|
|
88
|
+
crpix2 = flt[1].header["CRPIX2"]
|
|
91
89
|
|
|
92
|
-
flt[1].header[
|
|
93
|
-
flt[1].header[
|
|
90
|
+
flt[1].header["sizaxis1"] = yaxis
|
|
91
|
+
flt[1].header["sizaxis2"] = xaxis
|
|
94
92
|
|
|
95
93
|
for i in range(1, 4):
|
|
96
|
-
if
|
|
97
|
-
flt[i].header[
|
|
98
|
-
flt[i].header[
|
|
99
|
-
if
|
|
100
|
-
flt[i].header[
|
|
101
|
-
flt[i].header[
|
|
94
|
+
if "CRPIX1" in flt[i].header:
|
|
95
|
+
flt[i].header["crpix1"] = crpix1 + x1 - 1
|
|
96
|
+
flt[i].header["crpix2"] = crpix2 + y1 - 1
|
|
97
|
+
if "LTV1" in flt[i].header:
|
|
98
|
+
flt[i].header["ltv1"] = 0.0
|
|
99
|
+
flt[i].header["ltv2"] = 0.0
|
|
102
100
|
|
|
103
101
|
# set the header value of SUBARRAY to False since it's now
|
|
104
102
|
# regular size image
|
|
105
|
-
flt[0].header[
|
|
106
|
-
|
|
103
|
+
flt[0].header["SUBARRAY"] = False
|
|
104
|
+
|
|
107
105
|
# Now write out the SCI, ERR, DQ extensions to the full-chip file
|
|
108
|
-
flt[1].data = sci
|
|
106
|
+
flt[1].data = sci
|
|
109
107
|
flt[2].data = err
|
|
110
108
|
flt[3].data = dq
|
|
111
|
-
|
|
109
|
+
|
|
112
110
|
if not uvis:
|
|
113
111
|
flt[4].data = samp
|
|
114
|
-
flt[5].data = time
|
|
112
|
+
flt[5].data = time
|
|
115
113
|
|
|
116
114
|
flt.writeto(full, overwrite=False)
|
|
117
115
|
|
wfc3tools/pstack.py
CHANGED
|
@@ -42,16 +42,14 @@ Usage:
|
|
|
42
42
|
"""
|
|
43
43
|
|
|
44
44
|
# STDLIB
|
|
45
|
-
import os
|
|
46
|
-
from astropy.io import fits
|
|
47
45
|
import numpy as np
|
|
46
|
+
from astropy.io import fits
|
|
48
47
|
from matplotlib import pyplot as plt
|
|
49
48
|
|
|
50
49
|
plt.ion()
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
def pstack(filename, column=0, row=0, extname="sci", units="counts",
|
|
54
|
-
title=None, xlabel=None, ylabel=None, plot=True):
|
|
52
|
+
def pstack(filename, column=0, row=0, extname="sci", units="counts", title=None, xlabel=None, ylabel=None, plot=True):
|
|
55
53
|
"""
|
|
56
54
|
A function to plot the statistics of one pixels up the IR ramp image.
|
|
57
55
|
Original implementation in the iraf nicmos package. Pixel values here are
|
|
@@ -139,28 +137,28 @@ def pstack(filename, column=0, row=0, extname="sci", units="counts",
|
|
|
139
137
|
|
|
140
138
|
for i in range(1, nsamp, 1):
|
|
141
139
|
if time:
|
|
142
|
-
yaxis[i-1] = myfile["SCI", i].header[
|
|
140
|
+
yaxis[i - 1] = myfile["SCI", i].header["SAMPTIME"]
|
|
143
141
|
else:
|
|
144
142
|
# Numpy is row-major with array indices written row-first
|
|
145
143
|
# (lexicographical access order)
|
|
146
|
-
yaxis[i-1] = myfile[extname.upper(), i].data[row, column]
|
|
147
|
-
xaxis[i-1] = myfile["SCI", i].header[
|
|
144
|
+
yaxis[i - 1] = myfile[extname.upper(), i].data[row, column]
|
|
145
|
+
xaxis[i - 1] = myfile["SCI", i].header["SAMPTIME"]
|
|
148
146
|
|
|
149
147
|
# convert to countrate
|
|
150
148
|
if "rate" in units.lower() and "/" not in bunit.lower():
|
|
151
|
-
exptime = myfile["SCI", i].header[
|
|
152
|
-
yaxis[i-1] /= exptime
|
|
149
|
+
exptime = myfile["SCI", i].header["SAMPTIME"]
|
|
150
|
+
yaxis[i - 1] /= exptime
|
|
153
151
|
# convert to counts
|
|
154
152
|
if "counts" in units.lower() and "/" in bunit.lower():
|
|
155
|
-
exptime = myfile["SCI", i].header[
|
|
156
|
-
yaxis[i-1] *= exptime
|
|
153
|
+
exptime = myfile["SCI", i].header["SAMPTIME"]
|
|
154
|
+
yaxis[i - 1] *= exptime
|
|
157
155
|
|
|
158
156
|
if not ylabel:
|
|
159
157
|
if "rate" in units.lower():
|
|
160
158
|
if "/" in bunit.lower():
|
|
161
159
|
ylabel = bunit
|
|
162
160
|
else:
|
|
163
|
-
ylabel = bunit+" per second"
|
|
161
|
+
ylabel = bunit + " per second"
|
|
164
162
|
else:
|
|
165
163
|
if "/" in bunit:
|
|
166
164
|
stop_index = bunit.find("/")
|
|
@@ -177,8 +175,7 @@ def pstack(filename, column=0, row=0, extname="sci", units="counts",
|
|
|
177
175
|
plt.xlabel("Sample time")
|
|
178
176
|
|
|
179
177
|
if not title:
|
|
180
|
-
title = "%s Pixel stack for col=%d, row=%d" % (filename, column,
|
|
181
|
-
row)
|
|
178
|
+
title = "%s Pixel stack for col=%d, row=%d" % (filename, column, row)
|
|
182
179
|
plt.title(title)
|
|
183
180
|
|
|
184
181
|
if time:
|
wfc3tools/pstat.py
CHANGED
|
@@ -37,7 +37,7 @@ Usage:
|
|
|
37
37
|
Note that the arrays are structured in SCI order, so the final exposure is the first element in the array.
|
|
38
38
|
|
|
39
39
|
.. Warning::
|
|
40
|
-
The interface to this utility has been updated from previous versions and
|
|
40
|
+
The interface to this utility has been updated from previous versions and
|
|
41
41
|
is **not backwards compatible.** Here is an example to illustrate the "original"
|
|
42
42
|
syntax, the "original syntax corrected for row/column order", and finally the
|
|
43
43
|
"new" syntax which requires column and row sections to be specified as tuples.
|
|
@@ -56,17 +56,27 @@ Usage:
|
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
58
|
# STDLIB
|
|
59
|
-
import os
|
|
60
|
-
from astropy.io import fits
|
|
61
59
|
import numpy as np
|
|
60
|
+
from astropy.io import fits
|
|
62
61
|
from matplotlib import pyplot as plt
|
|
63
62
|
from scipy.stats import mode as mode
|
|
64
63
|
|
|
65
64
|
plt.ion()
|
|
66
65
|
|
|
67
66
|
|
|
68
|
-
def pstat(
|
|
69
|
-
|
|
67
|
+
def pstat(
|
|
68
|
+
filename,
|
|
69
|
+
col_slice=None,
|
|
70
|
+
row_slice=None,
|
|
71
|
+
extname="sci",
|
|
72
|
+
units="counts",
|
|
73
|
+
stat="midpt",
|
|
74
|
+
title=None,
|
|
75
|
+
xlabel=None,
|
|
76
|
+
ylabel=None,
|
|
77
|
+
plot=True,
|
|
78
|
+
overplot=False,
|
|
79
|
+
):
|
|
70
80
|
"""
|
|
71
81
|
A function to plot the statistics of one or more pixels up an IR ramp.
|
|
72
82
|
|
|
@@ -147,9 +157,9 @@ def pstat(filename, col_slice=None, row_slice=None, extname="sci", units="counts
|
|
|
147
157
|
bracket_loc = filename.find("[")
|
|
148
158
|
|
|
149
159
|
# get the base filename and strip off any extra information as necessary
|
|
150
|
-
if
|
|
160
|
+
if bracket_loc < 0:
|
|
151
161
|
imagename = filename
|
|
152
|
-
elif
|
|
162
|
+
elif bracket_loc > 0:
|
|
153
163
|
imagename = filename[:bracket_loc]
|
|
154
164
|
print("Any extension name or image section must be specified via parameters.")
|
|
155
165
|
print("Input filename has been stripped of data in brackets, %s" % (imagename))
|
|
@@ -169,14 +179,14 @@ def pstat(filename, col_slice=None, row_slice=None, extname="sci", units="counts
|
|
|
169
179
|
all_cols = False
|
|
170
180
|
if not col_slice:
|
|
171
181
|
all_cols = True
|
|
172
|
-
elif not(isinstance(col_slice, tuple) and len(col_slice) == 2 and all(isinstance(val, int) for val in col_slice)):
|
|
182
|
+
elif not (isinstance(col_slice, tuple) and len(col_slice) == 2 and all(isinstance(val, int) for val in col_slice)):
|
|
173
183
|
print("Invalid specification for col_slice which must be a tuple of two integer values.")
|
|
174
184
|
return 0, 0
|
|
175
185
|
|
|
176
186
|
all_rows = False
|
|
177
187
|
if not row_slice:
|
|
178
188
|
all_rows = True
|
|
179
|
-
elif not(isinstance(row_slice, tuple) and len(row_slice) == 2 and all(isinstance(val, int) for val in row_slice)):
|
|
189
|
+
elif not (isinstance(row_slice, tuple) and len(row_slice) == 2 and all(isinstance(val, int) for val in row_slice)):
|
|
180
190
|
print("Invalid specification for row_slice which must be a tuple of two integer values.")
|
|
181
191
|
return 0, 0
|
|
182
192
|
|
|
@@ -207,33 +217,32 @@ def pstat(filename, col_slice=None, row_slice=None, extname="sci", units="counts
|
|
|
207
217
|
|
|
208
218
|
for i in range(1, nsamp, 1):
|
|
209
219
|
if "midpt" in stat:
|
|
210
|
-
yaxis[i-1] = np.median(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
220
|
+
yaxis[i - 1] = np.median(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
211
221
|
|
|
212
222
|
if "mean" in stat:
|
|
213
|
-
yaxis[i-1] = np.mean(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
223
|
+
yaxis[i - 1] = np.mean(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
214
224
|
|
|
215
225
|
if "mode" in stat:
|
|
216
|
-
yaxis[i-1] = mode(myfile[extname.upper(), i].data[ystart:yend, xstart:xend],
|
|
217
|
-
axis=None)[0]
|
|
226
|
+
yaxis[i - 1] = mode(myfile[extname.upper(), i].data[ystart:yend, xstart:xend], axis=None)[0]
|
|
218
227
|
|
|
219
228
|
if "min" in stat:
|
|
220
|
-
yaxis[i-1] = np.min(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
229
|
+
yaxis[i - 1] = np.min(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
221
230
|
|
|
222
231
|
if "max" in stat:
|
|
223
|
-
yaxis[i-1] = np.max(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
232
|
+
yaxis[i - 1] = np.max(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
224
233
|
|
|
225
234
|
if "stddev" in stat:
|
|
226
|
-
yaxis[i-1] = np.std(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
235
|
+
yaxis[i - 1] = np.std(myfile[extname.upper(), i].data[ystart:yend, xstart:xend])
|
|
227
236
|
|
|
228
|
-
exptime = myfile["SCI", i].header[
|
|
229
|
-
xaxis[i-1] = exptime
|
|
237
|
+
exptime = myfile["SCI", i].header["SAMPTIME"]
|
|
238
|
+
xaxis[i - 1] = exptime
|
|
230
239
|
|
|
231
240
|
# convert to countrate
|
|
232
241
|
if "rate" in units.lower() and "/" not in bunit.lower():
|
|
233
|
-
yaxis[i-1] /= exptime
|
|
242
|
+
yaxis[i - 1] /= exptime
|
|
234
243
|
# convert to counts
|
|
235
244
|
if "counts" in units.lower() and "/" in bunit.lower():
|
|
236
|
-
yaxis[i-1] *= exptime
|
|
245
|
+
yaxis[i - 1] *= exptime
|
|
237
246
|
|
|
238
247
|
if plot:
|
|
239
248
|
if not overplot:
|
|
@@ -251,15 +260,14 @@ def pstat(filename, col_slice=None, row_slice=None, extname="sci", units="counts
|
|
|
251
260
|
else:
|
|
252
261
|
ylabel = bunit
|
|
253
262
|
|
|
254
|
-
ylabel +=
|
|
263
|
+
ylabel += " %s" % (stat)
|
|
255
264
|
plt.ylabel(ylabel)
|
|
256
265
|
|
|
257
266
|
if not xlabel:
|
|
258
267
|
plt.xlabel("Sample time (s)")
|
|
259
268
|
|
|
260
269
|
if not title:
|
|
261
|
-
title = "%s Pixel stats for [%d:%d,%d:%d]" % (imagename, xstart,
|
|
262
|
-
xend, ystart, yend)
|
|
270
|
+
title = "%s Pixel stats for [%d:%d,%d:%d]" % (imagename, xstart, xend, ystart, yend)
|
|
263
271
|
plt.title(title)
|
|
264
272
|
plt.plot(xaxis, yaxis, "+")
|
|
265
273
|
plt.draw()
|
wfc3tools/sampinfo.py
CHANGED
|
@@ -74,9 +74,9 @@ Usage:
|
|
|
74
74
|
"""
|
|
75
75
|
|
|
76
76
|
# STDLIB
|
|
77
|
-
|
|
78
|
-
import os
|
|
77
|
+
|
|
79
78
|
import numpy as np
|
|
79
|
+
from astropy.io import fits
|
|
80
80
|
|
|
81
81
|
# STSCI
|
|
82
82
|
from stsci.tools import parseinput
|
|
@@ -132,11 +132,11 @@ def sampinfo(imagelist, add_keys=None, mean=False, median=False):
|
|
|
132
132
|
ir_list += add_keys
|
|
133
133
|
|
|
134
134
|
# measure the min and max data
|
|
135
|
-
if
|
|
136
|
-
if
|
|
137
|
-
if
|
|
135
|
+
if mean:
|
|
136
|
+
if add_keys:
|
|
137
|
+
if "DATAMIN" not in add_keys:
|
|
138
138
|
ir_list += ["DATAMIN"]
|
|
139
|
-
if
|
|
139
|
+
if "DATAMAX" not in add_keys:
|
|
140
140
|
ir_list += ["DATAMAX"]
|
|
141
141
|
else:
|
|
142
142
|
ir_list += ["DATAMIN", "DATAMAX"]
|
|
@@ -155,19 +155,18 @@ def sampinfo(imagelist, add_keys=None, mean=False, median=False):
|
|
|
155
155
|
samp_seq = header0["SAMP_SEQ"]
|
|
156
156
|
|
|
157
157
|
print("IMAGE\t\t\tNEXTEND\tSAMP_SEQ\tNSAMP\tEXPTIME")
|
|
158
|
-
print("%s\t%d\t%s\t\t%d\t%f\n" % (image, nextend, samp_seq,
|
|
159
|
-
nsamp, exptime))
|
|
158
|
+
print("%s\t%d\t%s\t\t%d\t%f\n" % (image, nextend, samp_seq, nsamp, exptime))
|
|
160
159
|
printline = "IMSET\tSAMPNUM"
|
|
161
160
|
|
|
162
161
|
for key in ir_list:
|
|
163
|
-
printline +=
|
|
162
|
+
printline += "\t" + key
|
|
164
163
|
print(printline)
|
|
165
164
|
|
|
166
165
|
# loop through all the samples for the image and print stuff as we go
|
|
167
|
-
for samp in range(1, nsamp+1, 1):
|
|
166
|
+
for samp in range(1, nsamp + 1, 1):
|
|
168
167
|
printline = ""
|
|
169
168
|
printline += str(samp)
|
|
170
|
-
printline +=
|
|
169
|
+
printline += "\t" + str(nsamp - samp)
|
|
171
170
|
for key in ir_list:
|
|
172
171
|
if "DATAMIN" in key:
|
|
173
172
|
datamin = True
|
|
@@ -176,16 +175,15 @@ def sampinfo(imagelist, add_keys=None, mean=False, median=False):
|
|
|
176
175
|
datamax = True
|
|
177
176
|
datamaxval = np.max(current["SCI", samp].data)
|
|
178
177
|
try:
|
|
179
|
-
printline +=
|
|
178
|
+
printline += "\t" + str(current["SCI", samp].header[key])
|
|
180
179
|
except KeyError:
|
|
181
180
|
try:
|
|
182
|
-
printline +=
|
|
181
|
+
printline += "\t" + str(current[0].header[key])
|
|
183
182
|
except KeyError as e:
|
|
184
|
-
printline +=
|
|
185
|
-
if
|
|
186
|
-
printline +=
|
|
187
|
-
if
|
|
188
|
-
printline +=
|
|
189
|
-
samp].data)))
|
|
183
|
+
printline += "\tNA"
|
|
184
|
+
if datamin and datamax:
|
|
185
|
+
printline += "\tAvgPixel: " + str((dataminval + datamaxval) / 2.0)
|
|
186
|
+
if median:
|
|
187
|
+
printline += "\tMedPixel: " + str(np.median(current["SCI", samp].data))
|
|
190
188
|
print(printline)
|
|
191
189
|
current.close()
|
wfc3tools/sub2full.py
CHANGED
|
@@ -36,8 +36,9 @@ Usage:
|
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
38
|
# STDLIB
|
|
39
|
-
from astropy.io import fits
|
|
40
39
|
import os
|
|
40
|
+
|
|
41
|
+
from astropy.io import fits
|
|
41
42
|
from stsci.tools import parseinput
|
|
42
43
|
|
|
43
44
|
|
|
@@ -90,8 +91,7 @@ def sub2full(filename, x=None, y=None, fullExtent=False):
|
|
|
90
91
|
coords = list()
|
|
91
92
|
|
|
92
93
|
for f in infiles:
|
|
93
|
-
spt = os.path.join(os.path.dirname(f), os.path.basename(f)[0:9] +
|
|
94
|
-
'_spt.fits')
|
|
94
|
+
spt = os.path.join(os.path.dirname(f), os.path.basename(f)[0:9] + "_spt.fits")
|
|
95
95
|
uvis_x_size = 2051
|
|
96
96
|
serial_over = 25.0
|
|
97
97
|
ir_overscan = 5.0
|
|
@@ -100,16 +100,16 @@ def sub2full(filename, x=None, y=None, fullExtent=False):
|
|
|
100
100
|
try:
|
|
101
101
|
fd2 = fits.open(spt)
|
|
102
102
|
except (ValueError, IOError) as e:
|
|
103
|
-
raise ValueError(
|
|
103
|
+
raise ValueError("%s " % (e))
|
|
104
104
|
|
|
105
105
|
# check for required keywords and close the images
|
|
106
106
|
try:
|
|
107
|
-
detector = fd2[0].header[
|
|
108
|
-
subarray = fd2[0].header[
|
|
109
|
-
xcorner = int(fd2[1].header[
|
|
110
|
-
ycorner = int(fd2[1].header[
|
|
111
|
-
numrows = int(fd2[1].header[
|
|
112
|
-
numcols = int(fd2[1].header[
|
|
107
|
+
detector = fd2[0].header["SS_DTCTR"]
|
|
108
|
+
subarray = fd2[0].header["SS_SUBAR"]
|
|
109
|
+
xcorner = int(fd2[1].header["XCORNER"])
|
|
110
|
+
ycorner = int(fd2[1].header["YCORNER"])
|
|
111
|
+
numrows = int(fd2[1].header["NUMROWS"])
|
|
112
|
+
numcols = int(fd2[1].header["NUMCOLS"])
|
|
113
113
|
fd2.close()
|
|
114
114
|
except KeyError as e:
|
|
115
115
|
raise KeyError(f"Required header keyword missing: {e}")
|
|
@@ -120,7 +120,7 @@ def sub2full(filename, x=None, y=None, fullExtent=False):
|
|
|
120
120
|
sizaxis1 = numcols
|
|
121
121
|
sizaxis2 = numrows
|
|
122
122
|
|
|
123
|
-
if
|
|
123
|
+
if xcorner == 0 and ycorner == 0:
|
|
124
124
|
cornera1 = 0
|
|
125
125
|
cornera2 = 0
|
|
126
126
|
cornera1a = cornera1 + 1
|
|
@@ -128,7 +128,7 @@ def sub2full(filename, x=None, y=None, fullExtent=False):
|
|
|
128
128
|
cornera2a = cornera2 + 1
|
|
129
129
|
cornera2b = cornera2a + sizaxis2 - 1
|
|
130
130
|
else:
|
|
131
|
-
if
|
|
131
|
+
if "UVIS" in detector:
|
|
132
132
|
cornera1 = ycorner
|
|
133
133
|
cornera2 = uvis_x_size - xcorner - sizaxis2
|
|
134
134
|
if xcorner >= uvis_x_size:
|
|
@@ -152,17 +152,16 @@ def sub2full(filename, x=None, y=None, fullExtent=False):
|
|
|
152
152
|
cornera2a = cornera2 + 1
|
|
153
153
|
cornera2b = cornera2a + sizaxis2 - 11
|
|
154
154
|
|
|
155
|
-
if
|
|
156
|
-
if
|
|
155
|
+
if x or y:
|
|
156
|
+
if not isinstance(x, int) or (not isinstance(y, int)):
|
|
157
157
|
raise ValueError("Must input integer value for x and y ")
|
|
158
158
|
else:
|
|
159
159
|
cornera1a = cornera1a + x
|
|
160
160
|
cornera2a = cornera2a + y
|
|
161
161
|
fullExtent = False
|
|
162
162
|
|
|
163
|
-
if
|
|
164
|
-
coords.append((int(cornera1a), int(cornera1b), int(cornera2a),
|
|
165
|
-
int(cornera2b)))
|
|
163
|
+
if fullExtent:
|
|
164
|
+
coords.append((int(cornera1a), int(cornera1b), int(cornera2a), int(cornera2b)))
|
|
166
165
|
else:
|
|
167
166
|
coords.append((int(cornera1a), int(cornera2a)))
|
|
168
167
|
|
wfc3tools/util.py
CHANGED
|
@@ -7,50 +7,54 @@ __all__ = ["display_help"]
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def display_help():
|
|
10
|
-
"""
|
|
11
|
-
url = "
|
|
10
|
+
"""display local html help in a browser window"""
|
|
11
|
+
url = "https://wfc3tools.readthedocs.io/"
|
|
12
12
|
print(url)
|
|
13
13
|
try:
|
|
14
14
|
import webbrowser
|
|
15
|
+
|
|
15
16
|
# grab the version that's installed
|
|
16
|
-
if "dev" not in version(
|
|
17
|
-
url += "en/{0:s}/".format(version(
|
|
17
|
+
if "dev" not in version("wfc3tools"):
|
|
18
|
+
url += "en/{0:s}/".format(version("wfc3tools"))
|
|
18
19
|
webbrowser.open(url)
|
|
19
20
|
except ImportError:
|
|
20
|
-
warnings.warn(
|
|
21
|
-
|
|
21
|
+
warnings.warn(
|
|
22
|
+
"webbrowser module not installed, see {0:s} help \
|
|
23
|
+
pages".format(url)
|
|
24
|
+
)
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
def error_code(code=None):
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
codes = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
28
|
+
"""return the error code text, or all if code is None."""
|
|
29
|
+
|
|
30
|
+
codes = {
|
|
31
|
+
2: "ERROR_RETURN",
|
|
32
|
+
111: "OUT_OF_MEMORY",
|
|
33
|
+
114: "OPEN_FAILED",
|
|
34
|
+
115: "CAL_FILE_MISSING",
|
|
35
|
+
116: "NOTHIN_TO_DO",
|
|
36
|
+
117: "KEYWORD_MISSING",
|
|
37
|
+
118: "ALLOCATION_PROBLEM",
|
|
38
|
+
119: "HEADER_PROBLEM",
|
|
39
|
+
120: "SIZE_MISMATCH",
|
|
40
|
+
130: "CAL_STEP_NOT_DONE",
|
|
41
|
+
141: "TABLE_ERROR",
|
|
42
|
+
142: "COLUMN_NOT_FOUND",
|
|
43
|
+
143: "ELEMENT_NOT_FOUND",
|
|
44
|
+
144: "ROW_NOT_FOUND",
|
|
45
|
+
151: "NO_GOOD_DATA",
|
|
46
|
+
152: "NO_CHIP_FOUND",
|
|
47
|
+
171: "REF_TOO_SMALL",
|
|
48
|
+
999: "INTERNAL_ERROR",
|
|
49
|
+
1001: "INVALID_EXPTIME",
|
|
50
|
+
1011: "INVALID_FILENAME",
|
|
51
|
+
1020: "WRITE_FAILED",
|
|
52
|
+
1021: "INVALID_TEMP_FILE",
|
|
53
|
+
1023: "FILE_NOT_READABLE",
|
|
54
|
+
1025: "COPY_NOT_POSSIBLE",
|
|
55
|
+
1111: "INVALID_VALUE",
|
|
56
|
+
1030: "UNSUPPORTED_APERTURE",
|
|
57
|
+
}
|
|
54
58
|
|
|
55
59
|
if code is None:
|
|
56
60
|
return codes
|
wfc3tools/version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.6.
|
|
32
|
-
__version_tuple__ = version_tuple = (1, 6,
|
|
31
|
+
__version__ = version = '1.6.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 6, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'gd6931c975'
|
wfc3tools/wf32d.py
CHANGED
|
@@ -40,12 +40,23 @@ import subprocess
|
|
|
40
40
|
|
|
41
41
|
# STSCI
|
|
42
42
|
from stsci.tools import parseinput
|
|
43
|
+
|
|
43
44
|
from .util import error_code
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
def wf32d(
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
def wf32d(
|
|
48
|
+
input,
|
|
49
|
+
output=None,
|
|
50
|
+
dqicorr="PERFORM",
|
|
51
|
+
darkcorr="PERFORM",
|
|
52
|
+
flatcorr="PERFORM",
|
|
53
|
+
shadcorr="PERFORM",
|
|
54
|
+
photcorr="PERFORM",
|
|
55
|
+
verbose=False,
|
|
56
|
+
quiet=True,
|
|
57
|
+
debug=False,
|
|
58
|
+
log_func=print,
|
|
59
|
+
):
|
|
49
60
|
"""
|
|
50
61
|
Call the wf32d.e executable.
|
|
51
62
|
|
|
@@ -115,29 +126,29 @@ def wf32d(input, output=None, dqicorr="PERFORM", darkcorr="PERFORM",
|
|
|
115
126
|
|
|
116
127
|
"""
|
|
117
128
|
|
|
118
|
-
call_list = [
|
|
129
|
+
call_list = ["wf32d.e"]
|
|
119
130
|
return_code = None
|
|
120
131
|
|
|
121
132
|
if verbose:
|
|
122
|
-
call_list += [
|
|
133
|
+
call_list += ["-v", "-t"]
|
|
123
134
|
|
|
124
135
|
if debug:
|
|
125
|
-
call_list.append(
|
|
136
|
+
call_list.append("-d")
|
|
126
137
|
|
|
127
|
-
if
|
|
128
|
-
call_list.append(
|
|
138
|
+
if darkcorr == "PERFORM":
|
|
139
|
+
call_list.append("-dark")
|
|
129
140
|
|
|
130
|
-
if
|
|
131
|
-
call_list.append(
|
|
141
|
+
if dqicorr == "PERFORM":
|
|
142
|
+
call_list.append("-dqi")
|
|
132
143
|
|
|
133
|
-
if
|
|
134
|
-
call_list.append(
|
|
144
|
+
if flatcorr == "PERFORM":
|
|
145
|
+
call_list.append("-flat")
|
|
135
146
|
|
|
136
|
-
if
|
|
137
|
-
call_list.append(
|
|
147
|
+
if shadcorr == "PERFORM":
|
|
148
|
+
call_list.append("-shad")
|
|
138
149
|
|
|
139
|
-
if
|
|
140
|
-
call_list.append(
|
|
150
|
+
if photcorr == "PERFORM":
|
|
151
|
+
call_list.append("-phot")
|
|
141
152
|
|
|
142
153
|
infiles, dummy = parseinput.parseinput(input)
|
|
143
154
|
if "_asn" in input:
|
|
@@ -145,8 +156,7 @@ def wf32d(input, output=None, dqicorr="PERFORM", darkcorr="PERFORM",
|
|
|
145
156
|
if len(parseinput.irafglob(input)) == 0:
|
|
146
157
|
raise IOError("No valid image specified")
|
|
147
158
|
if len(parseinput.irafglob(input)) > 1:
|
|
148
|
-
raise IOError("wf32d can only accept 1 file
|
|
149
|
-
"input at a time: {0}".format(infiles))
|
|
159
|
+
raise IOError("wf32d can only accept 1 file forinput at a time: {0}".format(infiles))
|
|
150
160
|
|
|
151
161
|
for image in infiles:
|
|
152
162
|
if not os.path.exists(image):
|
|
@@ -164,7 +174,7 @@ def wf32d(input, output=None, dqicorr="PERFORM", darkcorr="PERFORM",
|
|
|
164
174
|
)
|
|
165
175
|
if log_func is not None:
|
|
166
176
|
for line in proc.stdout:
|
|
167
|
-
log_func(line.decode(
|
|
177
|
+
log_func(line.decode("utf8"))
|
|
168
178
|
|
|
169
179
|
return_code = proc.wait()
|
|
170
180
|
ec = error_code(return_code)
|
wfc3tools/wf3ccd.py
CHANGED
|
@@ -48,12 +48,22 @@ import subprocess
|
|
|
48
48
|
|
|
49
49
|
# STSCI
|
|
50
50
|
from stsci.tools import parseinput
|
|
51
|
+
|
|
51
52
|
from .util import error_code
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
def wf3ccd(
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
def wf3ccd(
|
|
56
|
+
input,
|
|
57
|
+
output=None,
|
|
58
|
+
dqicorr="PERFORM",
|
|
59
|
+
atodcorr="PERFORM",
|
|
60
|
+
blevcorr="PERFORM",
|
|
61
|
+
biascorr="PERFORM",
|
|
62
|
+
flashcorr="PERFORM",
|
|
63
|
+
verbose=False,
|
|
64
|
+
quiet=True,
|
|
65
|
+
log_func=print,
|
|
66
|
+
):
|
|
57
67
|
"""
|
|
58
68
|
Run the ``wf3ccd.e`` executable as from the shell.
|
|
59
69
|
|
|
@@ -114,26 +124,26 @@ def wf3ccd(input, output=None, dqicorr="PERFORM", atodcorr="PERFORM",
|
|
|
114
124
|
|
|
115
125
|
"""
|
|
116
126
|
|
|
117
|
-
call_list = [
|
|
127
|
+
call_list = ["wf3ccd.e"]
|
|
118
128
|
return_code = None
|
|
119
129
|
|
|
120
130
|
if verbose:
|
|
121
|
-
call_list += [
|
|
131
|
+
call_list += ["-v", "-t"]
|
|
122
132
|
|
|
123
|
-
if
|
|
124
|
-
call_list.append(
|
|
133
|
+
if dqicorr == "PERFORM":
|
|
134
|
+
call_list.append("-dqi")
|
|
125
135
|
|
|
126
|
-
if
|
|
127
|
-
call_list.append(
|
|
136
|
+
if atodcorr == "PERFORM":
|
|
137
|
+
call_list.append("-atod")
|
|
128
138
|
|
|
129
|
-
if
|
|
130
|
-
call_list.append(
|
|
139
|
+
if blevcorr == "PERFORM":
|
|
140
|
+
call_list.append("-blev")
|
|
131
141
|
|
|
132
|
-
if
|
|
133
|
-
call_list.append(
|
|
142
|
+
if biascorr == "PERFORM":
|
|
143
|
+
call_list.append("-bias")
|
|
134
144
|
|
|
135
|
-
if
|
|
136
|
-
call_list.append(
|
|
145
|
+
if flashcorr == "PERFORM":
|
|
146
|
+
call_list.append("-flash")
|
|
137
147
|
|
|
138
148
|
infiles, dummy = parseinput.parseinput(input)
|
|
139
149
|
if "_asn" in input:
|
|
@@ -141,8 +151,7 @@ def wf3ccd(input, output=None, dqicorr="PERFORM", atodcorr="PERFORM",
|
|
|
141
151
|
if len(parseinput.irafglob(input)) == 0:
|
|
142
152
|
raise IOError("No valid image specified")
|
|
143
153
|
if len(parseinput.irafglob(input)) > 1:
|
|
144
|
-
raise IOError("wf3ccd can only accept 1 file
|
|
145
|
-
"input at a time: {0}".format(infiles))
|
|
154
|
+
raise IOError("wf3ccd can only accept 1 file forinput at a time: {0}".format(infiles))
|
|
146
155
|
|
|
147
156
|
for image in infiles:
|
|
148
157
|
if not os.path.exists(image):
|
|
@@ -160,7 +169,7 @@ def wf3ccd(input, output=None, dqicorr="PERFORM", atodcorr="PERFORM",
|
|
|
160
169
|
)
|
|
161
170
|
if log_func is not None:
|
|
162
171
|
for line in proc.stdout:
|
|
163
|
-
log_func(line.decode(
|
|
172
|
+
log_func(line.decode("utf8"))
|
|
164
173
|
|
|
165
174
|
return_code = proc.wait()
|
|
166
175
|
ec = error_code(return_code)
|
wfc3tools/wf3cte.py
CHANGED
|
@@ -14,7 +14,6 @@ wf3cte:
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
# STDLIB
|
|
17
|
-
import os.path
|
|
18
17
|
import subprocess
|
|
19
18
|
|
|
20
19
|
# STSCI
|
|
@@ -61,16 +60,16 @@ def wf3cte(input, parallel=True, verbose=False, log_func=print):
|
|
|
61
60
|
|
|
62
61
|
"""
|
|
63
62
|
|
|
64
|
-
call_list = [
|
|
63
|
+
call_list = ["wf3cte.e"]
|
|
65
64
|
|
|
66
65
|
if verbose:
|
|
67
|
-
call_list.append(
|
|
66
|
+
call_list.append("-v")
|
|
68
67
|
|
|
69
68
|
if not parallel:
|
|
70
|
-
call_list.append(
|
|
69
|
+
call_list.append("-1")
|
|
71
70
|
|
|
72
71
|
infiles, dummy_out = parseinput.parseinput(input)
|
|
73
|
-
call_list.append(
|
|
72
|
+
call_list.append(",".join(infiles))
|
|
74
73
|
|
|
75
74
|
print(call_list)
|
|
76
75
|
|
|
@@ -81,7 +80,7 @@ def wf3cte(input, parallel=True, verbose=False, log_func=print):
|
|
|
81
80
|
)
|
|
82
81
|
if log_func is not None:
|
|
83
82
|
for line in proc.stdout:
|
|
84
|
-
log_func(line.decode(
|
|
83
|
+
log_func(line.decode("utf8"))
|
|
85
84
|
|
|
86
85
|
return_code = proc.wait()
|
|
87
86
|
if return_code != 0:
|
wfc3tools/wf3ir.py
CHANGED
|
@@ -42,6 +42,7 @@ import subprocess
|
|
|
42
42
|
|
|
43
43
|
# STSCI
|
|
44
44
|
from stsci.tools import parseinput
|
|
45
|
+
|
|
45
46
|
from .util import error_code
|
|
46
47
|
|
|
47
48
|
|
|
@@ -96,11 +97,11 @@ def wf3ir(input, output=None, verbose=False, quiet=True, log_func=print):
|
|
|
96
97
|
|
|
97
98
|
"""
|
|
98
99
|
|
|
99
|
-
call_list = [
|
|
100
|
+
call_list = ["wf3ir.e"]
|
|
100
101
|
return_code = None
|
|
101
102
|
|
|
102
103
|
if verbose:
|
|
103
|
-
call_list += [
|
|
104
|
+
call_list += ["-v", "-t"]
|
|
104
105
|
|
|
105
106
|
infiles, dummy = parseinput.parseinput(input)
|
|
106
107
|
if "_asn" in input:
|
|
@@ -108,8 +109,7 @@ def wf3ir(input, output=None, verbose=False, quiet=True, log_func=print):
|
|
|
108
109
|
if len(parseinput.irafglob(input)) == 0:
|
|
109
110
|
raise IOError("No valid image specified")
|
|
110
111
|
if len(parseinput.irafglob(input)) > 1:
|
|
111
|
-
raise IOError("wf3ir can only accept 1 file
|
|
112
|
-
"input at a time: {0}".format(infiles))
|
|
112
|
+
raise IOError("wf3ir can only accept 1 file forinput at a time: {0}".format(infiles))
|
|
113
113
|
|
|
114
114
|
for image in infiles:
|
|
115
115
|
if not os.path.exists(image):
|
|
@@ -127,7 +127,7 @@ def wf3ir(input, output=None, verbose=False, quiet=True, log_func=print):
|
|
|
127
127
|
)
|
|
128
128
|
if log_func is not None:
|
|
129
129
|
for line in proc.stdout:
|
|
130
|
-
log_func(line.decode(
|
|
130
|
+
log_func(line.decode("utf8"))
|
|
131
131
|
|
|
132
132
|
return_code = proc.wait()
|
|
133
133
|
ec = error_code(return_code)
|
wfc3tools/wf3rej.py
CHANGED
|
@@ -39,13 +39,26 @@ import subprocess
|
|
|
39
39
|
|
|
40
40
|
# STSCI
|
|
41
41
|
from stsci.tools import parseinput
|
|
42
|
+
|
|
42
43
|
from .util import error_code
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
def wf3rej(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
def wf3rej(
|
|
47
|
+
input,
|
|
48
|
+
output,
|
|
49
|
+
crrejtab="",
|
|
50
|
+
scalense=0.0,
|
|
51
|
+
initgues="",
|
|
52
|
+
skysub="",
|
|
53
|
+
crsigmas="",
|
|
54
|
+
crradius=0.0,
|
|
55
|
+
crthresh=0.0,
|
|
56
|
+
badinpdq=0,
|
|
57
|
+
crmask=False,
|
|
58
|
+
shadcorr=False,
|
|
59
|
+
verbose=False,
|
|
60
|
+
log_func=print,
|
|
61
|
+
):
|
|
49
62
|
"""
|
|
50
63
|
wf3rej, the cosmic-ray rejection and image combination task in calwf3,
|
|
51
64
|
combines CR-SPLIT or REPEAT-OBS exposures into a single image, first
|
|
@@ -136,7 +149,7 @@ def wf3rej(input, output, crrejtab="", scalense=0., initgues="",
|
|
|
136
149
|
raise IOError("Input file not found: {0}".format(image))
|
|
137
150
|
|
|
138
151
|
# Generate a comma-separated string of the input filenames
|
|
139
|
-
input =
|
|
152
|
+
input = ",".join(infiles)
|
|
140
153
|
|
|
141
154
|
call_list.append(input)
|
|
142
155
|
|
|
@@ -147,46 +160,46 @@ def wf3rej(input, output, crrejtab="", scalense=0., initgues="",
|
|
|
147
160
|
call_list.append("-v")
|
|
148
161
|
call_list.append("-t")
|
|
149
162
|
|
|
150
|
-
if
|
|
163
|
+
if shadcorr:
|
|
151
164
|
call_list.append("-shadcorr")
|
|
152
165
|
|
|
153
|
-
if
|
|
166
|
+
if crmask:
|
|
154
167
|
call_list.append("-crmask")
|
|
155
168
|
|
|
156
|
-
if
|
|
169
|
+
if crrejtab != "":
|
|
157
170
|
call_list += ["-table", crrejtab]
|
|
158
171
|
|
|
159
|
-
if
|
|
172
|
+
if scalense != "":
|
|
160
173
|
call_list += ["-scale", str(scalense)]
|
|
161
174
|
|
|
162
|
-
if
|
|
175
|
+
if initgues != "":
|
|
163
176
|
options = ["min", "med"]
|
|
164
177
|
if initgues not in options:
|
|
165
178
|
raise ValueError("Invalid option for initgues")
|
|
166
179
|
else:
|
|
167
180
|
call_list += ["-init", str(initgues)]
|
|
168
181
|
|
|
169
|
-
if
|
|
182
|
+
if skysub != "":
|
|
170
183
|
options = ["none", "mode", "median"]
|
|
171
184
|
if skysub not in options:
|
|
172
185
|
raise ValueError(f"Invalid skysub option {options}: {skysub}")
|
|
173
186
|
else:
|
|
174
187
|
call_list += ["-sky", str(skysub)]
|
|
175
188
|
|
|
176
|
-
if
|
|
189
|
+
if crsigmas != "":
|
|
177
190
|
call_list += ["-sigmas", str(crsigmas)]
|
|
178
191
|
|
|
179
|
-
if
|
|
192
|
+
if crradius >= 0.0:
|
|
180
193
|
call_list += ["-radius", str(crradius)]
|
|
181
194
|
else:
|
|
182
195
|
raise ValueError("Invalid crradius specified")
|
|
183
196
|
|
|
184
|
-
if
|
|
197
|
+
if crthresh >= 0.0:
|
|
185
198
|
call_list += ["-thresh", str(crthresh)]
|
|
186
199
|
else:
|
|
187
200
|
raise ValueError("Invalid crthresh specified")
|
|
188
201
|
|
|
189
|
-
if
|
|
202
|
+
if badinpdq >= 0:
|
|
190
203
|
call_list += ["-pdq", str(badinpdq)]
|
|
191
204
|
|
|
192
205
|
else:
|
|
@@ -199,7 +212,7 @@ def wf3rej(input, output, crrejtab="", scalense=0., initgues="",
|
|
|
199
212
|
)
|
|
200
213
|
if log_func is not None:
|
|
201
214
|
for line in proc.stdout:
|
|
202
|
-
log_func(line.decode(
|
|
215
|
+
log_func(line.decode("utf8"))
|
|
203
216
|
|
|
204
217
|
return_code = proc.wait()
|
|
205
218
|
ec = error_code(return_code)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wfc3tools
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: Python Tools for HST WFC3 Data
|
|
5
5
|
Author: STScI
|
|
6
6
|
Project-URL: Homepage, http://wfc3tools.readthedocs.io/
|
|
@@ -23,31 +23,30 @@ Requires-Dist: scipy>=1.8.0
|
|
|
23
23
|
Provides-Extra: tests
|
|
24
24
|
Requires-Dist: pytest; extra == "tests"
|
|
25
25
|
Requires-Dist: astroquery; extra == "tests"
|
|
26
|
+
Requires-Dist: ci-watson; extra == "tests"
|
|
26
27
|
Provides-Extra: docs
|
|
27
28
|
Requires-Dist: sphinx; extra == "docs"
|
|
28
29
|
Requires-Dist: sphinx-automodapi; extra == "docs"
|
|
29
|
-
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
30
|
+
Requires-Dist: sphinx-rtd-theme>1.2.0; extra == "docs"
|
|
30
31
|
Dynamic: license-file
|
|
31
32
|
|
|
32
33
|
WFC3TOOLS
|
|
33
34
|
=========
|
|
34
35
|
|
|
36
|
+
.. image:: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml/badge.svg?branch=main
|
|
37
|
+
:target: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml
|
|
38
|
+
:alt: tests
|
|
39
|
+
|
|
35
40
|
.. image:: https://readthedocs.org/projects/wfc3tools/badge/?version=latest
|
|
36
|
-
:target:
|
|
41
|
+
:target: https://wfc3tools.readthedocs.io/en/latest/?badge=latest
|
|
37
42
|
:alt: Documentation Status
|
|
38
43
|
|
|
39
|
-
.. image::
|
|
40
|
-
:target:
|
|
44
|
+
.. image:: https://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
|
|
45
|
+
:target: https://www.astropy.org
|
|
41
46
|
:alt: Powered by Astropy Badge
|
|
42
47
|
|
|
43
48
|
|
|
44
|
-
For more information please see the `online documentation <
|
|
45
|
-
|
|
46
|
-
You can also display the docs locally after install, import ``wfc3tools`` and then issue the following command to display the help docs in your local browser:
|
|
47
|
-
|
|
48
|
-
::
|
|
49
|
-
|
|
50
|
-
wfc3tools.display_help()
|
|
49
|
+
For more information please see the `online documentation <https://wfc3tools.readthedocs.io/>`_.
|
|
51
50
|
|
|
52
51
|
To install using pip:
|
|
53
52
|
|
|
@@ -73,19 +72,11 @@ or haven't used github before, please feel free to contact `HST Help Desk <https
|
|
|
73
72
|
Feedback and feature requests? Is there something missing you would like
|
|
74
73
|
to see? Please open an issue or contact `HST Help Desk <https://stsci.service-now.com/hst>`_.
|
|
75
74
|
|
|
76
|
-
``wfc3tools`` follows the
|
|
75
|
+
``wfc3tools`` follows the STScI Code of Conduct and strives to provide a
|
|
77
76
|
welcoming community to all of our users and contributors.
|
|
78
77
|
|
|
79
|
-
Want more information about how to make a contribution? Take a look at
|
|
80
|
-
the the astropy `contributing`_ and `developer`_ documentation.
|
|
81
|
-
|
|
82
78
|
|
|
83
79
|
License
|
|
84
80
|
-------
|
|
85
81
|
|
|
86
82
|
``wfc3tools`` is licensed under a 3-clause BSD style license (see the ``LICENSE.txt`` file).
|
|
87
|
-
|
|
88
|
-
.. _AstroPy: http://www.astropy.org/
|
|
89
|
-
.. _contributing: http://docs.astropy.org/en/stable/index.html#contributing
|
|
90
|
-
.. _developer: http://docs.astropy.org/en/stable/index.html#developer-documentation
|
|
91
|
-
.. _Astropy Code of Conduct: http://www.astropy.org/about.html#codeofconduct
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
wfc3tools/__init__.py,sha256=VrAe32AMZjIB3NgpMYCFJLRvGFno9lmuKI3vXMuEmck,608
|
|
2
|
+
wfc3tools/calwf3.py,sha256=DeevxlnsZuVTYWgOuKf66h7n47BLlozHkOIqEVx3G9E,6765
|
|
3
|
+
wfc3tools/embedsub.py,sha256=P-6mUragRH3G3V5nZMUoUiFZutuORv34R6w2Z4NX-Hk,3826
|
|
4
|
+
wfc3tools/pstack.py,sha256=51vGAOhJwc1ziuNACzl-Be2WkUs_3ZFDXJDMGEKQxD0,6787
|
|
5
|
+
wfc3tools/pstat.py,sha256=m3pNxW4T9RSwTfjnGdKL5ZevtTUa3hDFuU03x9Lhjhw,10097
|
|
6
|
+
wfc3tools/sampinfo.py,sha256=SAJYiwsdFPnAFqb1nUZIXgJ801OJJz1QGN3pGJevLuY,6855
|
|
7
|
+
wfc3tools/sub2full.py,sha256=Ab2wRam7V72_PWHyHeg3tTo3hUWeTqsu94bUMy4VsHw,5561
|
|
8
|
+
wfc3tools/util.py,sha256=3tKKfWDvIVoEkFWXj6RnRr3chhdD-24PSgG-EgJegf0,1723
|
|
9
|
+
wfc3tools/version.py,sha256=uJKvFol3xySBlFsy9vVg4JvWueNldnf8ba4HnPDu0xA,712
|
|
10
|
+
wfc3tools/wf32d.py,sha256=ZxEYY-P-8DHfcYDM59o0td_aqbxEbrsFgXZ_BgbwjWg,5093
|
|
11
|
+
wfc3tools/wf3ccd.py,sha256=2_RuVClcutEVWnl7jUN8-XaJTdV1Tj-CldhAg4e6kKg,5523
|
|
12
|
+
wfc3tools/wf3cte.py,sha256=gNGDK402xyPPiYgmScWZWT4k2Q5MBOJ0EsVJqwVvFu4,2398
|
|
13
|
+
wfc3tools/wf3ir.py,sha256=QLKHXnLqtwl9R_EYJ89ahQFR5SSApmwznTXcDJ4DUG8,4353
|
|
14
|
+
wfc3tools/wf3rej.py,sha256=nBtWNU0H3KIjI9l_ImfoI6Ll4g2wF0Dc4uLynA2oLps,6636
|
|
15
|
+
wfc3tools-1.6.1.dist-info/licenses/LICENSE.txt,sha256=psOKqD89Ruy_VuezmDEHL4M8MFGFePSOSRZ7NnuEyQM,1464
|
|
16
|
+
wfc3tools-1.6.1.dist-info/METADATA,sha256=VJpR5Y6UsC0nGtyys1F1VFV5B-6upFC4vK-cSaaeQvc,2900
|
|
17
|
+
wfc3tools-1.6.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
18
|
+
wfc3tools-1.6.1.dist-info/top_level.txt,sha256=v9YyAr2gaseWI3B1PZpcZN1e8yeao5hGnM6-20IbQ50,10
|
|
19
|
+
wfc3tools-1.6.1.dist-info/RECORD,,
|
wfc3tools-1.6.0.dist-info/RECORD
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
wfc3tools/__init__.py,sha256=VrAe32AMZjIB3NgpMYCFJLRvGFno9lmuKI3vXMuEmck,608
|
|
2
|
-
wfc3tools/calwf3.py,sha256=B-kFOtZb5ZHgAOV1OVBE9cfuNPmDfExI8akO8kvJnDw,6794
|
|
3
|
-
wfc3tools/embedsub.py,sha256=0kBeNCEua7VMj2e2cNAMOklolaL60K1id2M3btJxq4w,3883
|
|
4
|
-
wfc3tools/pstack.py,sha256=6ytoFD8pBY2NAd_QuNBjkho17h85QjIndxr4fUN8LeU,6857
|
|
5
|
-
wfc3tools/pstat.py,sha256=VBvFcUgGImd0LgpK7zg5cfrqgyOhL8UchgOoviLIb_g,10151
|
|
6
|
-
wfc3tools/sampinfo.py,sha256=3-3ORCdN2ir26frbtTr2AMwqBO6JcU_SDgjFmBvLkjs,6970
|
|
7
|
-
wfc3tools/sub2full.py,sha256=KrXPaG-XRVvUNxxof11uWYbCeV6bnDXAMfKAcuBItuA,5624
|
|
8
|
-
wfc3tools/util.py,sha256=Q2vha6PKu_5P1C8K0nAj8bjrl1qLCc_91wtJn_ZVHME,1826
|
|
9
|
-
wfc3tools/version.py,sha256=e6EGE-zfqfrGkBHDAkcJH8wzWg-QqsXiHlpX2I5kvxA,712
|
|
10
|
-
wfc3tools/wf32d.py,sha256=ZAGdhxN4pQ8j1TOYuFB1G-ccnullykJpzb4JS80jxJM,5100
|
|
11
|
-
wfc3tools/wf3ccd.py,sha256=xC91xv0cwrRWQx-y0tahOrV6nlMYrh-z3Q0TV6qVwH8,5536
|
|
12
|
-
wfc3tools/wf3cte.py,sha256=CfdKjCoNdR3virbJkdv4CWmvcdEfHDGMVt-WXRs_3lo,2413
|
|
13
|
-
wfc3tools/wf3ir.py,sha256=-U29B8DZTkJSeOCfg61lBdZRkXp7JFGDCCAWojVv_TA,4377
|
|
14
|
-
wfc3tools/wf3rej.py,sha256=2cFzw4MBwy2uNYoWPK-OCuqHpIKTE14aNMDtJ-F8qJg,6624
|
|
15
|
-
wfc3tools-1.6.0.dist-info/licenses/LICENSE.txt,sha256=psOKqD89Ruy_VuezmDEHL4M8MFGFePSOSRZ7NnuEyQM,1464
|
|
16
|
-
wfc3tools-1.6.0.dist-info/METADATA,sha256=-ufUwRfHx2mazpbuAaSbJk3odWQgdZ6QP3agaLVSxr4,3252
|
|
17
|
-
wfc3tools-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
-
wfc3tools-1.6.0.dist-info/top_level.txt,sha256=v9YyAr2gaseWI3B1PZpcZN1e8yeao5hGnM6-20IbQ50,10
|
|
19
|
-
wfc3tools-1.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|