22
33# These attributes don't end up in the hdulist and
44# instead will be stored in "attrs"
5- _WCS_ATTRS = ("naxis" , "_naxis " , "colsel" , "keysel" , "key" , "pixel_bounds" )
5+ _WCS_ATTRS = ("naxis" , "pixel_shape " , "colsel" , "keysel" , "key" , "pixel_bounds" )
66
77
88class WCSConverter (Converter ):
@@ -18,22 +18,21 @@ def from_yaml_tree(self, node, tag, ctx):
1818 if naxis := attrs .pop ("naxis" ):
1919 hdulist [0 ].header ["naxis" ] = naxis
2020
21- _naxis = attrs . pop ( "_naxis" )
22-
21+ # pop attrs that are not valid kwargs
22+ pixel_shape = attrs . pop ( "pixel_shape" )
2323 pixel_bounds = attrs .pop ("pixel_bounds" )
2424
2525 wcs = WCS (hdulist [0 ].header , fobj = hdulist , ** attrs )
2626
27+ wcs .pixel_shape = pixel_shape
28+ wcs .pixel_bounds = pixel_bounds
29+
2730 if wcs .sip is not None :
2831 # work around a bug in astropy where sip headers lose precision
2932 # see https://github.com/astropy/astropy/issues/17334
3033 wcs .sip = wcs ._read_sip_kw (hdulist [0 ].header , attrs .get ("key" , " " ))
3134 wcs .wcs .set ()
3235
33- wcs .pixel_bounds = pixel_bounds
34-
35- if _naxis :
36- wcs ._naxis = _naxis
3736 return wcs
3837
3938 def to_yaml_tree (self , wcs , tag , ctx ):
0 commit comments