Skip to content

Commit

Permalink
Made the x-limit determining code in ScalingRelation a little more ro…
Browse files Browse the repository at this point in the history
…bust I hope - used nanargmax and nanargmin rather than just argmax and argmin
  • Loading branch information
DavidT3 committed Jan 28, 2025
1 parent bcbe92a commit 3160d9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xga/products/relation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner ([email protected]) 28/01/2025, 11:56. Copyright (c) The Contributors
# Last modified by David J Turner ([email protected]) 28/01/2025, 12:07. Copyright (c) The Contributors

import inspect
import pickle
Expand Down Expand Up @@ -935,12 +935,12 @@ def get_view(self, ax: Axes, x_lims: Quantity = None, log_scale: bool = True, pl
'scaling relation ({xr}).'.format(xl=x_lims.unit.to_string(),
xr=self.x_unit.to_string()))
elif x_lims is None and len(self._x_data) != 0:
max_x_ind = np.argmax(self._x_data)
min_x_ind = np.argmin(self._x_data)
max_x_ind = np.nanargmax(self._x_data)
min_x_ind = np.nanargmin(self._x_data)
x_lims = [0.9 * (self._x_data[min_x_ind].value - self._x_err[min_x_ind].value),
1.1 * (self._x_data[max_x_ind].value + self._x_err[max_x_ind].value)]
elif x_lims is None and len(self._x_data) == 0:
raise ValueError('There is no data available to infer suitable axis limits from, please pass x limits.')
raise ValueError('There are no data available to infer suitable axis limits from, please pass x limits.')

# Just grabs the model colour from the property if the user doesn't set a value for model_colour
if model_colour is None:
Expand Down

0 comments on commit 3160d9c

Please sign in to comment.