Skip to content

Commit 5400e05

Browse files
committed
Enhances exclusion handling in Plotter class
1 parent c398ea4 commit 5400e05

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/easydiffraction/plotting/plotting.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,13 @@ def plot_meas(self,
141141
x_max=x_max)
142142

143143
# Exclude points based on the pattern's excluded mask
144-
excluded = pattern.excluded
145-
x = x[~excluded]
146-
y_meas = y_meas[~excluded]
144+
if pattern.excluded is not None:
145+
excluded = self._filtered_y_array(y_array=pattern.excluded,
146+
x_array=pattern.x,
147+
x_min=x_min,
148+
x_max=x_max)
149+
x = x[~excluded]
150+
y_meas = y_meas[~excluded]
147151

148152
y_series = [y_meas]
149153
y_labels = ['meas']
@@ -182,9 +186,13 @@ def plot_calc(self,
182186
x_max=x_max)
183187

184188
# Exclude points based on the pattern's excluded mask
185-
excluded = pattern.excluded
186-
x = x[~excluded]
187-
y_calc = y_calc[~excluded]
189+
if pattern.excluded is not None:
190+
excluded = self._filtered_y_array(y_array=pattern.excluded,
191+
x_array=pattern.x,
192+
x_min=x_min,
193+
x_max=x_max)
194+
x = x[~excluded]
195+
y_calc = y_calc[~excluded]
188196

189197
y_series = [y_calc]
190198
y_labels = ['calc']
@@ -231,10 +239,14 @@ def plot_meas_vs_calc(self,
231239
x_max=x_max)
232240

233241
# Exclude points based on the pattern's excluded mask
234-
excluded = pattern.excluded
235-
x = x[~excluded]
236-
y_meas = y_meas[~excluded]
237-
y_calc = y_calc[~excluded]
242+
if pattern.excluded is not None:
243+
excluded = self._filtered_y_array(y_array=pattern.excluded,
244+
x_array=pattern.x,
245+
x_min=x_min,
246+
x_max=x_max)
247+
x = x[~excluded]
248+
y_meas = y_meas[~excluded]
249+
y_calc = y_calc[~excluded]
238250

239251
y_series = [y_meas, y_calc]
240252
y_labels = ['meas', 'calc']

0 commit comments

Comments
 (0)