drizzle 2.1.0__cp310-cp310-macosx_11_0_arm64.whl → 2.1.1__cp310-cp310-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.

Binary file
@@ -260,3 +260,27 @@ def test_intersection_case01():
260
260
  cp = clip_polygon(p, wnd)
261
261
 
262
262
  assert _is_poly_eq(cp, cp_ref)
263
+
264
+
265
+ def test_intersection_case02():
266
+ # a real case of failure reported in #189
267
+ p = [
268
+ (-0.04000000000000009104, 1.5),
269
+ (2.73499999999999943157, 1.5),
270
+ (1.83500000000000018652, -0.5),
271
+ (-0.03999999999999998002, -0.5),
272
+ ]
273
+ wnd = [
274
+ (-0.5, -0.5), (3.5, -0.5), (3.5, 3.5), (-0.5, 3.5)
275
+ ]
276
+
277
+ cp_ref = [
278
+ (-0.04, 1.5),
279
+ (-0.04, -0.5),
280
+ (1.835, -0.5),
281
+ (2.735, 1.5),
282
+ ]
283
+
284
+ cp = clip_polygon(p, wnd)
285
+
286
+ assert _is_poly_eq(cp, cp_ref)
@@ -286,6 +286,7 @@ def test_drizzle_defaults():
286
286
  assert driz.out_img[1, 2] == 1
287
287
  assert (driz.out_img[2, 1] - 2.0) < 1.0e-14
288
288
 
289
+
289
290
  @pytest.mark.parametrize(
290
291
  'kernel,test_image_type,max_diff_atol',
291
292
  [
@@ -355,7 +356,10 @@ def test_resample_kernel(tmpdir, kernel, test_image_type, max_diff_atol):
355
356
  scale=pscale_ratio,
356
357
  )
357
358
  else:
358
- with pytest.warns(Warning):
359
+ with pytest.warns(
360
+ Warning,
361
+ match=f"Kernel '{kernel}' is not a flux-conserving kernel"
362
+ ):
359
363
  driz.add_image(
360
364
  insci,
361
365
  exptime=1.0,
@@ -486,7 +490,10 @@ def test_zero_input_weight(kernel, fc):
486
490
  fillstr='INDEF',
487
491
  )
488
492
  else:
489
- with pytest.warns(Warning):
493
+ with pytest.warns(
494
+ Warning,
495
+ match=f"Kernel '{kernel}' is not a flux-conserving kernel"
496
+ ):
490
497
  cdrizzle.tdriz(
491
498
  insci,
492
499
  inwht,
@@ -760,7 +767,10 @@ def test_flux_conservation_nondistorted(kernel, fc):
760
767
  wtscale=1.0,
761
768
  )
762
769
  else:
763
- with pytest.warns(Warning):
770
+ with pytest.warns(
771
+ Warning,
772
+ match=f"Kernel '{kernel}' is not a flux-conserving kernel"
773
+ ):
764
774
  cdrizzle.tdriz(
765
775
  in_sci,
766
776
  in_wht,
@@ -848,7 +858,10 @@ def test_flux_conservation_distorted(kernel, fc):
848
858
  wtscale=1.0,
849
859
  )
850
860
  else:
851
- with pytest.warns(Warning):
861
+ with pytest.warns(
862
+ Warning,
863
+ match=f"Kernel '{kernel}' is not a flux-conserving kernel"
864
+ ):
852
865
  cdrizzle.tdriz(
853
866
  in_sci,
854
867
  in_wht,
@@ -1138,7 +1151,7 @@ def test_resample_get_shape_from_pixmap():
1138
1151
  exptime=0.0,
1139
1152
  )
1140
1153
 
1141
- driz.add_image(in_sci, weight_map=in_wht, exptime=1.0, pixmap=pixmap)
1154
+ driz.add_image(in_sci, weight_map=in_wht, exptime=0.1, pixmap=pixmap)
1142
1155
  assert driz.out_img.shape == in_shape
1143
1156
 
1144
1157
 
@@ -1223,3 +1236,115 @@ def test_nan_fillval(fillval):
1223
1236
  )
1224
1237
 
1225
1238
  assert np.all(np.isnan(driz.out_img))
1239
+
1240
+
1241
+ def test_resample_edge_sgarea_bug():
1242
+ """
1243
+ Test from https://github.com/spacetelescope/drizzle/issues/187
1244
+
1245
+ """
1246
+ pixmap = (np.array([
1247
+ [
1248
+ [0.31887051, 1.],
1249
+ [1.01898591, 1.],
1250
+ [1.71909665, 1.],
1251
+ ],
1252
+ [
1253
+ [0.31591881, 0.],
1254
+ [1.0160342312345672, 0.],
1255
+ [1.716145, 0.],
1256
+ ]
1257
+ ], dtype="f8"))
1258
+
1259
+ in_shape = pixmap.shape[:2]
1260
+ img = np.full(in_shape, 42, dtype=np.float32)
1261
+ out_shape = (4, 4)
1262
+
1263
+ driz = resample.Drizzle(
1264
+ kernel='square',
1265
+ fillval='nan',
1266
+ out_shape=out_shape,
1267
+ disable_ctx=True,
1268
+ )
1269
+
1270
+ driz.add_image(
1271
+ img,
1272
+ exptime=11.776,
1273
+ in_units='cps',
1274
+ pixfrac=1.0,
1275
+ pixmap=pixmap,
1276
+ scale=1.0,
1277
+ wht_scale=1.0,
1278
+ )
1279
+ # expected pixels should be close to 42
1280
+ np.testing.assert_allclose(driz.out_img[:2, :3], img[0, 0], rtol=1e-6)
1281
+
1282
+ # other values should be nan
1283
+ np.testing.assert_equal(driz.out_img[:, 3:], np.nan)
1284
+ np.testing.assert_equal(driz.out_img[2:], np.nan)
1285
+
1286
+
1287
+ def test_resample_edge_collinear():
1288
+ """
1289
+ Test that resample does not crash when the input image is smaller than the
1290
+ output image, and the edges of the two images are nearly collinear.
1291
+
1292
+ Test based on the example from
1293
+ https://github.com/spacetelescope/drizzle/issues/189#issue-3196294879
1294
+
1295
+ """
1296
+ pixmap = (np.array([
1297
+ [
1298
+ [0.31, 1.0],
1299
+ [1.01, 1.0],
1300
+ [2.01, 1.0],
1301
+ ],
1302
+ [
1303
+ [0.31, 0.],
1304
+ [1.01, 0.],
1305
+ [1.71, 0.],
1306
+ ]
1307
+ ], dtype="f8"))
1308
+
1309
+ in_shape = pixmap.shape[:2]
1310
+ img = np.full(in_shape, np.pi, dtype=np.float32)
1311
+ in_flux = np.sum(img)
1312
+ out_shape = (4, 4)
1313
+
1314
+ driz = resample.Drizzle(
1315
+ kernel='square',
1316
+ fillval='nan',
1317
+ out_shape=out_shape,
1318
+ disable_ctx=True,
1319
+ )
1320
+
1321
+ driz.add_image(
1322
+ img,
1323
+ exptime=11.776,
1324
+ in_units='cps',
1325
+ pixfrac=1.0,
1326
+ pixmap=pixmap,
1327
+ scale=1.0,
1328
+ wht_scale=1.0,
1329
+ )
1330
+
1331
+ out_flux = np.nansum(driz.out_img * driz.out_wht)
1332
+
1333
+ # Given this pixmap, the entire input image should fit within the output
1334
+ # image. There should be at least 7 pixels with finite values in the output
1335
+ # image. We can get more than 7 pixels with finite values due to rounding
1336
+ # errors when computing polygon intersections (those "extra" pixels should)
1337
+ # have very small weights.
1338
+ assert np.sum(driz.out_wht > 1e-30) == 7
1339
+ assert np.sum(np.isfinite(driz.out_img)) >= 7
1340
+ # output image intensity must be equal to the input image intensity:
1341
+ assert np.allclose(
1342
+ driz.out_img[np.isfinite(driz.out_img)],
1343
+ img[0, 0],
1344
+ rtol=0,
1345
+ atol=1e-6
1346
+ )
1347
+ # flux in the output image should be equal to the flux in the input image:
1348
+ assert np.allclose(out_flux, in_flux, rtol=1e-6, atol=0.0)
1349
+ # area of the signal in the input image:
1350
+ assert np.allclose(np.sum(driz.out_wht), 6.0, rtol=0, atol=1.0e-6)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drizzle
3
- Version: 2.1.0
3
+ Version: 2.1.1
4
4
  Summary: A package for combining dithered images into a single image
5
5
  Author-email: STScI <help@stsci.edu>
6
6
  Project-URL: Homepage, https://github.com/spacetelescope/drizzle
@@ -1,16 +1,16 @@
1
- drizzle-2.1.0.dist-info/RECORD,,
2
- drizzle-2.1.0.dist-info/WHEEL,sha256=11kMdE9gzbsaQG30fRcsAYxBLEVRsqJo098Y5iL60Xo,136
3
- drizzle-2.1.0.dist-info/top_level.txt,sha256=MA5uqwTj1sJBi-hCeQj9v3-sZ9nVUTe6bd_zGWTKy5A,8
4
- drizzle-2.1.0.dist-info/METADATA,sha256=Ib_IPFdMtDc3ZbRl-xNiL9FY6sGg2dmB4ZDlsOpwmlc,8932
5
- drizzle-2.1.0.dist-info/licenses/LICENSE.rst,sha256=zbEvAxiq9xY9gvf78KeZaARrnOsTcqC9FeOC6tg8VbA,1474
6
- drizzle/cdrizzle.cpython-310-darwin.so,sha256=HRt8scmj-nEaaLH133XNQXq8ujR-AUtviQYoG1ddwDg,151424
1
+ drizzle-2.1.1.dist-info/RECORD,,
2
+ drizzle-2.1.1.dist-info/WHEEL,sha256=11kMdE9gzbsaQG30fRcsAYxBLEVRsqJo098Y5iL60Xo,136
3
+ drizzle-2.1.1.dist-info/top_level.txt,sha256=MA5uqwTj1sJBi-hCeQj9v3-sZ9nVUTe6bd_zGWTKy5A,8
4
+ drizzle-2.1.1.dist-info/METADATA,sha256=LiJ9cBIBZmJWZhbk94_gNDRU-HCrRwob8mVkz9Uu9zo,8932
5
+ drizzle-2.1.1.dist-info/licenses/LICENSE.rst,sha256=zbEvAxiq9xY9gvf78KeZaARrnOsTcqC9FeOC6tg8VbA,1474
6
+ drizzle/cdrizzle.cpython-310-darwin.so,sha256=E8VPkSBFqzzx4pXHfOBgV1NFREjVqtjyERFoktCfzXg,151680
7
7
  drizzle/resample.py,sha256=-uMfJ2AEXfZrAkmi3uq9QOJfZaDx4Em8tOnSYWUVkm8,28450
8
8
  drizzle/util.py,sha256=dmaA4MtbUKZa-KTLosDsYG3nuVWCWkqRMCL8zqRf8II,811
9
9
  drizzle/__init__.py,sha256=oKjebdSpXrrHeytrwme-CcDlxqSXpED5P8GxUkYLmV0,313
10
10
  drizzle/utils.py,sha256=A_N1JpSjqrH7ZlcHphqaeiiCSRzDRqiP7oGrgi-r9eY,10556
11
11
  drizzle/tests/test_utils.py,sha256=7Gt4p-ddGqldUGG4NiAP4kGqjnbPL7Mvcc1f1FtFZ5k,7465
12
- drizzle/tests/test_overlap_calc.py,sha256=HJPdD5waKM7j4iz8qT38mJyCQDVtb8CzGfgRUpjFQIk,6800
12
+ drizzle/tests/test_overlap_calc.py,sha256=UFP32F6MQ_P0wLmdL6AdWe4gA_mxrCC2x7pgDrzA5d0,7312
13
13
  drizzle/tests/test_cdrizzle.py,sha256=KnK6l8CZ7HxGx2OlziYtAsOMka3PebP-sLJuOIOMTAw,697
14
14
  drizzle/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- drizzle/tests/test_resample.py,sha256=9Pd0wpnjov4265eVnF5UOl8_5kyzy0jKyEx0ZR4gFJE,34094
15
+ drizzle/tests/test_resample.py,sha256=yTNqzKtXcvg3mFtCaUvziNCv_5ifUDo4CLPAIrRkL2g,37506
16
16
  drizzle/tests/helpers.py,sha256=gFhCa68Ev0nX_oMNlf7gn60F6146jyUCMzu5vXGkhTU,6452