Address a few warnings from tests

This commit is contained in:
Paul Romano 2022-12-23 00:04:45 -06:00
parent ecfa94e0ff
commit a5bdbd3adb
4 changed files with 8 additions and 10 deletions

View file

@ -925,7 +925,7 @@ class MGXS:
# Tabulate the atomic number densities for all nuclides
elif nuclides == 'all':
nuclides = self.get_nuclides()
densities = np.zeros(self.num_nuclides, dtype=np.float)
densities = np.zeros(self.num_nuclides, dtype=float)
for i, nuclide in enumerate(nuclides):
densities[i] += self.get_nuclide_density(nuclide)
@ -3019,7 +3019,7 @@ class DiffusionCoefficient(TransportXS):
new_filt = openmc.EnergyFilter(old_filt.values)
p1_tally.filters[-2] = new_filt
p1_tally = p1_tally.get_slice(filters=[openmc.LegendreFilter],
p1_tally = p1_tally.get_slice(filters=[openmc.LegendreFilter],
filter_bins=[('P1',)],squeeze=True)
p1_tally._scores = ['scatter-1']
total_xs = self.tallies['total'] / self.tallies['flux (tracklength)']

View file

@ -103,9 +103,8 @@ class DiffTallyTestHarness(PyAPITestHarness):
sp = openmc.StatePoint(statepoint)
# Extract the tally data as a Pandas DataFrame.
df = pd.DataFrame()
for t in sp.tallies.values():
df = df.append(t.get_pandas_dataframe(), ignore_index=True)
tally_dfs = [t.get_pandas_dataframe() for t in sp.tallies.values()]
df = pd.concat(tally_dfs, ignore_index=True)
# Extract the relevant data as a CSV string.
cols = ('d_material', 'd_nuclide', 'd_variable', 'score', 'mean',

View file

@ -164,9 +164,8 @@ class SurfaceTallyTestHarness(PyAPITestHarness):
sp = openmc.StatePoint(self._sp_name)
# Extract the tally data as a Pandas DataFrame.
df = pd.DataFrame()
for t in sp.tallies.values():
df = df.append(t.get_pandas_dataframe(), ignore_index=True)
tally_dfs = [t.get_pandas_dataframe() for t in sp.tallies.values()]
df = pd.concat(tally_dfs, ignore_index=True)
# Extract the relevant data as a CSV string.
cols = ('mean', 'std. dev.')

View file

@ -77,8 +77,8 @@ def test_write_data_to_vtk_size_mismatch(mesh):
# by regex. These are needed to make the test string match the error message
# string when using the match argument as that uses regular expression
expected_error_msg = (
f"The size of the dataset 'label' \({len(data)}\) should be equal to "
f"the number of mesh cells \({mesh.num_mesh_cells}\)"
f"The size of the dataset 'label' ({len(data)}) should be equal to "
f"the number of mesh cells ({mesh.num_mesh_cells})"
)
with pytest.raises(ValueError, match=expected_error_msg):
mesh.write_data_to_vtk(filename="out.vtk", datasets={"label": data})