Skip to content

Commit

Permalink
fixed the formatting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuralNoble committed Jul 12, 2024
1 parent ebd6e2e commit 5966942
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 68 deletions.
8 changes: 2 additions & 6 deletions armi/bookkeeping/db/compareDB3.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,7 @@ def _diffSpecialData(
if isinstance(dSrc, np.ndarray) and isinstance(dRef, np.ndarray):
if dSrc.shape != dRef.shape:
out.writeln("Shapes did not match for {}".format(refData))
diffResults.addDiff(
compName, paramName, np.inf, np.inf, np.inf
)
diffResults.addDiff(compName, paramName, np.inf, np.inf, np.inf)
return

# make sure not to try to compare empty arrays. Numpy is mediocre at
Expand Down Expand Up @@ -501,9 +499,7 @@ def _compareComponentData(
paramName, refSpecial, srcSpecial
)
)
diffResults.addDiff(
refGroup.name, paramName, np.inf, np.inf, np.inf
)
diffResults.addDiff(refGroup.name, paramName, np.inf, np.inf, np.inf)
continue

if srcSpecial or refSpecial:
Expand Down
4 changes: 1 addition & 3 deletions armi/bookkeeping/db/database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,9 +922,7 @@ def _getShape(arr: [np.ndarray, List, Tuple]):
else:
jagged = False
data = (
JaggedArray(temp, paramDef.name)
if jagged
else np.array(temp)
JaggedArray(temp, paramDef.name) if jagged else np.array(temp)
)
del temp

Expand Down
4 changes: 1 addition & 3 deletions armi/bookkeeping/db/tests/test_database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ def test_replaceNones(self):
data1 = np.array([1, 2, 3, 4, 5, 6, 7, 8])
data1iNones = np.array([1, 2, None, 5, 6])
data1fNones = np.array([None, 2.0, None, 5.0, 6.0])
data2fNones = np.array(
[None, [[1.0, 2.0, 6.0], [2.0, 3.0, 4.0]]], dtype=object
)
data2fNones = np.array([None, [[1.0, 2.0, 6.0], [2.0, 3.0, 4.0]]], dtype=object)
twoByTwo = np.array([[1, 2], [3, 4]])
twoByOne = np.array([[1], [None]])
threeByThree = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
Expand Down
8 changes: 2 additions & 6 deletions armi/bookkeeping/visualization/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ def _createHexBlockMesh(b: blocks.HexBlock) -> VtkMesh:
hexVerts2d = np.vstack((hexVerts2d, hexVerts2d))

# fold in z locations to get 3d coordinates
hexVerts = np.hstack(
(hexVerts2d, np.array([[zMin] * 6 + [zMax] * 6]).transpose())
)
hexVerts = np.hstack((hexVerts2d, np.array([[zMin] * 6 + [zMax] * 6]).transpose()))

return VtkMesh(
hexVerts,
Expand Down Expand Up @@ -242,9 +240,7 @@ def _createCartesianBlockMesh(b: blocks.CartesianBlock) -> VtkMesh:
boxVerts = np.vstack((rectVerts, rectVerts))

# fold in z coordinates
boxVerts = np.hstack(
(boxVerts, np.array([[zMin] * 4 + [zMax] * 4]).transpose())
)
boxVerts = np.hstack((boxVerts, np.array([[zMin] * 4 + [zMax] * 4]).transpose()))

return VtkMesh(
boxVerts,
Expand Down
2 changes: 0 additions & 2 deletions armi/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
"""
import os
import numpy as np
import matplotlib

from armi import apps, configure, context
from armi.settings import caseSettings
from armi.tests import TEST_ROOT
Expand Down
4 changes: 1 addition & 3 deletions armi/materials/inconel600.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def polyfitLinearExpansionPercent(self, power=2):

Tc.insert(0, refTempC)

return np.polyfit(
np.array(Tc), np.array(linExpPercent), power
).tolist()
return np.polyfit(np.array(Tc), np.array(linExpPercent), power).tolist()

def linearExpansionPercent(self, Tk=None, Tc=None):
r"""
Expand Down
4 changes: 1 addition & 3 deletions armi/materials/inconel625.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ def polyfitLinearExpansionPercent(self, power=2):

Tc.insert(0, refTempC)

return np.polyfit(
np.array(Tc), np.array(linExpPercent), power
).tolist()
return np.polyfit(np.array(Tc), np.array(linExpPercent), power).tolist()

def linearExpansionPercent(self, Tk=None, Tc=None):
"""
Expand Down
4 changes: 1 addition & 3 deletions armi/materials/inconelX750.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ def polyfitLinearExpansionPercent(self, power=2):

Tc.insert(0, refTempC)

return np.polyfit(
np.array(Tc), np.array(linExpPercent), power
).tolist()
return np.polyfit(np.array(Tc), np.array(linExpPercent), power).tolist()

def linearExpansionPercent(self, Tk=None, Tc=None):
r"""
Expand Down
4 changes: 1 addition & 3 deletions armi/nuclearDataIO/cccc/dlayxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ class DelayedNeutronData:
def __init__(self, numEnergyGroups, numPrecursorGroups):
self.precursorDecayConstants = np.zeros(numPrecursorGroups)
self.delayEmissionSpectrum = np.zeros((numPrecursorGroups, numEnergyGroups))
self.delayNeutronsPerFission = np.zeros(
(numPrecursorGroups, numEnergyGroups)
)
self.delayNeutronsPerFission = np.zeros((numPrecursorGroups, numEnergyGroups))


def compare(lib1, lib2):
Expand Down
4 changes: 1 addition & 3 deletions armi/physics/fuelCycle/hexAssemblyFuelMgmtUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,7 @@ def buildRingSchedule(
# don't let it be smaller than 2 because linspace(1,5,1)= [1], linspace(1,5,2)= [1,5]
numSteps = max(numSteps, 2)

baseRings = [
int(ring) for ring in np.linspace(dischargeRing, chargeRing, numSteps)
]
baseRings = [int(ring) for ring in np.linspace(dischargeRing, chargeRing, numSteps)]
# eliminate duplicates.
newBaseRings = []
for br in baseRings:
Expand Down
4 changes: 1 addition & 3 deletions armi/physics/neutronics/crossSectionGroupManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,7 @@ def getNumberDensitiesWithTrace(component, allNucNames):
vol = block.getVolume()
components, volFracs = zip(*block.getVolumeFractions())
# D = CxN matrix of number densities
ndens = np.array(
[getNumberDensitiesWithTrace(c, allNucNames) for c in components]
)
ndens = np.array([getNumberDensitiesWithTrace(c, allNucNames) for c in components])
temperatures = np.array(
[c.temperatureInC for c in components]
) # C-length temperature array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ def _getFuelTemperature(self):
if not fuelComponents:
fuelTemperatureInC = self.block.getAverageTempInC()
else:
fuelTemperatureInC = np.mean(
[fc.temperatureInC for fc in fuelComponents]
)
fuelTemperatureInC = np.mean([fc.temperatureInC for fc in fuelComponents])
if not fuelTemperatureInC or math.isnan(fuelTemperatureInC):
raise ValueError(
"The fuel temperature of block {0} is {1} and is not valid".format(
Expand Down
10 changes: 4 additions & 6 deletions armi/reactor/composites.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def _packImpl(data, flagCls: Type[utils.Flag]):
functionality without having to do unholy things to ARMI's actual set of
``reactor.flags.Flags``.
"""
npa = np.array(
[b for f in data for b in f.to_bytes()], dtype=np.uint8
).reshape((len(data), flagCls.width()))
npa = np.array([b for f in data for b in f.to_bytes()], dtype=np.uint8).reshape(
(len(data), flagCls.width())
)

return npa, {"flag_order": flagCls.sortedFields()}

Expand Down Expand Up @@ -2856,9 +2856,7 @@ def _syncParameters(self, allSyncData, errors):
# out of sync, and this parameter was also globally modified and
# readjusted to the original value.
curVal = self.p[key]
if isinstance(val, np.ndarray) or isinstance(
curVal, np.ndarray
):
if isinstance(val, np.ndarray) or isinstance(curVal, np.ndarray):
if (val != curVal).any():
errors[self, key].append(nodeRank)
elif curVal != val:
Expand Down
14 changes: 3 additions & 11 deletions armi/reactor/tests/test_assemblies.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import pathlib
import random
import unittest

import numpy as np
from numpy.testing import assert_allclose

from armi import settings
Expand Down Expand Up @@ -962,21 +960,15 @@ def test_getParamValuesAtZ(self):
for b, flux in zip(self.assembly, [[1, 10], [2, 8], [3, 6]]):
b.p.mgFlux = flux
self.assertTrue(
np.allclose(
[2.5, 7.0], self.assembly.getParamValuesAtZ("mgFlux", 20.0)
)
np.allclose([2.5, 7.0], self.assembly.getParamValuesAtZ("mgFlux", 20.0))
)
self.assertTrue(
np.allclose(
[1.5, 9.0], self.assembly.getParamValuesAtZ("mgFlux", 10.0)
)
np.allclose([1.5, 9.0], self.assembly.getParamValuesAtZ("mgFlux", 10.0))
)
for b in self.assembly:
b.p.mgFlux = [0.0] * 2
self.assertTrue(
np.allclose(
[0.0, 0.0], self.assembly.getParamValuesAtZ("mgFlux", 10.0)
)
np.allclose([0.0, 0.0], self.assembly.getParamValuesAtZ("mgFlux", 10.0))
)

# single value param at corner
Expand Down
5 changes: 1 addition & 4 deletions armi/utils/gridEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import wx
import wx.adv
import numpy as np
import numpy as np.linalg

from armi.utils import hexagon
from armi.utils import textProcessors
Expand Down Expand Up @@ -1185,9 +1184,7 @@ def _calcGridBounds(self) -> wx.Rect:

_ = self._gridScale(self.grid)

allCenters = np.array(
[self.grid.getCoordinates(idx)[:2] for idx in inDomain]
)
allCenters = np.array([self.grid.getCoordinates(idx)[:2] for idx in inDomain])
minXY = np.amin(allCenters, axis=0)
maxXY = np.amax(allCenters, axis=0)

Expand Down
4 changes: 1 addition & 3 deletions armi/utils/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1405,9 +1405,7 @@ def plotBlockDiagram(
if materialName not in materialList:
materialList.append(materialName)

materialMap = {
material: ai for ai, material in enumerate(np.unique(materialList))
}
materialMap = {material: ai for ai, material in enumerate(np.unique(materialList))}
patches, data, _ = _makeBlockPinPatches(block, cold)

collection = PatchCollection(patches, cmap=cmapName, alpha=1.0)
Expand Down
6 changes: 3 additions & 3 deletions armi/utils/reportPlotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ def _radarFactory(numVars, frame="circle"):
# calculate evenly-spaced axis angles
# rotate theta such that the first axis is at the top
# keep within 0 to 2pi range though.
theta = (
np.linspace(0, 2 * np.pi, numVars, endpoint=False) + np.pi / 2
) % (2.0 * np.pi)
theta = (np.linspace(0, 2 * np.pi, numVars, endpoint=False) + np.pi / 2) % (
2.0 * np.pi
)

def drawPolyPatch():
verts = _unitPolyVerts(theta)
Expand Down

0 comments on commit 5966942

Please sign in to comment.