Skip to content

Commit 75a5833

Browse files
ric-evansgithub-actions
andcommitted
Production Readiness (#68)
Co-authored-by: github-actions <[email protected]>
1 parent 1aee7a5 commit 75a5833

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

skymap_scanner/utils/scan_result.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ class InvalidPixelValueError(Exception):
1616

1717

1818
class ScanResult:
19-
"""
20-
This class parses a nsides_dict and stores
21-
the relevant numeric result of the scan. Ideally it should serve as
22-
the basic data structure for plotting / processing / transmission of
23-
the scan result.
19+
"""This class parses a nsides_dict and stores the relevant numeric result
20+
of the scan. Ideally it should serve as the basic data structure for
21+
plotting / processing / transmission of the scan result.
2422
2523
nsides_dict is a dictionary keyed by 'nside' values for which a scan
2624
result is available (e.g. 8, 64, 512), see `pixelreco.NSidesDict`.
@@ -81,7 +79,8 @@ def __eq__(self, other: object) -> bool:
8179
def is_close_datapoint(
8280
self, s_val: float, o_val: float, field: str, equal_nan: bool
8381
) -> Tuple[float, bool]:
84-
"""Get the diff float-value and test truth-value for the 2 pixel datapoints."""
82+
"""Get the diff float-value and test truth-value for the 2 pixel
83+
datapoints."""
8584
if field not in self.require_close:
8685
raise ValueError(
8786
f"Datapoint field ({field}) cannot be compared by "
@@ -113,7 +112,8 @@ def diff_pixel_data(
113112
equal_nan: bool,
114113
do_disqualify_zero_energy_pixels: bool, # TODO: remove?
115114
) -> Tuple[List[float], List[bool]]:
116-
"""Get the diff float-values and test truth-values for the 2 pixel-data.
115+
"""Get the diff float-values and test truth-values for the 2 pixel-
116+
data.
117117
118118
The datapoints are compared face-to-face (zipped).
119119
@@ -162,8 +162,8 @@ def is_close(
162162
dump_json_diff: Optional[Path] = None,
163163
do_disqualify_zero_energy_pixels: bool = False, # TODO: remove?
164164
) -> bool:
165-
"""
166-
Checks if two results are close by requiring strict equality on pixel indices and close condition on numeric results.
165+
"""Checks if two results are close by requiring strict equality on
166+
pixel indices and close condition on numeric results.
167167
168168
Optionally, pass a `Path` for `dump_json_diff` to get a json
169169
file containing every diff at the pixel-data level.
@@ -247,9 +247,7 @@ def parse_nside(key):
247247

248248
@classmethod
249249
def from_nsides_dict(cls, nsides_dict: NSidesDict) -> "ScanResult":
250-
"""
251-
Factory method for nsides_dict
252-
"""
250+
"""Factory method for nsides_dict."""
253251
result = cls.load_pixels(nsides_dict)
254252
return cls(result)
255253

@@ -290,9 +288,8 @@ def load_pixels(cls, nsides_dict: NSidesDict):
290288
"""
291289

292290
def get_nside_string(self):
293-
"""
294-
Returns a string string listing the nside values to be included in the output filename.
295-
"""
291+
"""Returns a string string listing the nside values to be included in
292+
the output filename."""
296293
# keys have a 'nside-NNN' format but we just want to extract the nside values to build the string
297294
# parsing back and forth numbers to strings is not the most elegant choice but works for now
298295
# TODO: possibly better to use integer values as keys in self.result

0 commit comments

Comments
 (0)