11"""
2- This file contains the FITS compression algorithms in numcodecs style Codecs.
3-
4- This module is currently private as these classes have not been tested
5- externally to Astropy and their behaviour may have to change.
2+ This module contains the FITS compression algorithms in numcodecs style Codecs.
63"""
74from gzip import compress as gzip_compress
85from gzip import decompress as gzip_decompress
96
107import numpy as np
118
12- from astropy .io .fits .tiled_compression ._compression import (
9+ from astropy .io .fits ._tiled_compression ._compression import (
1310 compress_hcompress_1_c ,
1411 compress_plio_1_c ,
1512 compress_rice_1_c ,
@@ -63,7 +60,7 @@ def decode(self, buf):
6360 """
6461 cbytes = np .frombuffer (buf , dtype = np .uint8 ).tobytes ()
6562 dbytes = gzip_decompress (cbytes )
66- return np .frombuffer (dbytes , dtype = np .uint8 ). data
63+ return np .frombuffer (dbytes , dtype = np .uint8 )
6764
6865 def encode (self , buf ):
6966 """
@@ -117,7 +114,7 @@ class Gzip2(Codec):
117114
118115 codec_id = "FITS_GZIP2"
119116
120- def __init__ (self , itemsize : int ):
117+ def __init__ (self , * , itemsize : int ):
121118 super ().__init__ ()
122119 self .itemsize = itemsize
123120
@@ -139,7 +136,7 @@ def decode(self, buf):
139136 # Start off by unshuffling buffer
140137 unshuffled_buffer = gzip_decompress (cbytes )
141138 array = np .frombuffer (unshuffled_buffer , dtype = np .uint8 )
142- return array .reshape ((self .itemsize , - 1 )).T .ravel (). data
139+ return array .reshape ((self .itemsize , - 1 )).T .ravel ()
143140
144141 def encode (self , buf ):
145142 """
@@ -191,7 +188,7 @@ class Rice1(Codec):
191188
192189 codec_id = "FITS_RICE1"
193190
194- def __init__ (self , blocksize : int , bytepix : int , tilesize : int ):
191+ def __init__ (self , * , blocksize : int , bytepix : int , tilesize : int ):
195192 self .blocksize = blocksize
196193 self .bytepix = bytepix
197194 self .tilesize = tilesize
@@ -214,7 +211,7 @@ def decode(self, buf):
214211 dbytes = decompress_rice_1_c (
215212 cbytes , self .blocksize , self .bytepix , self .tilesize
216213 )
217- return np .frombuffer (dbytes , dtype = f"i{ self .bytepix } " ). data
214+ return np .frombuffer (dbytes , dtype = f"i{ self .bytepix } " )
218215
219216 def encode (self , buf ):
220217 """
@@ -248,7 +245,7 @@ class PLIO1(Codec):
248245
249246 codec_id = "FITS_PLIO1"
250247
251- def __init__ (self , tilesize : int ):
248+ def __init__ (self , * , tilesize : int ):
252249 self .tilesize = tilesize
253250
254251 def decode (self , buf ):
@@ -267,7 +264,7 @@ def decode(self, buf):
267264 """
268265 cbytes = np .frombuffer (buf , dtype = np .uint8 ).tobytes ()
269266 dbytes = decompress_plio_1_c (cbytes , self .tilesize )
270- return np .frombuffer (dbytes , dtype = "i4" ). data
267+ return np .frombuffer (dbytes , dtype = "i4" )
271268
272269 def encode (self , buf ):
273270 """
@@ -316,7 +313,7 @@ class HCompress1(Codec):
316313
317314 codec_id = "FITS_HCOMPRESS1"
318315
319- def __init__ (self , scale : int , smooth : bool , bytepix : int , nx : int , ny : int ):
316+ def __init__ (self , * , scale : int , smooth : bool , bytepix : int , nx : int , ny : int ):
320317 self .scale = scale
321318 self .smooth = smooth
322319 self .bytepix = bytepix
@@ -342,7 +339,7 @@ def decode(self, buf):
342339 dbytes = decompress_hcompress_1_c (
343340 cbytes , self .nx , self .ny , self .scale , self .smooth , self .bytepix
344341 )
345- return np .frombuffer (dbytes , dtype = f"i{ self .bytepix } " ). data
342+ return np .frombuffer (dbytes , dtype = f"i{ self .bytepix } " )
346343
347344 def encode (self , buf ):
348345 """
0 commit comments