drizzle 1.15.3__tar.gz → 2.0.0__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 (80) hide show
  1. drizzle-2.0.0/.clang-format +17 -0
  2. drizzle-2.0.0/.coveragerc +32 -0
  3. drizzle-2.0.0/.flake8 +13 -0
  4. drizzle-2.0.0/.github/workflows/ci.yml +34 -0
  5. drizzle-2.0.0/.ruff.toml +211 -0
  6. {drizzle-1.15.3 → drizzle-2.0.0}/CHANGES.rst +16 -0
  7. {drizzle-1.15.3 → drizzle-2.0.0}/PKG-INFO +14 -176
  8. {drizzle-1.15.3 → drizzle-2.0.0}/README.rst +9 -174
  9. {drizzle-1.15.3 → drizzle-2.0.0}/docs/conf.py +11 -14
  10. drizzle-2.0.0/docs/drizzle/api.rst +5 -0
  11. {drizzle-1.15.3 → drizzle-2.0.0}/docs/drizzle/user.rst +2 -0
  12. drizzle-2.0.0/docs/exts/numfig.py +110 -0
  13. {drizzle-1.15.3 → drizzle-2.0.0}/docs/rtd_environment.yaml +1 -0
  14. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle/__init__.py +2 -1
  15. drizzle-2.0.0/drizzle/resample.py +702 -0
  16. drizzle-2.0.0/drizzle/tests/test_cdrizzle.py +29 -0
  17. drizzle-2.0.0/drizzle/tests/test_resample.py +1437 -0
  18. drizzle-2.0.0/drizzle/tests/test_utils.py +193 -0
  19. drizzle-2.0.0/drizzle/util.py +34 -0
  20. drizzle-2.0.0/drizzle/utils.py +239 -0
  21. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/PKG-INFO +14 -176
  22. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/SOURCES.txt +8 -7
  23. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/requires.txt +3 -0
  24. drizzle-2.0.0/pyproject.toml +204 -0
  25. {drizzle-1.15.3 → drizzle-2.0.0}/setup.py +1 -1
  26. drizzle-2.0.0/src/cdrizzleapi.c +665 -0
  27. drizzle-2.0.0/src/cdrizzleblot.c +971 -0
  28. {drizzle-1.15.3 → drizzle-2.0.0}/src/cdrizzleblot.h +1 -2
  29. {drizzle-1.15.3 → drizzle-2.0.0}/src/cdrizzlebox.c +261 -358
  30. {drizzle-1.15.3 → drizzle-2.0.0}/src/cdrizzlebox.h +5 -9
  31. {drizzle-1.15.3 → drizzle-2.0.0}/src/cdrizzlemap.c +4 -7
  32. {drizzle-1.15.3 → drizzle-2.0.0}/src/cdrizzlemap.h +46 -45
  33. drizzle-2.0.0/src/cdrizzleutil.c +296 -0
  34. drizzle-2.0.0/src/cdrizzleutil.h +447 -0
  35. {drizzle-1.15.3 → drizzle-2.0.0}/src/driz_portability.h +2 -2
  36. drizzle-2.0.0/src/tests/.clang-format +5 -0
  37. {drizzle-1.15.3 → drizzle-2.0.0}/src/tests/drizzletest.h +4 -3
  38. {drizzle-1.15.3 → drizzle-2.0.0}/src/tests/utest_cdrizzle.c +158 -192
  39. {drizzle-1.15.3 → drizzle-2.0.0}/tox.ini +1 -1
  40. drizzle-1.15.3/.coveragerc +0 -21
  41. drizzle-1.15.3/.flake8 +0 -10
  42. drizzle-1.15.3/.github/workflows/ci.yml +0 -59
  43. drizzle-1.15.3/docs/drizzle/api.rst +0 -7
  44. drizzle-1.15.3/drizzle/calc_pixmap.py +0 -52
  45. drizzle-1.15.3/drizzle/doblot.py +0 -80
  46. drizzle-1.15.3/drizzle/dodrizzle.py +0 -189
  47. drizzle-1.15.3/drizzle/drizzle.py +0 -569
  48. drizzle-1.15.3/drizzle/tests/test_cdrizzle.py +0 -24
  49. drizzle-1.15.3/drizzle/tests/test_drizzle.py +0 -834
  50. drizzle-1.15.3/drizzle/tests/test_file_io.py +0 -173
  51. drizzle-1.15.3/drizzle/tests/test_pixmap.py +0 -76
  52. drizzle-1.15.3/drizzle/util.py +0 -256
  53. drizzle-1.15.3/pyproject.toml +0 -81
  54. drizzle-1.15.3/src/cdrizzleapi.c +0 -632
  55. drizzle-1.15.3/src/cdrizzleblot.c +0 -998
  56. drizzle-1.15.3/src/cdrizzleutil.c +0 -320
  57. drizzle-1.15.3/src/cdrizzleutil.h +0 -465
  58. {drizzle-1.15.3 → drizzle-2.0.0}/.github/CODEOWNERS +0 -0
  59. {drizzle-1.15.3 → drizzle-2.0.0}/.github/dependabot.yml +0 -0
  60. {drizzle-1.15.3 → drizzle-2.0.0}/.github/workflows/build.yml +0 -0
  61. {drizzle-1.15.3 → drizzle-2.0.0}/.gitignore +0 -0
  62. {drizzle-1.15.3 → drizzle-2.0.0}/.readthedocs.yaml +0 -0
  63. {drizzle-1.15.3 → drizzle-2.0.0}/CODE_OF_CONDUCT.md +0 -0
  64. {drizzle-1.15.3 → drizzle-2.0.0}/LICENSE.rst +0 -0
  65. {drizzle-1.15.3 → drizzle-2.0.0}/MANIFEST.in +0 -0
  66. {drizzle-1.15.3 → drizzle-2.0.0}/docs/Makefile +0 -0
  67. {drizzle-1.15.3 → drizzle-2.0.0}/docs/_templates/autosummary/base.rst +0 -0
  68. {drizzle-1.15.3 → drizzle-2.0.0}/docs/_templates/autosummary/class.rst +0 -0
  69. {drizzle-1.15.3 → drizzle-2.0.0}/docs/_templates/autosummary/module.rst +0 -0
  70. {drizzle-1.15.3 → drizzle-2.0.0}/docs/drizzle/index.rst +0 -0
  71. {drizzle-1.15.3 → drizzle-2.0.0}/docs/index.rst +0 -0
  72. {drizzle-1.15.3 → drizzle-2.0.0}/docs/make.bat +0 -0
  73. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle/tests/__init__.py +0 -0
  74. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle/tests/test_overlap_calc.py +2 -2
  75. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/dependency_links.txt +0 -0
  76. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/not-zip-safe +0 -0
  77. {drizzle-1.15.3 → drizzle-2.0.0}/drizzle.egg-info/top_level.txt +0 -0
  78. {drizzle-1.15.3 → drizzle-2.0.0}/setup.cfg +0 -0
  79. {drizzle-1.15.3 → drizzle-2.0.0}/src/tests/fct.h +0 -0
  80. {drizzle-1.15.3 → drizzle-2.0.0}/src/tests/pandokia_fct.h +0 -0
@@ -0,0 +1,17 @@
1
+ ---
2
+ BasedOnStyle: Google
3
+ Language: Cpp
4
+ AlwaysBreakAfterReturnType: None
5
+ AlwaysBreakAfterDefinitionReturnType: TopLevel
6
+ DerivePointerAlignment: false
7
+ PointerAlignment: Right
8
+ SortIncludes: false
9
+ SortUsingDeclarations: false
10
+ IndentWidth: 4
11
+ TabWidth: 4
12
+ UseTab: Never
13
+ AlignConsecutiveMacros: true
14
+ ReflowComments: true
15
+ SpaceBeforeParens: ControlStatements
16
+
17
+ ...
@@ -0,0 +1,32 @@
1
+ [run]
2
+ source = drizzle
3
+
4
+ omit =
5
+ drizzle/__init__*
6
+ drizzle/**/conftest.py
7
+ drizzle/**/setup*
8
+ drizzle/**/tests/*
9
+ drizzle/version*
10
+ drizzle/_version.py
11
+ */drizzle/__init__*
12
+ */drizzle/**/conftest.py
13
+ */drizzle/**/setup*
14
+ */drizzle/**/tests/*
15
+
16
+ [report]
17
+ exclude_lines =
18
+ # Have to re-enable the standard pragma
19
+ pragma: no cover
20
+
21
+ # Don't complain about packages we have installed
22
+ except ImportError
23
+
24
+ # Don't complain if tests don't hit defensive assertion code:
25
+ raise AssertionError
26
+ raise NotImplementedError
27
+
28
+ # Don't complain about script hooks
29
+ 'def main(.*):'
30
+
31
+ # Ignore branches that don't pertain to this version of Python
32
+ pragma: py{ignore_python_version}
drizzle-2.0.0/.flake8 ADDED
@@ -0,0 +1,13 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ select = F, W, E, C
4
+ ignore =
5
+ # Line break occurred before a binary operator
6
+ W503,
7
+ # Line break occurred after a binary operator
8
+ W504,
9
+ exclude =
10
+ docs,
11
+ build
12
+ .eggs,
13
+ .tox,
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - '*.x'
8
+ tags:
9
+ - "*"
10
+ pull_request:
11
+ schedule:
12
+ - cron: '0 6 * * 1'
13
+
14
+ concurrency:
15
+ group: ${{ github.workflow }}-${{ github.ref }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ test:
20
+ uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
21
+ with:
22
+ envs: |
23
+ - linux: check-style
24
+ - linux: check-security
25
+
26
+ - linux: py310-xdist
27
+ - linux: py311-xdist
28
+ - linux: py313-xdist
29
+ - macos: py312-xdist
30
+ - windows: py312-xdist
31
+ - linux: py312-xdist-cov
32
+ coverage: codecov
33
+
34
+ - linux: py312-xdist-devdeps
@@ -0,0 +1,211 @@
1
+ extend = "pyproject.toml"
2
+ lint.ignore = [
3
+ # flake8-annotations (ANN) : static typing
4
+ "ANN001", # Function argument without type annotation
5
+ "ANN003", # `**kwargs` without type annotation
6
+ "ANN202", # Private function without return type annotation
7
+ "ANN401", # Use of `Any` type
8
+
9
+ # flake8-unused-arguments (ARG)
10
+ "ARG001", # unused-function-argument
11
+ "ARG002", # unused-method-argument
12
+ "ARG003", # unused-class-method-argument
13
+ "ARG004", # unused-static-method-argument
14
+ "ARG005", # unused-lambda-argument
15
+
16
+ # flake8-bugbear (B)
17
+ "B006", # MutableArgumentDefault
18
+ "B007", # UnusedLoopControlVariable
19
+ "B023", # FunctionUsesLoopVariable
20
+ "B028", # No-explicit-stacklevel
21
+ "B904", # RaiseWithoutFromInsideExcept
22
+ "B905", # ZipWithoutExplicitStrict # requires 3.10+
23
+
24
+ # flake8-blind-except (BLE)
25
+ "BLE001", # blind-except
26
+
27
+ # mccabe (C90) : code complexity
28
+ # TODO: configure maximum allowed complexity.
29
+ "C901", # McCabeComplexity
30
+
31
+ # pydocstyle (D)
32
+ # Missing Docstrings
33
+ "D100", # undocumented-public-module
34
+ "D101", # undocumented-public-class
35
+ "D103", # undocumented-public-function
36
+ "D104", # undocumented-public-package
37
+ "D205", # blank-line-after-summary
38
+ # Quotes Issues
39
+ "D300", # triple-single-quotes
40
+ "D301", # escape-sequence-in-docstring
41
+ # Docstring Content Issues
42
+ "D403", # first-line-capitalized
43
+ "D404", # docstring-starts-with-this
44
+ "D401", # non-imperative-mood.
45
+ "D414", # empty-docstring-section
46
+ "D419", # docstring is empty
47
+
48
+ # flake8-datetimez (DTZ)
49
+ "DTZ001", # call-datetime-without-tzinfo
50
+ "DTZ005", # call-datetime-now-without-tzinfo
51
+
52
+ # pycodestyle (E, W)
53
+ "E501", # line-too-long
54
+ "E721", # type-comparison
55
+ "E731", # lambda-assignment
56
+
57
+ # flake8-errmsg (EM) : nicer error tracebacks
58
+ "EM101", # raw-string-in-exception
59
+ "EM102", # f-string-in-exception
60
+ "EM103", # dot-format-in-exception
61
+
62
+ # eradicate (ERA)
63
+ # NOTE: be careful that developer notes are kept.
64
+ "ERA001", # commented-out-code
65
+
66
+ # flake8-executable (EXE)
67
+ "EXE002", # shebang-missing-executable-file
68
+
69
+ # Pyflakes (F)
70
+ "F841", # unused-variable
71
+
72
+ # flake8-boolean-trap (FBT) : boolean flags should be kwargs, not args
73
+ # NOTE: a good thing to fix, but changes API.
74
+ "FBT001", # boolean-positional-arg-in-function-definition
75
+ "FBT002", # boolean-default-value-in-function-definition
76
+ "FBT003", # boolean-positional-value-in-function-call
77
+
78
+ # flake8-fixme (FIX)
79
+ "FIX001", # Line contains FIXME. this should be fixed or at least FIXME replaced with TODO
80
+ "FIX004", # Line contains HACK. replace HACK with NOTE.
81
+
82
+ # pep8-naming (N)
83
+ # NOTE: some of these can/should be fixed, but this changes the API.
84
+ "N801", # invalid-class-name
85
+ "N802", # invalid-function-name
86
+ "N803", # invalid-argument-name
87
+ "N804", # invalid-first-argument-name-for-class-method
88
+ "N805", # invalid-first-argument-name-for-method
89
+ "N807", # dunder-function-name
90
+ "N813", # camelcase-imported-as-lowercase
91
+ "N815", # mixed-case-variable-in-class-scope
92
+ "N816", # mixed-case-variable-in-global-scope
93
+ "N818", # error-suffix-on-exception-name
94
+
95
+ # NumPy-specific rules (NPY)
96
+ "NPY002", # Replace legacy `np.random.rand` call with `np.random.Generator` (2023-05-03)
97
+
98
+ # Perflint (PERF)
99
+ "PERF203", # `try`-`except` within a loop incurs performance overhead
100
+ "PERF401", # Use a list comprehension to create a transformed list
101
+
102
+ # Pylint (PLC, PLE, PLR, PLW)
103
+ "PLE0101", # return-in-init
104
+ "PLR0124", # Name compared with itself
105
+ "PLR0402", # ConsiderUsingFromImport
106
+ "PLR0912", # too-many-branches
107
+ "PLR0913", # too-many-args
108
+ "PLR0915", # too-many-statements
109
+ "PLR1714", # Consider merging multiple comparisons
110
+ "PLR2004", # MagicValueComparison
111
+ "PLR5501", # collapsible-else-if
112
+ "PLW0603", # global-statement
113
+ "PLW2901", # redefined-loop-name
114
+
115
+ # flake8-pytest-style (PT)
116
+ "PT001", # pytest-fixture-incorrect-parentheses-style
117
+ "PT003", # pytest-extraneous-scope-function
118
+ "PT004", # pytest-missing-fixture-name-underscore
119
+ "PT006", # pytest-parametrize-names-wrong-type
120
+ "PT007", # pytest-parametrize-values-wrong-type
121
+ "PT011", # pytest-raises-too-broad
122
+ "PT012", # pytest-raises-with-multiple-statements
123
+ "PT017", # pytest-assert-in-exceptinstead
124
+ "PT018", # pytest-composite-assertion
125
+ "PT022", # pytest-useless-yield-fixture
126
+ "PT023", # pytest-incorrect-mark-parentheses-style
127
+
128
+ # flake8-use-pathlib (PTH)
129
+ "PTH100", # os-path-abspath
130
+ "PTH101", # os-chmod
131
+ "PTH102", # os-mkdir
132
+ "PTH103", # os-makedirs
133
+ "PTH104", # os-rename
134
+ "PTH107", # os-remove
135
+ "PTH108", # os-unlink
136
+ "PTH109", # os-getcwd
137
+ "PTH110", # os-path-exists
138
+ "PTH111", # os-path-expanduser
139
+ "PTH112", # os-path-isdir
140
+ "PTH113", # os-path-isfile
141
+ "PTH118", # os-path-join
142
+ "PTH119", # os-path-basename
143
+ "PTH120", # os-path-dirname
144
+ "PTH122", # os-path-splitext
145
+ "PTH123", # builtin-open
146
+ "PTH202", # `os.path.getsize` should be replaced by `Path.stat().st_size`
147
+ "PTH207", # Replace `glob` with `Path.glob` or `Path.rglob`
148
+
149
+ # flake8-return (RET)
150
+ "RET501", # unnecessary-return-none
151
+ "RET502", # implicit-return-value
152
+ "RET503", # implicit-return
153
+ "RET504", # unnecessary-assign
154
+ "RET507", # superfluous-else-continue
155
+
156
+ # flake8-raise (RSE)
157
+ "RSE102", # unnecessary-paren-on-raise-exception
158
+
159
+ # Ruff-specific rules (RUF)
160
+ "RUF001", # ambiguous-unicode-character-string
161
+ "RUF002", # ambiguous-unicode-character-docstring
162
+ "RUF010", # use conversion in f-string
163
+ "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
164
+
165
+ # flake8-bandit (S)
166
+ "S101", # Use of `assert` detected
167
+ "S105", # hardcoded-password-string
168
+ "S110", # try-except-pass
169
+ "S112", # try-except-continue
170
+ "S301", # suspicious-pickle-usage
171
+ "S307", # Use of possibly insecure function; consider using `ast.literal_eval`
172
+ "S311", # suspicious-non-cryptographic-randomness
173
+ "S324", # hashlib-insecure-hash-function
174
+ "S506", # UnsafeYAMLLoad
175
+ "S310", # Suspicious-url-open-usage
176
+ "S603", # `subprocess` call: check for execution of untrusted input
177
+ "S607", # Starting a process with a partial executable path
178
+
179
+ # flake8-simplify (SIM)
180
+ "SIM102", # NestedIfStatements
181
+ "SIM105", # UseContextlibSuppress
182
+ "SIM108", # UseTernaryOperator
183
+ "SIM114", # if-with-same-arms
184
+ "SIM115", # OpenFileWithContextHandler
185
+ "SIM117", # MultipleWithStatements
186
+ "SIM118", # KeyInDict
187
+ "SIM201", # NegateEqualOp
188
+ "SIM300", # yoda condition
189
+
190
+ # flake8-print (T20)
191
+ "T201", # PrintUsed
192
+
193
+ # flake8-todos (TD)
194
+ "TD001", # Invalid TODO tag
195
+ "TD003", # Missing issue link on the line following this TODO
196
+ "TD004", # Missing colon in TODO
197
+ "TD007", # Missing space after colon in TODO
198
+
199
+ # tryceratops (TRY)
200
+ "TRY002", # raise-vanilla-class
201
+ "TRY003", # raise-vanilla-args
202
+ "TRY004", # prefer-type-error
203
+ "TRY201", # verbose-raise
204
+ "TRY301", # raise-within-try
205
+
206
+ # flake8-quotes (Q)
207
+ "Q000", # use double quotes
208
+ ]
209
+ lint.unfixable = [
210
+ "E711" # NoneComparison. Hard to fix b/c numpy has it's own None.
211
+ ]
@@ -4,6 +4,22 @@
4
4
  Release Notes
5
5
  =============
6
6
 
7
+ 2.0.0 (2024-10-23)
8
+ ==================
9
+
10
+ - Backward incompatible major re-design of API. Backward compatibility was
11
+ maintained with JWST and Roman pipelines only. [#134]
12
+
13
+ - Deprecated module ``util``. New software should not import from this
14
+ module as it will be removed in a future release. [#134]
15
+
16
+ - Bug fix: exposure time was undefined when in_units were not cps. [#134]
17
+
18
+ - BUG FIX: ``cdrizzle.tdriz`` signature was out of date. [#134]
19
+
20
+ - Removed support for the ``'tophat'`` kernel. [#134]
21
+
22
+
7
23
  1.15.3 (2024-08-19)
8
24
  ===================
9
25
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: drizzle
3
- Version: 1.15.3
3
+ Version: 2.0.0
4
4
  Summary: A package for combining dithered images into a single image
5
5
  Author-email: STScI <help@stsci.edu>
6
6
  License: Copyright (C) 2011,2014 Association of Universities for Research in
@@ -39,25 +39,28 @@ Project-URL: Homepage, https://github.com/spacetelescope/drizzle
39
39
  Project-URL: Bug Tracker, https://github.com/spacetelescope/drizzle/issues
40
40
  Project-URL: Documentation, http://spacetelescope.github.io/drizzle/
41
41
  Project-URL: Source Code, https://github.com/spacetelescope/drizzle
42
- Requires-Python: <3.13,>=3.10
42
+ Requires-Python: >=3.10
43
43
  Description-Content-Type: text/x-rst
44
44
  License-File: LICENSE.rst
45
45
  Requires-Dist: numpy
46
46
  Requires-Dist: astropy
47
47
  Provides-Extra: test
48
48
  Requires-Dist: pytest; extra == "test"
49
+ Requires-Dist: pytest-cov; extra == "test"
50
+ Requires-Dist: pytest-doctestplus; extra == "test"
49
51
  Provides-Extra: docs
50
52
  Requires-Dist: tomli; python_version < "3.11" and extra == "docs"
51
53
  Requires-Dist: sphinx; extra == "docs"
52
54
  Requires-Dist: sphinx-automodapi; extra == "docs"
53
55
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
54
56
  Requires-Dist: matplotlib; extra == "docs"
57
+ Requires-Dist: pytest-doctestplus; extra == "docs"
55
58
 
56
59
  drizzle Documentation
57
60
  =====================
58
61
 
59
- .. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
60
- :target: http://www.astropy.org
62
+ .. image:: https://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
63
+ :target: https://www.astropy.org
61
64
  :alt: Powered by Astropy Badge
62
65
 
63
66
  .. image:: https://codecov.io/github/spacetelescope/drizzle/branch/main/graphs/badge.svg
@@ -76,6 +79,10 @@ drizzle Documentation
76
79
  :target: https://pypi.org/project/drizzle
77
80
  :alt: PyPI Status
78
81
 
82
+ .. image:: https://zenodo.org/badge/28100377.svg
83
+ :target: https://doi.org/10.5281/zenodo.10672889
84
+ :alt: Zenodo DOI
85
+
79
86
  The ``drizzle`` library is a Python package for combining dithered images into a
80
87
  single image. This library is derived from code used in DrizzlePac. Like
81
88
  DrizzlePac, most of the code is implemented in the C language. The biggest
@@ -188,177 +195,8 @@ missing information.
188
195
  The blot methods perform the inverse operation of drizzle. That is, blotting
189
196
  performs the inverse mapping to transform the dithered median image back into
190
197
  the coordinate system of the original input image. Blotting is primarily used
191
- for identifying cosmic rays in the original image. Like the original drizzle
192
- task, blot requires the user to provide the world coordinate system (WCS)
193
- transformations as inputs.
198
+ for identifying cosmic rays in the original image. Blot requires the user
199
+ to provide the world coordinate system (WCS)-based transformations in the
200
+ form of a pixel map array as input.
194
201
 
195
202
  .. [Driz2012] Gonzaga, S., Hack, W., Fruchter, A., Mack, J., eds. 2012, The DrizzlePac Handbook. (Baltimore, STScI)
196
-
197
-
198
- The Drizzle Library
199
- -------------------
200
-
201
- The Drizzle library is object-oriented and you use it by first creating an object of
202
- the ``Drizzle`` class. To create a new Drizzle output image, supply an Astropy
203
- WCS object representing the coordinate system of the output image.
204
- The other parameters are the linear pixel dimension described in the previous
205
- section, the drizzle kernel used, how each input image is scaled (by exposure
206
- time or time squared), and the pixel value set in the output image where the
207
- input images do not overlap.
208
-
209
- After creating a Drizzle object, you add one or more images by calling the
210
- ``add_fits_file`` method. The arguments are the name of the FITS file containing
211
- the input image and optionally the name of a FITS file containing the pixel
212
- weighting. Both file names can be followed by an extension name or number in
213
- square brackets. Optionally you can pass the name of the header keywords
214
- containing the exposure time and units. Two units are understood: counts and
215
- cps (counts per second).
216
-
217
- The following function is a demonstration of how you can create a new output
218
- image::
219
-
220
- def drizzle_demo_one(reference, outfile, infiles):
221
- """
222
- First demonstration of drizzle
223
-
224
- Parameters
225
- ==========
226
- reference
227
- A file containing the wcs of the output image
228
-
229
- outfile
230
- The name of the output image
231
-
232
- infiles
233
- The names of the input images to be combined
234
- """
235
- # Get the WCS for the output image
236
- hdulist = fits.open(reference)
237
- reference_wcs = wcs.WCS(hdulist[1].header)
238
-
239
- # Initialize the output with the WCS
240
- driz = drizzle.drizzle.Drizzle(outwcs=reference_wcs)
241
-
242
- # Combine the input images into on drizzle image
243
- for infile in infiles:
244
- driz.add_fits_file(infile)
245
-
246
- # Write the drizzled image out
247
- driz.write(outfile)
248
-
249
- Optionally you can supply the input and weight images as Numpy arrays by using
250
- the ``add_image`` method. If you use this method, you must supply the extra
251
- information that would otherwise be read from the FITS image: The WCS
252
- of the input image, the exposure time, and image units.
253
-
254
- Here is an example of how you would call ``add_image``::
255
-
256
- def drizzle_demo_two(reference, outfile, infiles):
257
- """
258
- Demonstration of drizzle with add image.
259
-
260
- Parameters
261
- ==========
262
- reference
263
- A file containing the wcs of the output image.
264
-
265
- outfile
266
- The name of the output image.
267
-
268
- infiles
269
- The names of the input images to be combined.
270
- """
271
- # Get the WCS for the output image
272
- reflist = fits.open(reference)
273
- reference_wcs = wcs.WCS(reflist[1].header)
274
-
275
- # Initialize the output with the WCS
276
- driz = drizzle.drizzle.Drizzle(outwcs=reference_wcs)
277
-
278
- # Combine the input images into on drizzle image
279
- for infile in infiles:
280
- # Open the file and read the image and wcs
281
- # This is a contrived example, we would not do this
282
- # unless the data came from another source
283
- # than a FITS file
284
- imlist = fits.open(reference)
285
- image = imlist[1].data
286
- image_wcs = wcs.WCS(imlist[1].header)
287
- driz.add_image(image, image_wcs)
288
-
289
- # Write the drizzled image out
290
- driz.write(outfile)
291
-
292
- After combining all the input images, you write the output image into a FITS
293
- file with the ``write`` method. You must pass the name of the output image and
294
- optionally the units. You can also supply a set of header cards to be added
295
- to the primary header of the output FITS file.
296
-
297
- You can also add more images to an existing Drizzle output file by creating
298
- a new Drizzle object and passing the existing output file name as the new
299
- object is created. In that case the output WCS and all
300
- other parameters are read from the file.
301
-
302
- Here is a demonstration of adding additional input images to a drizzled image::
303
-
304
- def drizzle_demo_three(outfile, infiles):
305
- """
306
- Demonstration of drizzle and adding to an existing output.
307
-
308
- Parameters
309
- ==========
310
- outfile
311
- Name of output image that new files will be appended to.
312
-
313
- infiles
314
- The names of the input images to be added.
315
- """
316
- # Re-open the output file
317
- driz = drizzle.drizzle.Drizzle(infile=outfile)
318
-
319
- # Add the input images to the existing output image
320
- for infile in infiles:
321
- driz.add_fits_file(infile)
322
-
323
- # Write the modified drizzled image out
324
- driz.write(outfile)
325
-
326
- You can use the methods ``blot_fits_file`` and ``blot_image`` to transform the drizzled
327
- output image into another WCS. Most usually this is the
328
- coordinates of one of the input images and is used to identify cosmic rays or
329
- other defects. The two methods ``blot_fits_file`` and ``blot_image`` allow you to
330
- retrieve the WCS from the FITS file header or input it directly.
331
- The optional parameter ``interp`` allows you to selct the method used to resample
332
- the pixels on the new grid, and ``sincscl`` is used to scale the sinc function if one
333
- of the sinc interpolation methods is used. This function demonstrates how both
334
- methods are called::
335
-
336
- def drizzle_demo_four(outfile, blotfile):
337
- """
338
- Demonstration of blot methods.
339
-
340
- Parameters
341
- ==========
342
- outfile
343
- Name of output image that will be converted.
344
-
345
- blotfile
346
- Name of image containing wcs to be transformed to.
347
- """
348
- # Open drizzle using the output file
349
- # Transform it to another coordinate system
350
- driz = drizzle.drizzle.Drizzle(infile=outfile)
351
- driz.blot_fits_file(blotfile)
352
- driz.write(outfile)
353
-
354
- # Read the WCS and transform using it instead
355
- # This is a contrived example
356
- blotlist = fits.open(blotfile)
357
- blot_wcs = wcs.WCS(blotlist[1].header)
358
- driz = drizzle.drizzle.Drizzle(infile=outfile)
359
- driz.blot_image(blot_wcs)
360
- driz.write(outfile)
361
-
362
- The lower level function ``dodrizzle`` is present for backwards compatibility with
363
- the existing STScI DrizzlePac code and should not be used unless you are also
364
- concerned with this compatibility.