From e4166cb579f13d77cd437f3023f6b6dd30d6ee95 Mon Sep 17 00:00:00 2001 From: Patrick Austin Date: Mon, 13 Nov 2023 15:09:29 +0000 Subject: [PATCH] Use items() instead of keys() for clarity #77 --- muspinsim/simconfig.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/muspinsim/simconfig.py b/muspinsim/simconfig.py index c48394d..9b625b5 100644 --- a/muspinsim/simconfig.py +++ b/muspinsim/simconfig.py @@ -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 @@ -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 "