drizzle 1.15.3__cp311-cp311-win_amd64.whl → 2.0.0__cp311-cp311-win_amd64.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.

@@ -1,173 +0,0 @@
1
- import os
2
-
3
- import pytest
4
- import numpy as np
5
- from astropy import wcs
6
- from astropy.io import fits
7
-
8
- from drizzle import drizzle
9
- from drizzle import util
10
-
11
- TEST_DIR = os.path.abspath(os.path.dirname(__file__))
12
- DATA_DIR = os.path.join(TEST_DIR, 'data')
13
-
14
-
15
- def read_header(filename):
16
- """
17
- Read the primary header from a fits file
18
- """
19
- fileroot, extn = util.parse_filename(os.path.join(DATA_DIR, filename))
20
- with fits.open(fileroot) as hdulist:
21
- header = hdulist[0].header
22
- return header
23
-
24
-
25
- def read_image(filename):
26
- """
27
- Read the image from a fits file
28
- """
29
- fileroot, extn = util.parse_filename(os.path.join(DATA_DIR, filename))
30
- with fits.open(fileroot, memmap=False) as hdulist:
31
- data = hdulist[1].data.copy()
32
- return data
33
-
34
-
35
- def read_wcs(filename):
36
- """
37
- Read the wcs of a fits file
38
- """
39
- fileroot, extn = util.parse_filename(os.path.join(DATA_DIR, filename))
40
- with fits.open(fileroot) as hdulist:
41
- the_wcs = wcs.WCS(hdulist[1].header)
42
- return the_wcs
43
-
44
-
45
- @pytest.fixture
46
- def run_drizzle_reference_square_points(tmpdir):
47
- """Create an empty drizzle image"""
48
- output_file = str(tmpdir.join('output_null_run.fits'))
49
- output_template = os.path.join(DATA_DIR, 'reference_square_point.fits')
50
-
51
- output_wcs = read_wcs(output_template)
52
- driz = drizzle.Drizzle(outwcs=output_wcs, wt_scl="expsq", pixfrac=0.5,
53
- kernel="turbo", fillval="NaN")
54
- driz.write(output_file)
55
-
56
- return output_file
57
-
58
-
59
- def test_null_run(run_drizzle_reference_square_points):
60
- output_file = run_drizzle_reference_square_points
61
- with fits.open(output_file) as hdulist:
62
-
63
- assert hdulist.index_of("SCI") == 1
64
- assert hdulist.index_of("WHT") == 2
65
- assert hdulist.index_of("CTX") == 3
66
-
67
- pheader = hdulist["PRIMARY"].header
68
-
69
- assert pheader['DRIZOUDA'] == 'SCI'
70
- assert pheader['DRIZOUWE'] == 'WHT'
71
- assert pheader['DRIZOUCO'] == 'CTX'
72
- assert pheader['DRIZWTSC'] == 'expsq'
73
- assert pheader['DRIZKERN'] == 'turbo'
74
- assert pheader['DRIZPIXF'] == 0.5
75
- assert pheader['DRIZFVAL'] == 'NaN'
76
- assert pheader['DRIZOUUN'] == 'cps'
77
- assert pheader['EXPTIME'] == 0.0
78
- assert pheader['DRIZEXPT'] == 1.0
79
-
80
-
81
- def test_file_init(run_drizzle_reference_square_points):
82
- """
83
- Initialize drizzle object from a file
84
- """
85
- input_file = run_drizzle_reference_square_points
86
-
87
- driz = drizzle.Drizzle(infile=input_file)
88
-
89
- assert driz.outexptime == 1.0
90
- assert driz.wt_scl == 'expsq'
91
- assert driz.kernel == 'turbo'
92
- assert driz.pixfrac == 0.5
93
- assert driz.fillval == 'NaN'
94
-
95
-
96
- @pytest.fixture
97
- def add_header(tmpdir):
98
- """Add extra keywords read from the header"""
99
- output_file = str(tmpdir.join('output_add_header.fits'))
100
-
101
- input_file = os.path.join(DATA_DIR, 'j8bt06nyq_flt.fits')
102
- output_template = os.path.join(DATA_DIR, 'reference_square_point.fits')
103
-
104
- driz = drizzle.Drizzle(infile=output_template)
105
- image = read_image(input_file)
106
- inwcs = read_wcs(input_file)
107
- driz.add_image(image, inwcs)
108
-
109
- header = fits.header.Header()
110
- header['ONEVAL'] = (1.0, 'test value')
111
- header['TWOVAL'] = (2.0, 'test value')
112
-
113
- driz.write(output_file, outheader=header)
114
-
115
- return output_file
116
-
117
-
118
- def test_add_header(add_header):
119
- output_file = add_header
120
- header = read_header(output_file)
121
- assert header['ONEVAL'] == 1.0
122
- assert header['TWOVAL'] == 2.0
123
- assert header['DRIZKERN'] == 'square'
124
-
125
-
126
- def test_add_file(add_header, tmpdir):
127
- """
128
- Add an image read from a file
129
- """
130
- test_file = add_header
131
- output_file = str(tmpdir.join('output_add_file.fits'))
132
-
133
- input_file = os.path.join(DATA_DIR, 'j8bt06nyq_flt.fits[1]')
134
- output_template = os.path.join(DATA_DIR, 'reference_square_point.fits')
135
-
136
- driz = drizzle.Drizzle(infile=output_template)
137
- driz.add_fits_file(input_file)
138
- driz.write(output_file)
139
-
140
- output_image = read_image(output_file)
141
- test_image = read_image(test_file)
142
- diff_image = np.absolute(output_image - test_image)
143
-
144
- assert np.amax(diff_image) == 0.0
145
-
146
-
147
- def test_blot_file(tmpdir):
148
- """
149
- Blot an image read from a file
150
- """
151
- output_file = str(tmpdir.join('output_blot_file.fits'))
152
- test_file = str(tmpdir.join('output_blot_image.fits'))
153
-
154
- input_file = os.path.join(DATA_DIR, 'j8bt06nyq_flt.fits[1]')
155
- output_template = os.path.join(DATA_DIR, 'reference_blot_image.fits')
156
-
157
- blotwcs = read_wcs(input_file)
158
-
159
- driz = drizzle.Drizzle(infile=output_template)
160
- driz.add_fits_file(input_file)
161
- driz.blot_image(blotwcs)
162
- driz.write(test_file)
163
-
164
- driz = drizzle.Drizzle(infile=output_template)
165
- driz.add_fits_file(input_file)
166
- driz.blot_fits_file(input_file)
167
- driz.write(output_file)
168
-
169
- output_image = read_image(output_file)
170
- test_image = read_image(test_file)
171
- diff_image = np.absolute(output_image - test_image)
172
-
173
- assert np.amax(diff_image) == 0.0
@@ -1,76 +0,0 @@
1
- import os
2
-
3
- import numpy as np
4
- from numpy.testing import assert_equal, assert_almost_equal
5
- from astropy import wcs
6
- from astropy.io import fits
7
-
8
- from drizzle import calc_pixmap
9
-
10
- TEST_DIR = os.path.abspath(os.path.dirname(__file__))
11
- DATA_DIR = os.path.join(TEST_DIR, 'data')
12
-
13
-
14
- def test_map_rectangular():
15
- """
16
- Make sure the initial index array has correct values
17
- """
18
- naxis1 = 1000
19
- naxis2 = 10
20
-
21
- pixmap = np.indices((naxis1, naxis2), dtype='float32')
22
- pixmap = pixmap.transpose()
23
-
24
- assert_equal(pixmap[5,500], (500,5))
25
-
26
-
27
- def test_map_to_self():
28
- """
29
- Map a pixel array to itself. Should return the same array.
30
- """
31
- input_file = os.path.join(DATA_DIR, 'input1.fits')
32
- input_hdu = fits.open(input_file)
33
-
34
- input_wcs = wcs.WCS(input_hdu[1].header)
35
- naxis1, naxis2 = input_wcs.pixel_shape
36
- input_hdu.close()
37
-
38
- ok_pixmap = np.indices((naxis1, naxis2), dtype='float32')
39
- ok_pixmap = ok_pixmap.transpose()
40
-
41
- pixmap = calc_pixmap.calc_pixmap(input_wcs, input_wcs)
42
-
43
- # Got x-y transpose right
44
- assert_equal(pixmap.shape, ok_pixmap.shape)
45
- # Mapping an array to itself
46
- assert_almost_equal(pixmap, ok_pixmap, decimal=5)
47
-
48
-
49
- def test_translated_map():
50
- """
51
- Map a pixel array to at translated array.
52
- """
53
- first_file = os.path.join(DATA_DIR, 'input1.fits')
54
- first_hdu = fits.open(first_file)
55
- first_header = first_hdu[1].header
56
-
57
- first_wcs = wcs.WCS(first_header)
58
- naxis1, naxis2 = first_wcs.pixel_shape
59
- first_hdu.close()
60
-
61
- second_file = os.path.join(DATA_DIR, 'input3.fits')
62
- second_hdu = fits.open(second_file)
63
- second_header = second_hdu[1].header
64
-
65
- second_wcs = wcs.WCS(second_header)
66
- second_hdu.close()
67
-
68
- ok_pixmap = np.indices((naxis1, naxis2), dtype='float32') - 2.0
69
- ok_pixmap = ok_pixmap.transpose()
70
-
71
- pixmap = calc_pixmap.calc_pixmap(first_wcs, second_wcs)
72
-
73
- # Got x-y transpose right
74
- assert_equal(pixmap.shape, ok_pixmap.shape)
75
- # Mapping an array to a translated array
76
- assert_almost_equal(pixmap, ok_pixmap, decimal=5)
@@ -1,18 +0,0 @@
1
- drizzle/__init__.py,sha256=7M-hCW6QcKqJl0bdkCixW08PBJzLdMz6UTTzz2CKbgc,271
2
- drizzle/calc_pixmap.py,sha256=pM4Wvsjzc_gzb7NR23kLoxQy426ZXZF07tq59qqfEyA,1702
3
- drizzle/cdrizzle.cp311-win_amd64.pyd,sha256=UcoZf8wbVn9PA_eHJGyJS4csgn2nXrN-IjtjbZfBZWo,102400
4
- drizzle/doblot.py,sha256=Qr5FdfV9-GY93Do5Jb9VAX-Y7M4EusIzAwwneV76Ai4,2576
5
- drizzle/dodrizzle.py,sha256=3h8FE46FoHUdt9T4FjXlSOQvGU_OQZm3FRXX33I2XDM,6979
6
- drizzle/drizzle.py,sha256=jnsv5GUX-NZHJN3GQhkWmmxDp1QK9iSFeYDpgNpeVVY,23441
7
- drizzle/util.py,sha256=8qPA7C8nqRL7vAjJ3Ip6yLeaIauJXLtV9JBAzIDUNiY,5999
8
- drizzle/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- drizzle/tests/test_cdrizzle.py,sha256=JHwVwOQ-evOD1XMPyKStxODy3AGwzXa6PMDGJldmFik,714
10
- drizzle/tests/test_drizzle.py,sha256=4vCcGPVIvQZGgZJ6kPGl6luTww6IcVYWOkLbFbVtcR4,26146
11
- drizzle/tests/test_file_io.py,sha256=z6deDDdwGog03wC96poDDWoqafB2cfyR9q0PJzAaJ_g,5094
12
- drizzle/tests/test_overlap_calc.py,sha256=Fv5ntD7hbFF_8vkiTrHeTWP7hgjQ7kkvkeY_IOZ8_aw,7062
13
- drizzle/tests/test_pixmap.py,sha256=B8Xj0MjpeP6Tc2vIL7gV7kBDmyDdo5SEafxGHrTnESM,2131
14
- drizzle-1.15.3.dist-info/LICENSE.rst,sha256=sUXj5W73D9TcOw5ZXaDdcthYdY2b2dTJPsxBuZTOYWQ,1505
15
- drizzle-1.15.3.dist-info/METADATA,sha256=iZ9_phqXeqKslXGnVjeab6eX8PilLIIiKZss3x1uZ-4,17032
16
- drizzle-1.15.3.dist-info/WHEEL,sha256=dCuJ4f0faaLdEJehgDqauYbxfYcPtrcUnDoQw-il14k,101
17
- drizzle-1.15.3.dist-info/top_level.txt,sha256=MA5uqwTj1sJBi-hCeQj9v3-sZ9nVUTe6bd_zGWTKy5A,8
18
- drizzle-1.15.3.dist-info/RECORD,,