Skip to content

Commit a331718

Browse files
committed
merge
2 parents 1da50f4 + 2485318 commit a331718

3 files changed

Lines changed: 24 additions & 8 deletions

File tree

autoarray/mask/abstract_mask.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
if use_jax:
99
import jax
10-
from pathlib import Path
11-
from typing import Dict, Union
10+
11+
import numpy as np
12+
from typing import Dict
1213

1314
from autoconf.fitsable import output_to_fits
1415

autoarray/mask/mask_1d.py

Lines changed: 8 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
@@ -20,6 +21,10 @@
2021
logger = logging.getLogger(__name__)
2122

2223

24+
class Mask1DKeys(Enum):
25+
PIXSCA = "PIXSCA"
26+
ORIGIN = "ORIGIN"
27+
2328
class Mask1D(Mask):
2429
def __init__(
2530
self,
@@ -172,7 +177,8 @@ def header_dict(self) -> Dict:
172177
-------
173178
A dictionary containing the pixel scale of the mask, which can be output to a .fits file.
174179
"""
180+
175181
return {
176-
"PIXSCA": self.pixel_scales[0],
177-
"ORIGIN": self.origin[0],
182+
Mask1DKeys.PIXSCA: self.pixel_scales[0],
183+
Mask1DKeys.ORIGIN: self.origin[0],
178184
}

autoarray/mask/mask_2d.py

Lines changed: 13 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
@@ -30,6 +31,13 @@
3031
logger = logging.getLogger(__name__)
3132

3233

34+
class Mask2DKeys(Enum):
35+
PIXSCAY = "PIXSCAY"
36+
PIXSCAX = "PIXSCAX"
37+
ORIGINY = "ORIGINY"
38+
ORIGINX = "ORIGINX"
39+
40+
3341
class Mask2D(Mask):
3442
# noinspection PyUnusedLocal
3543
def __init__(
@@ -657,11 +665,12 @@ def header_dict(self) -> Dict:
657665
-------
658666
A dictionary containing the pixel scale of the mask, which can be output to a .fits file.
659667
"""
668+
660669
return {
661-
"PIXSCAY": self.pixel_scales[0],
662-
"PIXSCAX": self.pixel_scales[1],
663-
"ORIGINY": self.origin[0],
664-
"ORIGINX": self.origin[1],
670+
Mask2DKeys.PIXSCAY: self.pixel_scales[0],
671+
Mask2DKeys.PIXSCAX: self.pixel_scales[1],
672+
Mask2DKeys.ORIGINY: self.origin[0],
673+
Mask2DKeys.ORIGINX: self.origin[1],
665674
}
666675

667676
@property

0 commit comments

Comments
 (0)