Skip to content

Commit

Permalink
feat: result value above 100% for mapping saturation (#479)
Browse files Browse the repository at this point in the history
* feat: add classification and plot creation for over 100% results

* feat: new indicator classification

* add: revert else-statement

---------

Co-authored-by: Levi Szamek <[email protected]>
Co-authored-by: Jonas <[email protected]>
  • Loading branch information
3 people authored and matthiasschaub committed Mar 21, 2023
1 parent 492610b commit d5999ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def __init__(
self.upper_threshold = 0.97 # Threshold derived from Gröchenig et al.
# TODO: What is a good lower threshold?
self.lower_threshold = 0.30
self.above_one_lower_threshold = 1.3
self.above_one_upper_threshold = 1.5

# Attributes needed for result determination
self.best_fit: Optional[models.BaseStatModel] = None
Expand Down Expand Up @@ -124,6 +126,16 @@ def calculate(self) -> None:
self.result.class_ = 3
elif self.lower_threshold >= self.result.value > 0:
self.result.class_ = 1
elif self.above_one_lower_threshold >= self.result.value > 1:
self.result.class_ = 5
elif (
self.above_one_upper_threshold
>= self.result.value
> self.above_one_lower_threshold
):
self.result.class_ = 3
elif self.result.value > self.above_one_upper_threshold:
self.result.class_ = 1
else:
raise ValueError(
"Result value (saturation) is an unexpected value: {}".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def test(self):
self.assertIsNotNone(indicator.best_fit)
self.assertTrue(indicator.fitted_models)

self.assertLessEqual(indicator.result.value, 1.0)
self.assertGreaterEqual(indicator.result.value, 0.0)

self.assertIsNotNone(indicator.result.label)
Expand Down

0 comments on commit d5999ac

Please sign in to comment.