Skip to content

Commit

Permalink
Unpinning the max matplotlib version (#2040)
Browse files Browse the repository at this point in the history
  • Loading branch information
opotowsky authored Jan 3, 2025
1 parent ea73f1c commit 1920ff0
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 25 deletions.
11 changes: 6 additions & 5 deletions armi/bookkeeping/db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ def _readParams(h5group, compTypeName, comps, allowMissing=False):
)
)

if data.dtype.type is np.string_:
if data.dtype.type is np.bytes_:
data = np.char.decode(data)

if attrs.get("specialFormatting", False):
Expand Down Expand Up @@ -1291,7 +1291,7 @@ def getHistoriesByLocation(
)
raise

if data.dtype.type is np.string_:
if data.dtype.type is np.bytes_:
data = np.char.decode(data)

if dataSet.attrs.get("specialFormatting", False):
Expand Down Expand Up @@ -1394,8 +1394,9 @@ def getHistories(
# current time step and something has created the group to store aux data
continue

cycle = h5TimeNodeGroup.attrs["cycle"]
timeNode = h5TimeNodeGroup.attrs["timeNode"]
# might save as int or np.int64, so forcing int keeps things predictable
cycle = int(h5TimeNodeGroup.attrs["cycle"])
timeNode = int(h5TimeNodeGroup.attrs["timeNode"])
layout = Layout(
(self.versionMajor, self.versionMinor), h5group=h5TimeNodeGroup
)
Expand Down Expand Up @@ -1450,7 +1451,7 @@ def getHistories(
)
raise

if data.dtype.type is np.string_:
if data.dtype.type is np.bytes_:
data = np.char.decode(data)

if dataSet.attrs.get("specialFormatting", False):
Expand Down
5 changes: 4 additions & 1 deletion armi/bookkeeping/db/databaseInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def getHistory(
if nowRequested:
for param in params or history.keys():
if param == "location":
history[param][now] = tuple(comp.spatialLocator.indices)
# might save as int or np.int64, so forcing int keeps things predictable
history[param][now] = tuple(
int(i) for i in comp.spatialLocator.indices
)
else:
history[param][now] = comp.p[param]

Expand Down
4 changes: 2 additions & 2 deletions armi/reactor/assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ def getBlocksBetweenElevations(self, zLower, zUpper):
return blocksHere

def getParamValuesAtZ(
self, param, elevations, interpType="linear", fillValue=np.NaN
self, param, elevations, interpType="linear", fillValue=np.nan
):
"""
Interpolates a param axially to find it at any value of elevation z.
Expand Down Expand Up @@ -1070,7 +1070,7 @@ def getParamValuesAtZ(
)
return interpolator(elevations)

def getParamOfZFunction(self, param, interpType="linear", fillValue=np.NaN):
def getParamOfZFunction(self, param, interpType="linear", fillValue=np.nan):
"""
Interpolates a param axially to find it at any value of elevation z.
Expand Down
6 changes: 3 additions & 3 deletions armi/reactor/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(
material,
Tinput,
Thot,
area=np.NaN,
area=np.nan,
modArea=None,
isotopics=None,
mergeWith=None,
Expand Down Expand Up @@ -224,12 +224,12 @@ def __init__(
material,
Tinput,
Thot,
area=np.NaN,
area=np.nan,
op=None,
isotopics=None,
mergeWith=None,
components=None,
volume=np.NaN,
volume=np.nan,
):
Component.__init__(
self,
Expand Down
7 changes: 5 additions & 2 deletions armi/utils/mathematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@ def goalFunc(guess, func, positiveGuesses):
tol=tol,
options={"maxiter": maxIterations},
)
ans = float(X["x"])

# X returns `[num]` instead of `num`, so we have to grab the first/only element in that list
ans = float(X["x"][0])
if positiveGuesses is True:
ans = abs(ans)

Expand Down Expand Up @@ -515,7 +517,8 @@ def parabolaFromPoints(p1, p2, p3):
print("Error in parabola {} {}".format(A, b))
raise

return float(x[0]), float(x[1]), float(x[2])
# x[#] returns `[num]` instead of `num`, so we have to grab the first/only element in that list
return float(x[0][0]), float(x[1][0]), float(x[2][0])


def parabolicInterpolation(ap, bp, cp, targetY):
Expand Down
7 changes: 0 additions & 7 deletions armi/utils/tests/test_iterables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

"""Unittests for iterables.py."""
import time
import unittest

import numpy as np
Expand Down Expand Up @@ -69,20 +68,14 @@ def test_split(self):
self.assertEqual(unchu, data)

def test_packingAndUnpackingBinaryStrings(self):
start = time.perf_counter()
packed = iterables.packBinaryStrings(_TEST_DATA)
unpacked = iterables.unpackBinaryStrings(packed["turtle"][0])
timeDelta = time.perf_counter() - start
self.assertEqual(_TEST_DATA["turtle"], unpacked)
return timeDelta

def test_packingAndUnpackingHexStrings(self):
start = time.perf_counter()
packed = iterables.packHexStrings(_TEST_DATA)
unpacked = iterables.unpackHexStrings(packed["turtle"][0])
timeDelta = time.perf_counter() - start
self.assertEqual(_TEST_DATA["turtle"], unpacked)
return timeDelta

def test_sequenceInit(self):
# init an empty sequence
Expand Down
6 changes: 3 additions & 3 deletions armi/utils/tests/test_tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_numpyRecordArray(self):
[("Alice", 23, 169.5), ("Bob", 27, 175.0)],
dtype={
"names": ["name", "age", "height"],
"formats": ["a32", "uint8", "float32"],
"formats": ["S32", "uint8", "float32"],
},
)
expected = "\n".join(
Expand All @@ -233,7 +233,7 @@ def test_numpyRecordArrayKeys(self):
[("Alice", 23, 169.5), ("Bob", 27, 175.0)],
dtype={
"names": ["name", "age", "height"],
"formats": ["a32", "uint8", "float32"],
"formats": ["S32", "uint8", "float32"],
},
)
expected = "\n".join(
Expand All @@ -253,7 +253,7 @@ def test_numpyRecordArrayHeaders(self):
[("Alice", 23, 169.5), ("Bob", 27, 175.0)],
dtype={
"names": ["name", "age", "height"],
"formats": ["a32", "uint8", "float32"],
"formats": ["S32", "uint8", "float32"],
},
)
expected = "\n".join(
Expand Down
2 changes: 1 addition & 1 deletion armi/utils/tests/test_textProcessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_readFile(self):

def test_readFileWithPattern(self):
with textProcessors.SequentialReader(self._DUMMY_FILE_NAME) as sr:
self.assertTrue(sr.searchForPattern("(X\s+Y\s+\d+\.\d+)"))
self.assertTrue(sr.searchForPattern(r"(X\s+Y\s+\d+\.\d+)"))
self.assertEqual(float(sr.line.split()[2]), 3.5)

def test_issueWarningOnFindingText(self):
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ dependencies = [
"h5py>=3.0,<=3.9 ; python_version < '3.11.0'",
"h5py>=3.9 ; python_version >= '3.11.0'", # Needed because our database files are H5 format
"htmltree>=0.7.6", # Our reports have HTML output
"matplotlib>=3.5.3,<3.8.0", # Important plotting library
"matplotlib>=3.5.3,<3.8.0 ; python_version < '3.11.0'",
"matplotlib>=3.5.3 ; python_version >= '3.11.0'", # Important plotting library
"numpy>=1.21", # Important math library
"ordered-set>=3.1.1", # A useful data structure
"pluggy>=1.2.0", # Central tool behind the ARMI Plugin system
Expand Down

0 comments on commit 1920ff0

Please sign in to comment.