Skip to content

Commit 04b876a

Browse files
committed
support enums
1 parent bb30c04 commit 04b876a

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

autoarray/mask/abstract_mask.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
from abc import ABC
44
import logging
55
import numpy as np
6-
from pathlib import Path
7-
from typing import Dict, Union
6+
from typing import Dict
87

98
from autoconf.fitsable import output_to_fits
109

autoarray/mask/mask_1d.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from enum import Enum
34
import logging
45
import numpy as np
56
from pathlib import Path
@@ -172,7 +173,11 @@ def header_dict(self) -> Dict:
172173
-------
173174
A dictionary containing the pixel scale of the mask, which can be output to a .fits file.
174175
"""
176+
class GridKeys(Enum):
177+
PIXSCA = "PIXSCA"
178+
ORIGIN = "ORIGIN"
179+
175180
return {
176-
"PIXSCA": self.pixel_scales[0],
177-
"ORIGIN": self.origin[0],
181+
GridKeys.PIXSCA: self.pixel_scales[0],
182+
GridKeys.ORIGIN: self.origin[0],
178183
}

autoarray/mask/mask_2d.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22
import logging
3+
from enum import Enum
34
import numpy as np
45
from pathlib import Path
56
from typing import TYPE_CHECKING, Dict, List, Tuple, Union
@@ -716,11 +717,18 @@ def header_dict(self) -> Dict:
716717
-------
717718
A dictionary containing the pixel scale of the mask, which can be output to a .fits file.
718719
"""
720+
721+
class GridKeys(Enum):
722+
PIXSCAY = "PIXSCAY"
723+
PIXSCAX = "PIXSCAX"
724+
ORIGINY = "ORIGINY"
725+
ORIGINX = "ORIGINX"
726+
719727
return {
720-
"PIXSCAY": self.pixel_scales[0],
721-
"PIXSCAX": self.pixel_scales[1],
722-
"ORIGINY": self.origin[0],
723-
"ORIGINX": self.origin[1],
728+
GridKeys.PIXSCAY: self.pixel_scales[0],
729+
GridKeys.PIXSCAX: self.pixel_scales[1],
730+
GridKeys.ORIGINY: self.origin[0],
731+
GridKeys.ORIGINX: self.origin[1],
724732
}
725733

726734
@property

0 commit comments

Comments
 (0)