@@ -65,6 +65,12 @@ class RangeOutlierDetector(OutlierDetector):
6565 ).tag (config = True )
6666
6767 def __call__ (self , column ):
68+ # Validate that the shape of the statistic values has three dimensions
69+ if column .ndim != 3 :
70+ raise ValueError (
71+ f"Invalid shape of the column '{ column .name } ': '{ column .shape } '. "
72+ "Expected the statistic values of shape (n_entries, n_channels, n_pixels)."
73+ )
6874 # Remove outliers is statistical values out a given range
6975 outliers = np .logical_or (
7076 column < self .validity_range [0 ],
@@ -93,6 +99,12 @@ class MedianOutlierDetector(OutlierDetector):
9399 ).tag (config = True )
94100
95101 def __call__ (self , column ):
102+ # Validate that the shape of the statistic values has three dimensions
103+ if column .ndim != 3 :
104+ raise ValueError (
105+ f"Invalid shape of the column '{ column .name } ': '{ column .shape } '. "
106+ "Expected the statistic values of shape (n_entries, n_channels, n_pixels)."
107+ )
96108 # Camera median
97109 camera_median = np .ma .median (column , axis = 2 )
98110 # Detect outliers based on the deviation of the median distribution
@@ -124,6 +136,12 @@ class StdOutlierDetector(OutlierDetector):
124136 ).tag (config = True )
125137
126138 def __call__ (self , column ):
139+ # Validate that the shape of the statistic values has three dimensions
140+ if column .ndim != 3 :
141+ raise ValueError (
142+ f"Invalid shape of the column '{ column .name } ': '{ column .shape } '. "
143+ "Expected the statistic values of shape (n_entries, n_channels, n_pixels)."
144+ )
127145 # Camera median
128146 camera_median = np .ma .median (column , axis = 2 )
129147 # Camera std
0 commit comments