drizzle 2.0.1__tar.gz → 2.1.1__tar.gz

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.

Files changed (63) hide show
  1. {drizzle-2.0.1 → drizzle-2.1.1}/.github/workflows/build.yml +1 -1
  2. {drizzle-2.0.1 → drizzle-2.1.1}/.github/workflows/ci.yml +11 -6
  3. {drizzle-2.0.1 → drizzle-2.1.1}/CHANGES.rst +38 -1
  4. {drizzle-2.0.1/drizzle.egg-info → drizzle-2.1.1}/PKG-INFO +6 -37
  5. {drizzle-2.0.1 → drizzle-2.1.1}/README.rst +3 -3
  6. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/resample.py +22 -17
  7. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/helpers.py +61 -30
  8. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/test_overlap_calc.py +24 -0
  9. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/test_resample.py +255 -5
  10. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/test_utils.py +1 -2
  11. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/utils.py +1 -1
  12. {drizzle-2.0.1 → drizzle-2.1.1/drizzle.egg-info}/PKG-INFO +6 -37
  13. {drizzle-2.0.1 → drizzle-2.1.1}/pyproject.toml +1 -4
  14. {drizzle-2.0.1 → drizzle-2.1.1}/setup.py +18 -6
  15. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzleapi.c +30 -9
  16. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzlebox.c +189 -35
  17. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzlemap.c +145 -8
  18. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzlemap.h +5 -0
  19. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzleutil.c +1 -1
  20. {drizzle-2.0.1 → drizzle-2.1.1}/src/tests/pandokia_fct.h +6 -6
  21. {drizzle-2.0.1 → drizzle-2.1.1}/src/tests/utest_cdrizzle.c +3 -1
  22. {drizzle-2.0.1 → drizzle-2.1.1}/.clang-format +0 -0
  23. {drizzle-2.0.1 → drizzle-2.1.1}/.coveragerc +0 -0
  24. {drizzle-2.0.1 → drizzle-2.1.1}/.flake8 +0 -0
  25. {drizzle-2.0.1 → drizzle-2.1.1}/.github/CODEOWNERS +0 -0
  26. {drizzle-2.0.1 → drizzle-2.1.1}/.github/dependabot.yml +0 -0
  27. {drizzle-2.0.1 → drizzle-2.1.1}/.gitignore +0 -0
  28. {drizzle-2.0.1 → drizzle-2.1.1}/.readthedocs.yaml +0 -0
  29. {drizzle-2.0.1 → drizzle-2.1.1}/.ruff.toml +0 -0
  30. {drizzle-2.0.1 → drizzle-2.1.1}/CODE_OF_CONDUCT.md +0 -0
  31. {drizzle-2.0.1 → drizzle-2.1.1}/LICENSE.rst +0 -0
  32. {drizzle-2.0.1 → drizzle-2.1.1}/MANIFEST.in +0 -0
  33. {drizzle-2.0.1 → drizzle-2.1.1}/docs/Makefile +0 -0
  34. {drizzle-2.0.1 → drizzle-2.1.1}/docs/_templates/autosummary/base.rst +0 -0
  35. {drizzle-2.0.1 → drizzle-2.1.1}/docs/_templates/autosummary/class.rst +0 -0
  36. {drizzle-2.0.1 → drizzle-2.1.1}/docs/_templates/autosummary/module.rst +0 -0
  37. {drizzle-2.0.1 → drizzle-2.1.1}/docs/conf.py +0 -0
  38. {drizzle-2.0.1 → drizzle-2.1.1}/docs/drizzle/api.rst +0 -0
  39. {drizzle-2.0.1 → drizzle-2.1.1}/docs/drizzle/index.rst +0 -0
  40. {drizzle-2.0.1 → drizzle-2.1.1}/docs/drizzle/user.rst +0 -0
  41. {drizzle-2.0.1 → drizzle-2.1.1}/docs/exts/numfig.py +0 -0
  42. {drizzle-2.0.1 → drizzle-2.1.1}/docs/index.rst +0 -0
  43. {drizzle-2.0.1 → drizzle-2.1.1}/docs/make.bat +0 -0
  44. {drizzle-2.0.1 → drizzle-2.1.1}/docs/rtd_environment.yaml +0 -0
  45. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/__init__.py +0 -0
  46. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/__init__.py +0 -0
  47. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/tests/test_cdrizzle.py +0 -0
  48. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle/util.py +0 -0
  49. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle.egg-info/SOURCES.txt +0 -0
  50. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle.egg-info/dependency_links.txt +0 -0
  51. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle.egg-info/not-zip-safe +0 -0
  52. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle.egg-info/requires.txt +0 -0
  53. {drizzle-2.0.1 → drizzle-2.1.1}/drizzle.egg-info/top_level.txt +0 -0
  54. {drizzle-2.0.1 → drizzle-2.1.1}/setup.cfg +0 -0
  55. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzleblot.c +0 -0
  56. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzleblot.h +0 -0
  57. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzlebox.h +0 -0
  58. {drizzle-2.0.1 → drizzle-2.1.1}/src/cdrizzleutil.h +0 -0
  59. {drizzle-2.0.1 → drizzle-2.1.1}/src/driz_portability.h +0 -0
  60. {drizzle-2.0.1 → drizzle-2.1.1}/src/tests/.clang-format +0 -0
  61. {drizzle-2.0.1 → drizzle-2.1.1}/src/tests/drizzletest.h +0 -0
  62. {drizzle-2.0.1 → drizzle-2.1.1}/src/tests/fct.h +0 -0
  63. {drizzle-2.0.1 → drizzle-2.1.1}/tox.ini +0 -0
@@ -8,7 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  build:
11
- uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v1
11
+ uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@v2
12
12
  with:
13
13
  upload_to_pypi: ${{ (github.event_name == 'release') && (github.event.action == 'released') }}
14
14
  targets: |
@@ -17,18 +17,23 @@ concurrency:
17
17
 
18
18
  jobs:
19
19
  test:
20
- uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
20
+ uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
21
21
  with:
22
22
  envs: |
23
23
  - linux: check-style
24
24
  - linux: check-security
25
25
  - linux: py310-xdist
26
26
  - linux: py311-xdist
27
- - linux: py313-xdist
28
- - macos: py312-xdist
29
- - windows: py312-xdist
30
- - linux: py312-xdist-cov
27
+ - linux: py312-xdist
28
+ # `tox` does not currently respect `requires-python` versions when creating testing environments;
29
+ # if this breaks, add an upper pin to `requires-python` and revert this py3 to the latest working version
30
+ - linux: py3-cov-xdist
31
31
  coverage: codecov
32
- - linux: py312-xdist-devdeps
32
+ - macos: py3-xdist
33
+ - windows: py3-xdist
34
+ # exclude Python 1.13.4, see https://github.com/python/cpython/issues/135151
35
+ python-version: '>=3.13.5 <3.14'
36
+ - linux: py3-devdeps-xdist
37
+ toxdeps: tox-uv
33
38
  secrets:
34
39
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -4,6 +4,43 @@
4
4
  Release Notes
5
5
  =============
6
6
 
7
+
8
+ 2.1.1 (2025-08-14)
9
+ ==================
10
+
11
+ - Fix a bug in the Cython code for ``tdriz()`` due to which the code would
12
+ raise an error for sub-second exposure times. [#192]
13
+
14
+ - Fixed a numerical instability in the new and old "boxer" algorithm in #175
15
+ (withdrawn release 2.1.0). [#191]
16
+
17
+
18
+ 2.1.0 (2025-02-20; withdrawn)
19
+ =============================
20
+
21
+ - Restored faster "boxer" overlap for square kernel, improving resample speed;
22
+ optimized and simplified related code. [#175]
23
+
24
+
25
+ 2.1.1 (unreleased)
26
+ ==================
27
+
28
+ - Fixed a bug in polygon intersection algorithm that could result in
29
+ incorrect output when the input polygons have nearly collinear edges. [#194]
30
+
31
+
32
+ 2.0.2 (unreleased)
33
+ ==================
34
+
35
+ - Fixed a bug in ``resample.Drizzle`` due to which initially, before adding
36
+ the first image, ``Drizzle.output_img`` is not filled with ``NaN`` when
37
+ ``fillval`` is either ``INDEF``, ``NAN``, ``None`` *and* the ``Drizzle``
38
+ object was initialized with ``out_img=None``. [#170]
39
+
40
+ - Fixes a crash when ``Drizzle`` is initialized with ``disable_ctx``
41
+ set to ``True``. [#180]
42
+
43
+
7
44
  2.0.1 (2025-01-28)
8
45
  ==================
9
46
 
@@ -23,7 +60,7 @@ Release Notes
23
60
  - Deprecated module ``util``. New software should not import from this
24
61
  module as it will be removed in a future release. [#134]
25
62
 
26
- - Bug fix: exposure time was undefined when in_units were not cps. [#134]
63
+ - Bug fix: exposure time was undefined when ``in_units`` were not "cps". [#134]
27
64
 
28
65
  - BUG FIX: ``cdrizzle.tdriz`` signature was out of date. [#134]
29
66
 
@@ -1,40 +1,8 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: drizzle
3
- Version: 2.0.1
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
- License: Copyright (C) 2011,2014 Association of Universities for Research in
7
- Astronomy (AURA)
8
-
9
- Redistribution and use in source and binary forms, with or without
10
- modification, are permitted provided that the following conditions
11
- are met:
12
-
13
- 1. Redistributions of source code must retain the above
14
- copyright notice, this list of conditions and the following
15
- disclaimer.
16
-
17
- 2. Redistributions in binary form must reproduce the above
18
- copyright notice, this list of conditions and the following
19
- disclaimer in the documentation and/or other materials
20
- provided with the distribution.
21
-
22
- 3. The name of AURA and its representatives may not be used to
23
- endorse or promote products derived from this software without
24
- specific prior written permission.
25
-
26
- THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR
27
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29
- ARE DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT,
30
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
36
- OF THE POSSIBILITY OF SUCH DAMAGE.
37
-
38
6
  Project-URL: Homepage, https://github.com/spacetelescope/drizzle
39
7
  Project-URL: Bug Tracker, https://github.com/spacetelescope/drizzle/issues
40
8
  Project-URL: Documentation, http://spacetelescope.github.io/drizzle/
@@ -56,6 +24,7 @@ Requires-Dist: sphinx-automodapi; extra == "docs"
56
24
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
57
25
  Requires-Dist: matplotlib; extra == "docs"
58
26
  Requires-Dist: pytest-doctestplus; extra == "docs"
27
+ Dynamic: license-file
59
28
 
60
29
  drizzle Documentation
61
30
  =====================
@@ -108,8 +77,8 @@ Requirements
108
77
  The Drizzle Algorithm
109
78
  ---------------------
110
79
 
111
- This section has been extracted from Chapter 2 of
112
- `The DrizzlePac Handbook <http://www.stsci.edu/hst/HST_overview/drizzlepac/documents/handbooks/drizzlepac.pdf>`_ [Driz2012]_
80
+ This section has been extracted from Chapter 3 of
81
+ `The DrizzlePac Handbook <https://hst-docs.stsci.edu/drizzpac>`_ [Driz2025]_
113
82
 
114
83
  There are a family of linear reconstruction techniques that, at two opposite
115
84
  extremes, are represented by the interlacing and shift-and-add techniques, with
@@ -200,4 +169,4 @@ for identifying cosmic rays in the original image. Blot requires the user
200
169
  to provide the world coordinate system (WCS)-based transformations in the
201
170
  form of a pixel map array as input.
202
171
 
203
- .. [Driz2012] Gonzaga, S., Hack, W., Fruchter, A., Mack, J., eds. 2012, The DrizzlePac Handbook. (Baltimore, STScI)
172
+ .. [Driz2025] Anand, G. S., Mack, J., et al., 2025, The DrizzlePac Handbook”, Version 3.0, (Baltimore: STScI)
@@ -49,8 +49,8 @@ Requirements
49
49
  The Drizzle Algorithm
50
50
  ---------------------
51
51
 
52
- This section has been extracted from Chapter 2 of
53
- `The DrizzlePac Handbook <http://www.stsci.edu/hst/HST_overview/drizzlepac/documents/handbooks/drizzlepac.pdf>`_ [Driz2012]_
52
+ This section has been extracted from Chapter 3 of
53
+ `The DrizzlePac Handbook <https://hst-docs.stsci.edu/drizzpac>`_ [Driz2025]_
54
54
 
55
55
  There are a family of linear reconstruction techniques that, at two opposite
56
56
  extremes, are represented by the interlacing and shift-and-add techniques, with
@@ -141,4 +141,4 @@ for identifying cosmic rays in the original image. Blot requires the user
141
141
  to provide the world coordinate system (WCS)-based transformations in the
142
142
  form of a pixel map array as input.
143
143
 
144
- .. [Driz2012] Gonzaga, S., Hack, W., Fruchter, A., Mack, J., eds. 2012, The DrizzlePac Handbook. (Baltimore, STScI)
144
+ .. [Driz2025] Anand, G. S., Mack, J., et al., 2025, The DrizzlePac Handbook”, Version 3.0, (Baltimore: STScI)
@@ -76,23 +76,24 @@ class Drizzle:
76
76
  information about which input image has contributed to the corresponding
77
77
  pixel in the resampled data array. Context image uses 32 bit integers to
78
78
  encode this information and hence it can keep track of only 32 input images.
79
- First bit corresponds to the first input image, second bit corrsponds to the
80
- second input image, and so on. We call this (0-indexed) order "context ID"
81
- which is represented by the ``ctx_id`` parameter/property. If the number of
79
+ The first bit corresponds to the first input image, the second bit
80
+ corresponds to the second input image, and so on.
81
+ We call this (0-indexed) order "context ID" which is represented by
82
+ the ``ctx_id`` parameter/property. If the number of
82
83
  input images exceeds 32, then it is necessary to have multiple context
83
- images ("planes") to hold information about all input images with the first
84
+ images ("planes") to hold information about all input images, with the first
84
85
  plane encoding which of the first 32 images contributed to the output data
85
- pixel, second plane representing next 32 input images (number 33-64), etc.
86
- For this reason, context array is either a 2D array (if the total number
87
- of resampled images is less than 33) of the type `numpy.int32` and shape
88
- ``(ny, nx)`` or a a 3D array of shape ``(np, ny, nx)`` where ``nx`` and
89
- ``ny`` are dimensions of image's data. ``np`` is the number of "planes"
90
- equal to ``(number of input images - 1) // 32 + 1``. If a bit at position
91
- ``k`` in a pixel with coordinates ``(p, y, x)`` is 0 then input image number
92
- ``32 * p + k`` (0-indexed) did not contribute to the output data pixel
93
- with array coordinates ``(y, x)`` and if that bit is 1 then input image
94
- number ``32 * p + k`` did contribute to the pixel ``(y, x)`` in the
95
- resampled image.
86
+ pixel, the second plane representing next 32 input images (number 33-64),
87
+ etc. For this reason, context array is either a 2D array (if the total
88
+ number of resampled images is less than 33) of the type `numpy.int32` and
89
+ shape ``(ny, nx)`` or a a 3D array of shape ``(np, ny, nx)`` where ``nx``
90
+ and ``ny`` are dimensions of the image data. ``np`` is the number of
91
+ "planes" computed as ``(number of input images - 1) // 32 + 1``. If a bit at
92
+ position ``k`` in a pixel with coordinates ``(p, y, x)`` is 0, then input
93
+ image number ``32 * p + k`` (0-indexed) did not contribute to the output
94
+ data pixel with array coordinates ``(y, x)`` and if that bit is 1, then
95
+ input image number ``32 * p + k`` did contribute to the pixel ``(y, x)``
96
+ in the resampled image.
96
97
 
97
98
  As an example, let's assume we have 8 input images. Then, when ``out_ctx``
98
99
  pixel values are displayed using binary representation (and decimal in
@@ -413,7 +414,11 @@ class Drizzle:
413
414
  )
414
415
 
415
416
  if out_img is None:
416
- self._out_img = np.zeros(out_shape, dtype=np.float32)
417
+ if self._fillval.upper() in ["INDEF", "NAN"]:
418
+ fillval = np.nan
419
+ else:
420
+ fillval = float(self._fillval)
421
+ self._out_img = np.full(out_shape, fillval, dtype=np.float32)
417
422
  else:
418
423
  self._out_img = out_img
419
424
 
@@ -548,7 +553,7 @@ class Drizzle:
548
553
 
549
554
  self._alloc_output_arrays(
550
555
  out_shape=self._out_shape,
551
- max_ctx_id=max(self._max_ctx_id, self._ctx_id),
556
+ max_ctx_id=self._max_ctx_id,
552
557
  out_img=None,
553
558
  out_wht=None,
554
559
  out_ctx=None,
@@ -56,40 +56,71 @@ def wcs_from_file(filename, ext=None, return_data=False, crpix_shift=None,
56
56
  """
57
57
  full_file_name = os.path.join(DATA_DIR, filename)
58
58
  path = os.path.join(DATA_DIR, full_file_name)
59
- with fits.open(path) as hdu:
60
- if ext is None:
61
- for k, u in enumerate(hdu):
59
+
60
+ def get_shape(hdr):
61
+ naxis1 = hdr.get("WCSNAX1", hdr.get("NAXIS1"))
62
+ naxis2 = hdr.get("WCSNAX2", hdr.get("NAXIS2"))
63
+ if naxis1 is None or naxis2 is None:
64
+ return None
65
+ return (naxis2, naxis1)
66
+
67
+ def data_from_hdr(hdr, data=None, shape=None):
68
+ if data is not None:
69
+ return data
70
+ bitpix = hdr.get("BITPIX", -32)
71
+ dtype = fits.hdu.BITPIX2DTYPE[bitpix]
72
+ shape = get_shape(hdr) or shape
73
+ if shape is None:
74
+ return None
75
+ return np.zeros(shape, dtype=dtype)
76
+
77
+ if os.path.splitext(filename)[1] in [".hdr", ".txt"]:
78
+ hdul = None
79
+ hdr = fits.Header.fromfile(
80
+ path,
81
+ sep='\n',
82
+ endcard=False,
83
+ padding=False
84
+ )
85
+
86
+ else:
87
+ with fits.open(path) as fits_hdul:
88
+ hdul = fits.HDUList([hdu.copy() for hdu in fits_hdul])
89
+
90
+ if ext is None and hdul is not None:
91
+ for k, u in enumerate(hdul):
62
92
  if "CTYPE1" in u.header:
63
93
  ext = k
64
94
  break
65
95
 
66
- hdr = hdu[ext].header
67
- naxis1 = hdr.get("WCSNAX1", hdr.get("NAXIS1"))
68
- naxis2 = hdr.get("WCSNAX2", hdr.get("NAXIS2"))
69
- if naxis1 is not None and naxis2 is not None:
70
- shape = (naxis2, naxis1)
71
- if hdu[ext].data is None:
72
- hdu[ext].data = np.zeros(shape, dtype=np.float32)
73
- else:
74
- shape = None
75
-
76
- if crpix_shift is not None and "CRPIX1" in hdr:
77
- hdr["CRPIX1"] += crpix_shift[0]
78
- hdr["CRPIX2"] += crpix_shift[1]
79
-
80
- result = fits_wcs.WCS(hdr, hdu)
81
- result.array_shape = shape
82
-
83
- if wcs_type == "gwcs":
84
- result = _gwcs_from_hst_fits_wcs(result)
85
-
86
- if return_data:
87
- result = (result, )
88
- if not isinstance(return_data, (list, tuple)):
89
- return_data = [ext]
90
- for ext in return_data:
91
- data = (hdu[ext].data, )
92
- result = result + data
96
+ hdr = hdul[ext].header
97
+
98
+ if crpix_shift is not None and "CRPIX1" in hdr:
99
+ hdr["CRPIX1"] += crpix_shift[0]
100
+ hdr["CRPIX2"] += crpix_shift[1]
101
+
102
+ result = fits_wcs.WCS(hdr, hdul)
103
+ shape = get_shape(hdr)
104
+ result.array_shape = shape
105
+
106
+ if wcs_type == "gwcs":
107
+ result = _gwcs_from_hst_fits_wcs(result)
108
+
109
+ if return_data:
110
+ if hdul is None:
111
+ data = data_from_hdr(hdr, data=None, shape=shape)
112
+ return (result, data)
113
+
114
+ result = (result, )
115
+ if not isinstance(return_data, (list, tuple)):
116
+ return_data = [ext]
117
+ for ext in return_data:
118
+ data = data_from_hdr(
119
+ hdul[ext].header,
120
+ data=hdul[ext].data,
121
+ shape=shape
122
+ )
123
+ result = result + (data, )
93
124
 
94
125
  return result
95
126
 
@@ -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)