Skip to content

Commit

Permalink
Use items() instead of keys() for clarity #77
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Nov 13, 2023
1 parent 08a3430 commit e4166cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions muspinsim/simconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def __init__(self, params={}, use_experimental_x_axis: bool = True):
if len(self._file_ranges) > 0:
raise MuSpinConfigError("Can not have file ranges when fitting")

xname = list(self._x_range.keys())[0]
xname, xvalue = list(self._x_range.items())[0]
self._constants.pop(xname, None) # Just in case it was here

if self._x_range[xname] is None:
if xvalue is None:
# Can happen when xname keyword is a single value, and so not assigned
# In this case, we must use the experimental data, as that's the only
# x_range we have
Expand All @@ -211,8 +211,8 @@ def __init__(self, params={}, use_experimental_x_axis: bool = True):
"specified 'x_axis' will only be used to generate final "
".dat file"
)
below_min = self._x_range[xname] < experimental_x_range[0]
above_max = self._x_range[xname] > experimental_x_range[-1]
below_min = xvalue < experimental_x_range[0]
above_max = xvalue > experimental_x_range[-1]
if np.all(above_max) or np.all(below_min):
logging.warning(
"All points on specified 'x_axis' are outside the "
Expand Down

0 comments on commit e4166cb

Please sign in to comment.