Skip to content

Commit

Permalink
update naming and doc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
TjarkMiener committed Jul 27, 2024
1 parent e5382f2 commit cc91abf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions src/ctapipe/calib/camera/outlier.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""

__all__ = [
"OutlierDetection",
"RangeBasedOutlierDetection",
"MedianBasedOutlierDetection",
"StdBasedOutlierDetection",
"OutlierDetector",
"RangeBasedOutlierDetector",
"MedianBasedOutlierDetector",
"StdBasedOutlierDetector",
]

from abc import abstractmethod
Expand All @@ -17,7 +17,7 @@
from ctapipe.core.traits import List


class OutlierDetection(TelescopeComponent):
class OutlierDetector(TelescopeComponent):
"""
Base class for outlier detection algorithms.
"""
Expand Down Expand Up @@ -54,9 +54,9 @@ def __call__(self, column) -> bool:
pass


class RangeBasedOutlierDetection(OutlierDetection):
class RangeBasedOutlierDetector(OutlierDetector):
"""
Remove outliers based on a valid range.
Detect outliers based on a valid range.
The interval `outliers_interval` corresponds to a range of valid statistical values.
"""
Expand All @@ -70,7 +70,7 @@ def __call__(self, column):
return outliers


class MedianBasedOutlierDetection(OutlierDetection):
class MedianBasedOutlierDetector(OutlierDetector):
"""
Detect outliers based on the deviation from the camera median.
Expand All @@ -90,7 +90,7 @@ def __call__(self, column):
return outliers


class StdBasedOutlierDetection(OutlierDetection):
class StdBasedOutlierDetector(OutlierDetector):
"""
Detect outliers based on the deviation from the camera standard deviation.
Expand Down
26 changes: 13 additions & 13 deletions src/ctapipe/calib/camera/tests/test_outlier.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"""
Tests for OutlierDetection and related functions
Tests for OutlierDetector and related functions
"""

import numpy as np
from astropy.table import Table

from ctapipe.calib.camera.outlier import (
MedianBasedOutlierDetection,
RangeBasedOutlierDetection,
StdBasedOutlierDetection,
MedianBasedOutlierDetector,
RangeBasedOutlierDetector,
StdBasedOutlierDetector,
)


def test_range_based_outlier_detection(example_subarray):
"""test range based outlier detection"""
def test_range_based_detection(example_subarray):
"""test the RangeBasedOutlierDetector"""

# Create dummy data for testing
rng = np.random.default_rng(0)
Expand All @@ -27,7 +27,7 @@ def test_range_based_outlier_detection(example_subarray):
# Initialize the outlier detector based on the range of valid values
# In this test, the interval [15, 25] corresponds to the range (in waveform samples)
# of accepted mean (or median) values of peak times of flat-field events
detector = RangeBasedOutlierDetection(
detector = RangeBasedOutlierDetector(
subarray=example_subarray, outliers_interval=[15, 25]
)
# Detect outliers
Expand All @@ -40,8 +40,8 @@ def test_range_based_outlier_detection(example_subarray):
np.testing.assert_array_equal(outliers, expected_outliers)


def test_median_based_outlier_detection(example_subarray):
"""test median based outlier detection"""
def test_median_based_detection(example_subarray):
"""test the MedianBasedOutlierDetector"""

# Create dummy data for testing
rng = np.random.default_rng(0)
Expand All @@ -55,7 +55,7 @@ def test_median_based_outlier_detection(example_subarray):
# Initialize the outlier detector based on the deviation from the camera median
# In this test, the interval [-0.9, 8] corresponds to multiplication factors
# typical used for the median values of charge images of flat-field events
detector = MedianBasedOutlierDetection(
detector = MedianBasedOutlierDetector(
subarray=example_subarray, outliers_interval=[-0.9, 8]
)
# Detect outliers
Expand All @@ -68,8 +68,8 @@ def test_median_based_outlier_detection(example_subarray):
np.testing.assert_array_equal(outliers, expected_outliers)


def test_std_based_outlier_detection(example_subarray):
"""test std based outlier detection"""
def test_std_based_detection(example_subarray):
"""test the StdBasedOutlierDetector"""

# Create dummy data for testing
rng = np.random.default_rng(0)
Expand All @@ -88,7 +88,7 @@ def test_std_based_outlier_detection(example_subarray):
# In this test, the interval [-15, 15] corresponds to multiplication factors
# typical used for the std values of charge images of flat-field events
# and median (and std) values of charge images of pedestal events
detector = StdBasedOutlierDetection(
detector = StdBasedOutlierDetector(
subarray=example_subarray, outliers_interval=[-15, 15]
)
ff_outliers = detector(ff_table["std"])
Expand Down

0 comments on commit cc91abf

Please sign in to comment.