Skip to content

Commit

Permalink
Remove unecessary code
Browse files Browse the repository at this point in the history
Removed a step that would mask zeros as np.nan right before storing the results.
This is not necessary anymore as the benchmark for the system tests is being
updated in this PR.

Updated the benchmark once again to match current state of vesuvio analysis.
  • Loading branch information
GuiMacielPereira committed Sep 10, 2024
1 parent e9946e9 commit 3c2f9a8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
11 changes: 1 addition & 10 deletions src/mvesuvio/analysis_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,7 @@ def _replace_zero_columns_with_ncp_fit(self):
OutputWorkspace=self._workspace_for_corrections.name() + "_CorrectionsInput"
)
for row in range(self._workspace_for_corrections.getNumberHistograms()):
# TODO: Once the option to change point to hist is removed, remove [:len(ncp)]
self._workspace_for_corrections.dataY(row)[self._zero_columns_boolean_mask] = ncp[row, self._zero_columns_boolean_mask[:len(ncp[row])]]
self._workspace_for_corrections.dataY(row)[self._zero_columns_boolean_mask] = ncp[row, self._zero_columns_boolean_mask]

SumSpectra(
InputWorkspace=self._workspace_for_corrections.name(),
Expand Down Expand Up @@ -1069,14 +1068,6 @@ def _set_results(self):
def _save_results(self):
"""Saves all of the arrays stored in this object"""

maskedDetectorIdx = np.array(self._mask_spectra) - min(self._workspace_being_fit.getSpectrumNumbers())

# TODO: Take out nans next time when running original results
# Because original results were recently saved with nans, mask spectra with nans
self.all_spec_best_par_chi_nit[:, maskedDetectorIdx, :] = np.nan
self.all_ncp_for_each_mass[:, maskedDetectorIdx, :, :] = np.nan
self.all_tot_ncp[:, maskedDetectorIdx, :] = np.nan

if not self._save_results_path:
return

Expand Down
Binary file not shown.
Binary file not shown.
6 changes: 1 addition & 5 deletions tests/system/analysis/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,10 @@ def setUpClass(cls):

def setUp(self):
self.orincp = self.benchmarkResults["all_tot_ncp"]

self.optncp = self.currentResults.all_tot_ncp

def test_ncp(self):
correctNansOri = np.where(
(self.orincp == 0) & np.isnan(self.optncp), np.nan, self.orincp
)
nptest.assert_almost_equal(correctNansOri, self.optncp, decimal=5)
nptest.assert_almost_equal(self.orincp, self.optncp, decimal=5)


class TestMeanWidths(unittest.TestCase):
Expand Down

0 comments on commit 3c2f9a8

Please sign in to comment.