Skip to content

Commit

Permalink
fixed EISF and updated test to fix cases when the partial were not sc…
Browse files Browse the repository at this point in the history
…aled
  • Loading branch information
ChiCheng45 committed Feb 14, 2025
1 parent 74726fa commit 0295d19
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def finalize(self):
self._outputData,
weight_dict,
"eisf_%s",
update_partials=False,
)

self._outputData.write(
Expand Down
22 changes: 13 additions & 9 deletions MDANSE/Tests/UnitTests/Analysis/test_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ def parameters():
for jt in [
# "AngularCorrelation",
# "GeneralAutoCorrelationFunction",
("DensityOfStates", ["dos", "vacf"]),
("MeanSquareDisplacement", ["msd"]),
("VelocityAutoCorrelationFunction", ["vacf"]),
("VanHoveFunctionDistinct", ["g(r,t)"]),
("VanHoveFunctionSelf", ["g(r,t)"]),
("DensityOfStates", ["dos", "vacf"], True),
("MeanSquareDisplacement", ["msd"], False),
("VelocityAutoCorrelationFunction", ["vacf"], False),
("VanHoveFunctionDistinct", ["g(r,t)"], False),
("VanHoveFunctionSelf", ["g(r,t)"], True),
# "OrderParameter",
("PositionAutoCorrelationFunction", ["pacf"]),
("PositionPowerSpectrum", ["pacf", "pps"]),
("PositionAutoCorrelationFunction", ["pacf"], False),
("PositionPowerSpectrum", ["pacf", "pps"], True),
]:
for rm in [("single-core", 1), ("multicore", -4)]:
for of in ["MDAFormat", "TextFormat"]:
Expand All @@ -192,9 +192,13 @@ def test_dynamics_analysis(
with h5py.File(temp_name + ".mda") as actual, h5py.File(result_file) as desired:
keys = [i for i in desired.keys() if any([j in i for j in job_info[1]])]
for key in keys:
# reference results may or may not have been scaled
if job_info[2]:
scale_factor = actual[f"/{key}"].attrs["scaling_factor"]
else:
scale_factor = 1
np.testing.assert_array_almost_equal(
actual[f"/{key}"] * actual[f"/{key}"].attrs["scaling_factor"],
desired[f"/{key}"],
actual[f"/{key}"] * scale_factor, desired[f"/{key}"],
)

os.remove(temp_name + ".mda")
Expand Down
4 changes: 2 additions & 2 deletions MDANSE/Tests/UnitTests/Analysis/test_scattering.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ def test_ccf(traj_info, qvector_grid):
i for i in desired.keys() if any([j in i for j in ["J(q,f)", "j(q,t)"]])
]
for key in keys:
# reference results were not rescaled
np.testing.assert_array_almost_equal(
actual[f"/{key}"] * actual[f"/{key}"].attrs["scaling_factor"],
desired[f"/{key}"],
actual[f"/{key}"], desired[f"/{key}"],
)

os.remove(temp_name + ".mda")
Expand Down
4 changes: 4 additions & 0 deletions MDANSE_GUI/Src/MDANSE_GUI/Tabs/Visualisers/DataPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def add_dataset(self, dataset: SingleDataset):
return
self._model.add_dataset(dataset)
self._selection_viewer.resizeColumnsToContents()
for col_num in range(4, 10):
self._selection_viewer.hideColumn(col_num)

@Slot()
def new_plot(self):
Expand Down Expand Up @@ -154,4 +156,6 @@ def clear(self):
if self._model is None:
return
self._model.clear()
for col_num in range(4, 10):
self._selection_viewer.hideColumn(col_num)
LOG.info("Cleared the plot")

0 comments on commit 0295d19

Please sign in to comment.