Skip to content

Commit fa00881

Browse files
Removed unused comments from development
Cleaned up some comments, and introduced some others for clarity.
1 parent 605aa58 commit fa00881

File tree

6 files changed

+11
-27
lines changed

6 files changed

+11
-27
lines changed

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ dependencies:
1818
- pytest
1919
- jacobi==0.4.2 #pinned until newer versions functionality confirmed
2020
- coverage
21-
- dill
21+
- dill # Used to convert constraints to strings

src/mvesuvio/analysis_fitting.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def extractNCPFromWorkspaces(wsFinal, ic):
5555
if 'total' in ws_name:
5656
continue
5757

58-
print(ws_name)
5958
ws = mtd[ws_name]
6059
dataY = ws.extractY()[np.newaxis, :, :]
6160
try:

src/mvesuvio/analysis_reduction.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _setup(self):
163163

164164
self._profiles_table = self.getProperty("InputProfiles").value
165165

166-
# Need to transform profiles table into parameter array for minimize
166+
# Need to transform profiles table into parameter array for optimize.minimize()
167167
self._initial_fit_parameters = []
168168
for intensity, width, center in zip(
169169
self._profiles_table.column("intensity"),
@@ -225,11 +225,11 @@ def _initialize_table_fit_parameters(self):
225225
table.setTitle("SciPy Fit Parameters")
226226
table.addColumn(type="float", name="Spectrum")
227227
for label in self._profiles_table.column("label"):
228-
table.addColumn(type="float", name=f"{label} Intensity")
229-
table.addColumn(type="float", name=f"{label} Width")
230-
table.addColumn(type="float", name=f"{label} Center ")
231-
table.addColumn(type="float", name="Normalised Chi2")
232-
table.addColumn(type="float", name="Number of Iterations")
228+
table.addColumn(type="float", name=f"{label} intensity")
229+
table.addColumn(type="float", name=f"{label} width")
230+
table.addColumn(type="float", name=f"{label} center ")
231+
table.addColumn(type="float", name="normalised chi2")
232+
table.addColumn(type="float", name="no of iterations")
233233
return table
234234

235235

@@ -460,8 +460,8 @@ def _set_means_and_std(self):
460460
widths = np.zeros((self._profiles_table.rowCount(), fitParsTable.rowCount()))
461461
intensities = np.zeros(widths.shape)
462462
for i, label in enumerate(self._profiles_table.column("label")):
463-
widths[i] = fitParsTable.column(f"{label} Width")
464-
intensities[i] = fitParsTable.column(f"{label} Intensity")
463+
widths[i] = fitParsTable.column(f"{label} width")
464+
intensities[i] = fitParsTable.column(f"{label} intensity")
465465
(
466466
meanWidths,
467467
stdWidths,

src/mvesuvio/util/analysis_helpers.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ def loadRawAndEmptyWsFromUserPath(userWsRawPath, userWsEmptyPath,
4747

4848
SumSpectra(InputWorkspace=name + "_raw", OutputWorkspace=name + "_raw" + "_sum")
4949
wsToBeFitted = mtd[name+"_raw"]
50-
# wsToBeFitted = CloneWorkspace(
51-
# InputWorkspace=name + "_raw", OutputWorkspace=name + "uncropped_unmasked"
52-
# )
5350

54-
# if mode=="DoubleDifference":
5551
if subEmptyFromRaw:
5652
Load(Filename=str(userWsEmptyPath), OutputWorkspace=name + "_empty")
5753
Rebin(

tests/unit/analysis/test_analysis_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ def test_calculate_h_ratio(self):
117117

118118
def test_conversion_of_constraints(self):
119119
constraints = ({'type': 'eq', 'fun': lambda par: par[0] - 2.7527*par[3] },{'type': 'eq', 'fun': lambda par: par[3] - 0.7234*par[6] })
120+
# Used before passing constraints into Mantid algorithm
120121
string_constraints = str(dill.dumps(constraints))
121122
self.assertIsInstance(string_constraints, str)
123+
# Used inside Mantid algorithm to convert back to SciPy constraints
122124
converted_constraints = dill.loads(eval(string_constraints))
123125
self.assertEqual(converted_constraints[0]['fun']([3, 0, 0, 1]), 3-2.7527)
124126
self.assertEqual(converted_constraints[1]['fun']([0, 0, 0, 2, 0, 0, 1]), 2-0.7234)

tests/unit/analysis/test_analysis_reduction.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,5 @@ class TestAnalysisFunctions(unittest.TestCase):
1111
def setUp(self):
1212
pass
1313

14-
def test_constraints_are_passed_correctly(self):
15-
alg = AnalysisRoutine()
16-
alg.initialize()
17-
constraints = (
18-
{'type': 'eq', 'fun': lambda par: par[0] - 2.7527*par[3] }, {'type': 'eq', 'fun': lambda par: par[3] - 0.7234*par[6] })
19-
for c in constraints:
20-
print(inspect.getsourcelines(c['fun'])[0])
21-
# alg.setProperty("Constraints", str(constraints))
22-
# print(str(constraints))
23-
# print(alg.getPropertyValue("Constraints"))
24-
# alg_constraints = eval(alg.getPropertyValue("Constraints"))
25-
# self.assertEqual(constraints, alg_constraints)
26-
2714
if __name__ == "__main__":
2815
unittest.main()

0 commit comments

Comments
 (0)