Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validation when applying calibration in ISISIndirectEnergyReduction algorithm #38464

Open
adriazalvarez opened this issue Dec 3, 2024 · 3 comments
Labels
Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS

Comments

@adriazalvarez
Copy link
Contributor

adriazalvarez commented Dec 3, 2024

Reported by: Sanghamitra

Describe the bug
ISIS Indirect Energy Reduction Algorithm can apply a calibration step by dividing the spectra to a correction factor contained on a calibration file.
If the calibration file has some values equal to 0, it results on a divide by zero error when the calibration is applied and the final
reduction is not valid.

To Reproduce
This script should run the algorithm just fine:

test_calib=LoadEmptyInstrument(InstrumentName="IRIS")
test_calib=CropWorkspace(test_calib,StartWorkspaceIndex=2, EndWorkspaceIndex=52)
#test_calib.setY(0,np.array([0]))

ISISIndirectEnergyTransfer(InputFiles='IRS26173.raw', Instrument='IRIS', Analyser='graphite', 
                           Reflection='002', Efixed=1.845, SpectraRange='3,53', 
                           FoldMultipleFrames=False, GroupingMethod='All',
                           CalibrationWorkspace='test_calib',OutputWorkspace='out_red')
UnGroupWorkspace(InputWorkspace='out_red')

Now uncommenting the line : test_calib.setY(0,np.array([0])) should run the algorithm wihout errors, but the output reduction workspace irs26173_graphite002_red does not contain any value.

Expected behavior

User is notified that calibration file contains invalid values. Faulty detectors should not be used.

Extra info:
Faulty detectors create 0 values. We have to check also whether this calibration step is similar in OSIRIS reduction.
Also, the fix in Calibration file should not break reduction workflow for other options, such as “Individual”, “Custom”, Files etc.
Screenshots

Platform/Version (please complete the following information):

  • OS: [e.g. Windows, RHEL 7, Ubuntu, macOS]
  • OS Version:
  • Mantid Version [e.g. 6.0.0]

Additional context

@adriazalvarez adriazalvarez added Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS labels Dec 3, 2024
@SpencerHowells
Copy link

@adriazalvarez This needs further investigation. If there is a zero that detector/spectrum should not be used.

@robertapplin
Copy link
Contributor

Spencer found that the calibration file has faulty detectors at 50 and 51.

A user can exclude faulty detectors manually using the "Custom" detector grouping option. In this case we can use the "Custom" detector grouping, and select "3:49,52:53"

@robertapplin
Copy link
Contributor

Thanks for writing this up! I think this issue highlights the need for more validation or a warning message when using a calibration with faulty detectors, and I am happy for that to be considered a bug fix

I believe the ability for faulty detectors to be identified and excluded from a data reduction should be considered a New Feature. We wanted to work on this feature earlier this year, however there were communication difficulties. See this issue: #36377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS
Projects
Status: No status
Development

No branches or pull requests

3 participants