Skip to content

Commit

Permalink
Rename algorithm to VesuvioAnalysisRoutine
Browse files Browse the repository at this point in the history
Also corrected minor things, like removing unused import,
removing unused variable and seting h ratio to zero by default.
  • Loading branch information
GuiMacielPereira committed Nov 6, 2024
1 parent fa00881 commit 72f5d84
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/mvesuvio/analysis_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
np.set_printoptions(suppress=True, precision=4, linewidth=200)


class AnalysisRoutine(PythonAlgorithm):
class VesuvioAnalysisRoutine(PythonAlgorithm):

def summary(self):
return "Runs the analysis reduction routine for VESUVIO."
Expand Down
11 changes: 5 additions & 6 deletions src/mvesuvio/analysis_routines.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from mvesuvio.util.analysis_helpers import fix_profile_parameters, \
loadRawAndEmptyWsFromUserPath, cropAndMaskWorkspace, \
NeutronComptonProfile, calculate_h_ratio
from mvesuvio.analysis_reduction import AnalysisRoutine
from tests.testhelpers.calibration.algorithms import create_algorithm
from mvesuvio.analysis_reduction import VesuvioAnalysisRoutine

def _create_analysis_object_from_current_interface(IC, running_tests=False):
ws = loadRawAndEmptyWsFromUserPath(
Expand Down Expand Up @@ -45,7 +44,7 @@ def _create_analysis_object_from_current_interface(IC, running_tests=False):
"InputWorkspace": cropedWs.name(),
"InputProfiles": profiles_table.name(),
"InstrumentParametersFile": str(IC.InstrParsPath),
"HRatioToLowestMass": IC.HToMassIdxRatio,
"HRatioToLowestMass": IC.HToMassIdxRatio if hasattr(IC, 'HRatioToLowestMass') else 0,
"NumberOfIterations": int(IC.noOfMSIterations),
"InvalidDetectors": IC.maskedSpecAllNo.astype(int).tolist(),
"MultipleScatteringCorrection": IC.MSCorrectionFlag,
Expand All @@ -64,10 +63,10 @@ def _create_analysis_object_from_current_interface(IC, running_tests=False):
}

if running_tests:
alg = AnalysisRoutine()
alg = VesuvioAnalysisRoutine()
else:
AlgorithmFactory.subscribe(AnalysisRoutine)
alg = AlgorithmManager.createUnmanaged("AnalysisRoutine")
AlgorithmFactory.subscribe(VesuvioAnalysisRoutine)
alg = AlgorithmManager.createUnmanaged("VesuvioAnalysisRoutine")

alg.initialize()
alg.setProperties(kwargs)
Expand Down
1 change: 0 additions & 1 deletion src/mvesuvio/config/analysis_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def __init__(self, ipFilesPath):
self.InstrParsPath = ipFilesPath / "ip2018_3.par"

HToMassIdxRatio = 19.0620008206 # Set to zero or None when H is not present
massIdx = 0

# Masses, instrument parameters and initial fitting parameters
masses = np.array([12, 16, 27])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/analysis/test_analysis_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np
import numpy.testing as nptest
from mock import MagicMock
from mvesuvio.analysis_reduction import AnalysisRoutine
from mvesuvio.analysis_reduction import VesuvioAnalysisRoutine
from mantid.simpleapi import CreateWorkspace, DeleteWorkspace
import inspect

Expand Down

0 comments on commit 72f5d84

Please sign in to comment.