diff --git a/src/snapred/backend/dao/ingredients/NormalizationIngredients.py b/src/snapred/backend/dao/ingredients/NormalizationIngredients.py index 563776e4b..ba2bbcf65 100644 --- a/src/snapred/backend/dao/ingredients/NormalizationIngredients.py +++ b/src/snapred/backend/dao/ingredients/NormalizationIngredients.py @@ -4,6 +4,7 @@ from snapred.backend.dao.GroupPeakList import GroupPeakList from snapred.backend.dao.state.CalibrantSample import CalibrantSample +from snapred.backend.dao.state.InstrumentState import InstrumentState from snapred.backend.dao.state.PixelGroup import PixelGroup @@ -13,3 +14,4 @@ class NormalizationIngredients(BaseModel): pixelGroup: PixelGroup calibrantSample: CalibrantSample detectorPeaks: List[GroupPeakList] + instrumentState: InstrumentState diff --git a/src/snapred/backend/recipe/algorithm/RawVanadiumCorrectionAlgorithm.py b/src/snapred/backend/recipe/algorithm/RawVanadiumCorrectionAlgorithm.py index 4f06996d7..ea4008cac 100644 --- a/src/snapred/backend/recipe/algorithm/RawVanadiumCorrectionAlgorithm.py +++ b/src/snapred/backend/recipe/algorithm/RawVanadiumCorrectionAlgorithm.py @@ -52,6 +52,8 @@ def chopIngredients(self, ingredients: Ingredients) -> None: self.geometry = ingredients.calibrantSample.geometry self.material = ingredients.calibrantSample.material self.sampleShape = self.geometry.shape + self.lambdaMin = ingredients.instrumentState.particleBounds.wavelength.minimum + self.lambdaMax = ingredients.instrumentState.particleBounds.wavelength.maximum def unbagGroceries(self) -> None: self.inputVanadiumWS = self.getPropertyValue("InputWorkspace") @@ -83,6 +85,30 @@ def chopNeutronData(self, inputWS: str, outputWS: str) -> None: BinningMode="Logarithmic", ) + # Malcolm added these lines ################## + self.mantidSnapper.ConvertUnits( + "Convert workspace to wavelength units", + InputWorkspace=outputWS, + Outputworkspace=outputWS, + Target="Wavelength", + ) + + self.mantidSnapper.CropWorkspace( + "crop all events outside of range", + InputWorkspace=outputWS, + Outputworkspace=outputWS, + XMin=self.lambdaMin, + XMax=self.lambdaMax, + ) + + self.mantidSnapper.ConvertUnits( + "Ensure workspace is in TOF units", + InputWorkspace=outputWS, + Outputworkspace=outputWS, + Target="TOF", + ) + ################################ + self.mantidSnapper.MakeDirtyDish( "make a copy of data after chop", InputWorkspace=outputWS, diff --git a/src/snapred/backend/service/SousChef.py b/src/snapred/backend/service/SousChef.py index a0f5714e1..2d232d336 100644 --- a/src/snapred/backend/service/SousChef.py +++ b/src/snapred/backend/service/SousChef.py @@ -302,6 +302,7 @@ def prepNormalizationIngredients(self, ingredients: FarmFreshIngredients) -> Nor pixelGroup=self.prepPixelGroup(ingredients), calibrantSample=self.prepCalibrantSample(ingredients.calibrantSamplePath), detectorPeaks=self.prepDetectorPeaks(ingredients, purgePeaks=False), + instrumentState=self.prepInstrumentState(ingredients), ) def prepDiffractionCalibrationIngredients( diff --git a/src/snapred/resources/application.yml b/src/snapred/resources/application.yml index 9f63239a0..4e7670c0e 100644 --- a/src/snapred/resources/application.yml +++ b/src/snapred/resources/application.yml @@ -12,7 +12,7 @@ instrument: name: SNAP home: ${IPTS.root}/SNAP calibration: - home: ${instrument.home}/shared/Calibration + home: ${instrument.home}/shared/Calibration_testing sample: home: ${instrument.calibration.home}/CalibrantSamples extensions: @@ -215,11 +215,11 @@ constants: tofMax: 14500 rebinParams: [2000, -0.001, 14500] CropFactors: - lowWavelengthCrop: 0.05 - lowdSpacingCrop: 0.1 - highdSpacingCrop: 0.15 + lowWavelengthCrop: -0.04 + lowdSpacingCrop: 0.015 + highdSpacingCrop: 0.022 CrystallographicInfo: - crystalDMin: 0.4 + crystalDMin: 0.7 crystalDMax: 100.0 DetectorPeakPredictor: fwhm: 1.17741002252 # used to convert gaussian to fwhm (2 * log_e(2)) @@ -227,7 +227,7 @@ constants: toggleCompressionTolerance: false # false = no tolerance compression, true = tolerance compression # tolerance: -0.004 # tolerance override for calculated compression GroupDiffractionCalibration: - MaxChiSq: 100 + MaxChiSq: 10000 RawVanadiumCorrection: numberOfSlices: 10 numberOfAnnuli: 10