From 39f0a1f83f8b32ecd522a3d762e7c2a92c0d5477 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 00:58:05 +0000 Subject: [PATCH 01/16] does this break something? --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index affae444d..b239629a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ 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", # 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 From 681b6dfb3e3d6a6a74de33bc87a1cb01b4a44ec5 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 02:51:35 +0000 Subject: [PATCH 02/16] updates for numpy > v2 --- armi/bookkeeping/db/database.py | 6 +++--- armi/reactor/assemblies.py | 4 ++-- armi/reactor/components/__init__.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/armi/bookkeeping/db/database.py b/armi/bookkeeping/db/database.py index 5a718cda8..c033617d8 100644 --- a/armi/bookkeeping/db/database.py +++ b/armi/bookkeeping/db/database.py @@ -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): @@ -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): @@ -1450,7 +1450,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): diff --git a/armi/reactor/assemblies.py b/armi/reactor/assemblies.py index 149c04690..c36833513 100644 --- a/armi/reactor/assemblies.py +++ b/armi/reactor/assemblies.py @@ -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. @@ -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. diff --git a/armi/reactor/components/__init__.py b/armi/reactor/components/__init__.py index 953d12d22..8b5a938a2 100644 --- a/armi/reactor/components/__init__.py +++ b/armi/reactor/components/__init__.py @@ -132,7 +132,7 @@ def __init__( material, Tinput, Thot, - area=np.NaN, + area=np.nan, modArea=None, isotopics=None, mergeWith=None, @@ -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, From 867c0f9f573f9a8d17e62444bfc900a8bc25e882 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 02:52:16 +0000 Subject: [PATCH 03/16] try this --- pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b239629a6..2dafda6ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,10 +31,11 @@ authors = [ ] dependencies = [ "coverage>=7.2.0", # Code coverage tool. Sadly baked into every Case. - "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 + "h5py>=3.0,<=3.9 ; python_version < '3.10.0'", + "h5py>=3.9 ; python_version >= '3.10.0'", # Needed because our database files are H5 format "htmltree>=0.7.6", # Our reports have HTML output - "matplotlib>=3.5.3", # 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 From 09dd08c91e8f90ee07912f9f4f20dc5bb8b90d0a Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 03:34:41 +0000 Subject: [PATCH 04/16] just get the test to pass rather than worry about fixing the root issue ;-) --- armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt b/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt index c8911acb8..2e7d6e4b4 100644 --- a/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt +++ b/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt @@ -1,5 +1,5 @@ - (0,0) (0,1) -0.00000E+00 0.00000E+00 + (np.int64(0),np.int64(0)) (0,1) + 0.00000E+00 0.00000E+00 key: residence @@ -33,7 +33,7 @@ key: ztop key: location -(7,-1,0) (0,0,0) +(7,-1,0) (np.int64(0),np.int64(0),np.int64(0)) EOL bottom top center From 500311bb4727c2bd2299cf4f2ac5a520bb29217f Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 04:04:23 +0000 Subject: [PATCH 05/16] try this --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2dafda6ee..3ec8c921d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,8 @@ dependencies = [ "ruamel.yaml.clib ; python_version >= '3.11.0'", # C-based core of ruamel below "ruamel.yaml.clib<=0.2.7 ; python_version < '3.11.0'", # C-based core of ruamel below "ruamel.yaml<=0.17.21 ; python_version < '3.11.0'", # Our foundational YAML library - "scipy>=1.7.0", # Used for curve-fitting and matrix math + "scipy<1.14.0 ; python_version <= '3.10.0'", + "scipy>=1.7.0 ; python_version > '3.10.0'", # Used for curve-fitting and matrix math "toml>0.9.5", # Needed to parse the pyproject.toml file "voluptuous>=0.12.1", # Used to validate YAML data files "yamlize==0.7.1", # Custom YAML-to-object library From 99ff95a34a1558d8b9f866a72f5fadb45af5b485 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Fri, 27 Dec 2024 22:31:51 -0600 Subject: [PATCH 06/16] Apply suggestions from code review --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3ec8c921d..f9ed1db87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "h5py>=3.0,<=3.9 ; python_version < '3.10.0'", "h5py>=3.9 ; python_version >= '3.10.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 ; python_version < '3.11.0'", + "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 From 7dcd5d124dccb92e27484aad85190846dee01ea0 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Sat, 28 Dec 2024 04:43:37 +0000 Subject: [PATCH 07/16] undo h5py and scipy changes. make sure 3.10 and 3.9 are only failing with the one test --- pyproject.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3ec8c921d..c21d901d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,8 +31,8 @@ authors = [ ] dependencies = [ "coverage>=7.2.0", # Code coverage tool. Sadly baked into every Case. - "h5py>=3.0,<=3.9 ; python_version < '3.10.0'", - "h5py>=3.9 ; python_version >= '3.10.0'", # Needed because our database files are H5 format + "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 ; python_version < '3.11.0'", "matplotlib>=3.5.3 ; python_version >= '3.11.0'", # Important plotting library @@ -46,8 +46,7 @@ dependencies = [ "ruamel.yaml.clib ; python_version >= '3.11.0'", # C-based core of ruamel below "ruamel.yaml.clib<=0.2.7 ; python_version < '3.11.0'", # C-based core of ruamel below "ruamel.yaml<=0.17.21 ; python_version < '3.11.0'", # Our foundational YAML library - "scipy<1.14.0 ; python_version <= '3.10.0'", - "scipy>=1.7.0 ; python_version > '3.10.0'", # Used for curve-fitting and matrix math + "scipy>=1.7.0", # Used for curve-fitting and matrix math "toml>0.9.5", # Needed to parse the pyproject.toml file "voluptuous>=0.12.1", # Used to validate YAML data files "yamlize==0.7.1", # Custom YAML-to-object library From d0c3642b85390df7355bc59c13f3f2e095f40c90 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 04:39:23 +0000 Subject: [PATCH 08/16] undo temp ref test update --- armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt b/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt index 2e7d6e4b4..c8911acb8 100644 --- a/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt +++ b/armi/bookkeeping/tests/armiRun-A0032-aHist-ref.txt @@ -1,5 +1,5 @@ - (np.int64(0),np.int64(0)) (0,1) - 0.00000E+00 0.00000E+00 + (0,0) (0,1) +0.00000E+00 0.00000E+00 key: residence @@ -33,7 +33,7 @@ key: ztop key: location -(7,-1,0) (np.int64(0),np.int64(0),np.int64(0)) +(7,-1,0) (0,0,0) EOL bottom top center From e89d08bd582b1bd1a301bbc9afc1ffe177b92695 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 05:50:10 +0000 Subject: [PATCH 09/16] found some spots to force int so we don't end up with np.int64 in a string --- armi/bookkeeping/db/database.py | 5 +++-- armi/bookkeeping/db/databaseInterface.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/armi/bookkeeping/db/database.py b/armi/bookkeeping/db/database.py index c033617d8..672e905fd 100644 --- a/armi/bookkeeping/db/database.py +++ b/armi/bookkeeping/db/database.py @@ -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 ) diff --git a/armi/bookkeeping/db/databaseInterface.py b/armi/bookkeeping/db/databaseInterface.py index fd5ebbd2b..3353ef8fa 100644 --- a/armi/bookkeeping/db/databaseInterface.py +++ b/armi/bookkeeping/db/databaseInterface.py @@ -390,7 +390,8 @@ 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] From 92feead1597183473c55d5b1264b5dc62fc9ab13 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 05:50:36 +0000 Subject: [PATCH 10/16] see if we can remove the matplotlib pin alone --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0de69c1e2..b239629a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,8 +34,7 @@ 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 ; python_version < '3.11.0'", - "matplotlib>=3.5.3 ; python_version >= '3.11.0'", # Important plotting library + "matplotlib>=3.5.3", # 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 From 1483a9e2f0a91852247904588e9e3bdd43ae4921 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 05:55:23 +0000 Subject: [PATCH 11/16] black --- armi/bookkeeping/db/databaseInterface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/armi/bookkeeping/db/databaseInterface.py b/armi/bookkeeping/db/databaseInterface.py index 3353ef8fa..d5850ed35 100644 --- a/armi/bookkeeping/db/databaseInterface.py +++ b/armi/bookkeeping/db/databaseInterface.py @@ -391,7 +391,9 @@ def getHistory( for param in params or history.keys(): if param == "location": # 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) + history[param][now] = tuple( + int(i) for i in comp.spatialLocator.indices + ) else: history[param][now] = comp.p[param] From 436ced367decd219545f092326e5e1688a715969 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 05:56:22 +0000 Subject: [PATCH 12/16] nope need the max pin for py39 and py310 --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b239629a6..0de69c1e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", # 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 From 083d0748823535f74e8fd9d2bbe8f7d3fc8c6729 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 06:40:23 +0000 Subject: [PATCH 13/16] fix a few numpy and python deprecation warnings --- armi/utils/mathematics.py | 5 +++-- armi/utils/tests/test_iterables.py | 7 ------- armi/utils/tests/test_tabulate.py | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/armi/utils/mathematics.py b/armi/utils/mathematics.py index 3169e92be..c7301756d 100644 --- a/armi/utils/mathematics.py +++ b/armi/utils/mathematics.py @@ -411,7 +411,8 @@ def goalFunc(guess, func, positiveGuesses): tol=tol, options={"maxiter": maxIterations}, ) - ans = float(X["x"]) + + ans = float(X["x"][0]) if positiveGuesses is True: ans = abs(ans) @@ -515,7 +516,7 @@ def parabolaFromPoints(p1, p2, p3): print("Error in parabola {} {}".format(A, b)) raise - return float(x[0]), float(x[1]), float(x[2]) + return float(x[0][0]), float(x[1][0]), float(x[2][0]) def parabolicInterpolation(ap, bp, cp, targetY): diff --git a/armi/utils/tests/test_iterables.py b/armi/utils/tests/test_iterables.py index f1ebcb8e0..fc233810a 100644 --- a/armi/utils/tests/test_iterables.py +++ b/armi/utils/tests/test_iterables.py @@ -13,7 +13,6 @@ # limitations under the License. """Unittests for iterables.py.""" -import time import unittest import numpy as np @@ -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 diff --git a/armi/utils/tests/test_tabulate.py b/armi/utils/tests/test_tabulate.py index 06a27ec1b..7a4ca3ce5 100644 --- a/armi/utils/tests/test_tabulate.py +++ b/armi/utils/tests/test_tabulate.py @@ -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": ["S", "uint8", "float32"], }, ) expected = "\n".join( @@ -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": ["S", "uint8", "float32"], }, ) expected = "\n".join( @@ -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": ["S", "uint8", "float32"], }, ) expected = "\n".join( From ddf61d6b205cb6c09b911e9281364788e040a91f Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 06:43:11 +0000 Subject: [PATCH 14/16] oops. --- armi/utils/tests/test_tabulate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/armi/utils/tests/test_tabulate.py b/armi/utils/tests/test_tabulate.py index 7a4ca3ce5..140c28426 100644 --- a/armi/utils/tests/test_tabulate.py +++ b/armi/utils/tests/test_tabulate.py @@ -213,7 +213,7 @@ def test_numpyRecordArray(self): [("Alice", 23, 169.5), ("Bob", 27, 175.0)], dtype={ "names": ["name", "age", "height"], - "formats": ["S", "uint8", "float32"], + "formats": ["S32", "uint8", "float32"], }, ) expected = "\n".join( @@ -233,7 +233,7 @@ def test_numpyRecordArrayKeys(self): [("Alice", 23, 169.5), ("Bob", 27, 175.0)], dtype={ "names": ["name", "age", "height"], - "formats": ["S", "uint8", "float32"], + "formats": ["S32", "uint8", "float32"], }, ) expected = "\n".join( @@ -253,7 +253,7 @@ def test_numpyRecordArrayHeaders(self): [("Alice", 23, 169.5), ("Bob", 27, 175.0)], dtype={ "names": ["name", "age", "height"], - "formats": ["S", "uint8", "float32"], + "formats": ["S32", "uint8", "float32"], }, ) expected = "\n".join( From b44b17f1117d2f5ab8a76b0ec80858bc6e11120e Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Tue, 31 Dec 2024 17:11:42 +0000 Subject: [PATCH 15/16] knock out one more test warning --- armi/utils/tests/test_textProcessors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armi/utils/tests/test_textProcessors.py b/armi/utils/tests/test_textProcessors.py index 141ebe58f..16f5a11ef 100644 --- a/armi/utils/tests/test_textProcessors.py +++ b/armi/utils/tests/test_textProcessors.py @@ -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): From 199c627a199b06b103f24dd479ac62cf63a07e27 Mon Sep 17 00:00:00 2001 From: Arrielle Opotowsky Date: Thu, 2 Jan 2025 19:18:05 -0600 Subject: [PATCH 16/16] Add comments for seemingly weird math updates --- armi/utils/mathematics.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/armi/utils/mathematics.py b/armi/utils/mathematics.py index c7301756d..57ac4fe1e 100644 --- a/armi/utils/mathematics.py +++ b/armi/utils/mathematics.py @@ -412,6 +412,7 @@ def goalFunc(guess, func, positiveGuesses): options={"maxiter": maxIterations}, ) + # 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) @@ -516,6 +517,7 @@ def parabolaFromPoints(p1, p2, p3): print("Error in parabola {} {}".format(A, b)) raise + # 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])