drizzle 1.15.3__cp311-cp311-macosx_11_0_arm64.whl → 2.0.1__cp311-cp311-macosx_11_0_arm64.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.

Potentially problematic release.


This version of drizzle might be problematic. Click here for more details.

drizzle/dodrizzle.py DELETED
@@ -1,189 +0,0 @@
1
- """
2
- STScI Python compatable drizzle module
3
- """
4
- import numpy as np
5
-
6
- from . import util
7
- from . import calc_pixmap
8
- from . import cdrizzle
9
-
10
-
11
- def dodrizzle(insci, input_wcs, inwht,
12
- output_wcs, outsci, outwht, outcon,
13
- expin, in_units, wt_scl,
14
- wcslin_pscale=1.0, uniqid=1,
15
- xmin=0, xmax=0, ymin=0, ymax=0,
16
- pixfrac=1.0, kernel='square', fillval="INDEF"):
17
- """
18
- Low level routine for performing 'drizzle' operation.on one image.
19
-
20
- The interface is compatible with STScI code. All images are Python
21
- ndarrays, instead of filenames. File handling (input and output) is
22
- performed by the calling routine.
23
-
24
- Parameters
25
- ----------
26
-
27
- insci : 2d array
28
- A 2d numpy array containing the input image to be drizzled.
29
- it is an error to not supply an image.
30
-
31
- input_wcs : 2d array
32
- The world coordinate system of the input image.
33
-
34
- inwht : 2d array
35
- A 2d numpy array containing the pixel by pixel weighting.
36
- Must have the same dimensions as insci. If none is supplied,
37
- the weghting is set to one.
38
-
39
- output_wcs : wcs
40
- The world coordinate system of the output image.
41
-
42
- outsci : 2d array
43
- A 2d numpy array containing the output image produced by
44
- drizzling. On the first call it should be set to zero.
45
- Subsequent calls it will hold the intermediate results
46
-
47
- outwht : 2d array
48
- A 2d numpy array containing the output counts. On the first
49
- call it should be set to zero. On subsequent calls it will
50
- hold the intermediate results.
51
-
52
- outcon : 2d or 3d array, optional
53
- A 2d or 3d numpy array holding a bitmap of which image was an input
54
- for each output pixel. Should be integer zero on first call.
55
- Subsequent calls hold intermediate results.
56
-
57
- expin : float
58
- The exposure time of the input image, a positive number. The
59
- exposure time is used to scale the image if the units are counts.
60
-
61
- in_units : str
62
- The units of the input image. The units can either be "counts"
63
- or "cps" (counts per second.)
64
-
65
- wt_scl : float
66
- A scaling factor applied to the pixel by pixel weighting.
67
-
68
- wcslin_pscale : float, optional
69
- The pixel scale of the input image. Conceptually, this is the
70
- linear dimension of a side of a pixel in the input image, but it
71
- is not limited to this and can be set to change how the drizzling
72
- algorithm operates.
73
-
74
- uniqid : int, optional
75
- The id number of the input image. Should be one the first time
76
- this function is called and incremented by one on each subsequent
77
- call.
78
-
79
- xmin : float, optional
80
- This and the following three parameters set a bounding rectangle
81
- on the input image. Only pixels on the input image inside this
82
- rectangle will have their flux added to the output image. Xmin
83
- sets the minimum value of the x dimension. The x dimension is the
84
- dimension that varies quickest on the image. If the value is zero,
85
- no minimum will be set in the x dimension. All four parameters are
86
- zero based, counting starts at zero.
87
-
88
- xmax : float, optional
89
- Sets the maximum value of the x dimension on the bounding box
90
- of the input image. If the value is zero, no maximum will
91
- be set in the x dimension, the full x dimension of the output
92
- image is the bounding box.
93
-
94
- ymin : float, optional
95
- Sets the minimum value in the y dimension on the bounding box. The
96
- y dimension varies less rapidly than the x and represents the line
97
- index on the input image. If the value is zero, no minimum will be
98
- set in the y dimension.
99
-
100
- ymax : float, optional
101
- Sets the maximum value in the y dimension. If the value is zero, no
102
- maximum will be set in the y dimension, the full x dimension
103
- of the output image is the bounding box.
104
-
105
- pixfrac : float, optional
106
- The fraction of a pixel that the pixel flux is confined to. The
107
- default value of 1 has the pixel flux evenly spread across the image.
108
- A value of 0.5 confines it to half a pixel in the linear dimension,
109
- so the flux is confined to a quarter of the pixel area when the square
110
- kernel is used.
111
-
112
- kernel: str, optional
113
- The name of the kernel used to combine the input. The choice of
114
- kernel controls the distribution of flux over the kernel. The kernel
115
- names are: "square", "turbo", "point", "gaussian", "lanczos2",
116
- and "lanczos3".
117
-
118
- .. warning::
119
- The "gaussian" and "lanczos2/3" kernels **DO NOT** conserve flux.
120
-
121
- fillval: str, optional
122
- The value a pixel is set to in the output if the input image does
123
- not overlap it. The default value of INDEF does not set a value.
124
-
125
- Returns
126
- -------
127
- A tuple with three values: a version string, the number of pixels
128
- on the input image that do not overlap the output image, and the
129
- number of complete lines on the input image that do not overlap the
130
- output input image.
131
-
132
- """
133
-
134
- # Ensure that the fillval parameter gets properly interpreted
135
- # for use with tdriz
136
- if util.is_blank(fillval):
137
- fillval = 'INDEF'
138
- else:
139
- fillval = str(fillval)
140
-
141
- if in_units == 'cps':
142
- expscale = 1.0
143
- else:
144
- expscale = expin
145
-
146
- # Add input weight image if it was not passed in
147
-
148
- if (insci.dtype > np.float32):
149
- insci = insci.astype(np.float32)
150
-
151
- if inwht is None:
152
- inwht = np.ones_like(insci)
153
-
154
- # Compute what plane of the context image this input would
155
- # correspond to:
156
- planeid = int((uniqid - 1) / 32)
157
-
158
- # Check if the context image has this many planes
159
- if outcon.ndim == 3:
160
- nplanes = outcon.shape[0]
161
- elif outcon.ndim == 2:
162
- nplanes = 1
163
- else:
164
- nplanes = 0
165
-
166
- if nplanes <= planeid:
167
- raise IndexError("Not enough planes in drizzle context image")
168
-
169
- # Alias context image to the requested plane if 3d
170
- if outcon.ndim == 3:
171
- outcon = outcon[planeid]
172
-
173
- pix_ratio = output_wcs.pscale / wcslin_pscale
174
-
175
- # Compute the mapping between the input and output pixel coordinates
176
- pixmap = calc_pixmap.calc_pixmap(input_wcs, output_wcs)
177
-
178
- #
179
- # Call 'drizzle' to perform image combination
180
- # This call to 'cdriz.tdriz' uses the new C syntax
181
- #
182
- _vers, nmiss, nskip = cdrizzle.tdriz(
183
- insci, inwht, pixmap, outsci, outwht, outcon,
184
- uniqid=uniqid, xmin=xmin, xmax=xmax,
185
- ymin=ymin, ymax=ymax, scale=pix_ratio, pixfrac=pixfrac,
186
- kernel=kernel, in_units=in_units, expscale=expscale,
187
- wtscale=wt_scl, fillstr=fillval)
188
-
189
- return _vers, nmiss, nskip