File tree 3 files changed +12
-14
lines changed
3 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ Bug Fixes
11
11
12
12
- Bug not writing compression qlevel when it is set to None/0.0
13
13
This was preventing lossless gzip compression
14
+ - work around cfitsio bug when creating HDU for lossless gzip compression,
15
+ reopen file instead of just an update hdu list
14
16
15
17
version 1.2.0
16
18
--------------
Original file line number Diff line number Diff line change @@ -1040,9 +1040,13 @@ def create_image_hdu(self,
1040
1040
extver = extver ,
1041
1041
)
1042
1042
1043
- # don't rebuild the whole list unless this is the first hdu
1044
- # to be created
1045
- self .update_hdu_list (rebuild = False )
1043
+ if compress is not None and qlevel is None or qlevel == 0.0 :
1044
+ # work around bug in cfitso
1045
+ self .reopen ()
1046
+ else :
1047
+ # don't rebuild the whole list unless this is the first hdu
1048
+ # to be created
1049
+ self .update_hdu_list (rebuild = False )
1046
1050
1047
1051
def _ensure_empty_image_ok (self ):
1048
1052
"""
Original file line number Diff line number Diff line change @@ -98,12 +98,11 @@ def test_compressed_write_read(compress):
98
98
'gzip_2_lossless' ,
99
99
]
100
100
)
101
- def _test_compressed_write_read_fitsobj (compress ):
101
+ def test_compressed_write_read_fitsobj (compress ):
102
102
"""
103
103
Test writing and reading a rice compressed image
104
104
105
- This one fails because the compressed data do not seem to be
106
- finalized
105
+ In this version, keep the fits object open
107
106
"""
108
107
nrows = 5
109
108
ncols = 20
@@ -117,6 +116,7 @@ def _test_compressed_write_read_fitsobj(compress):
117
116
118
117
if 'lossless' in compress :
119
118
qlevel = None
119
+ # qlevel = 9999
120
120
else :
121
121
qlevel = 16
122
122
@@ -160,14 +160,6 @@ def _test_compressed_write_read_fitsobj(compress):
160
160
0.2 ,
161
161
"%s compressed images ('%s')" % (compress , dtype ),
162
162
)
163
- # else:
164
- # # for integers we have chosen a wide range of values, so
165
- # # there will be no quantization and we expect no
166
- # # information loss
167
- # compare_array(
168
- # data, rdata,
169
- # "%s compressed images ('%s')" % (compress, dtype)
170
- # )
171
163
172
164
with FITS (fname ) as fits :
173
165
for ii in range (len (dtypes )):
You can’t perform that action at this time.
0 commit comments