mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
207 stars 121 forks source link

SpectrumList in SaveAscii is Poorly Named #37480

Open cailafinn opened 1 month ago

cailafinn commented 1 month ago

Original reporter: User that came to the office, unfortunately I didn't get their name.

Describe the bug User was confused as to why providing 1 to the SpectrumList property of SaveAscii was outputting the curve for the second spectrum in the workspace.

This is because the algorithm actually uses the workspace indices (0 initialised, and unaffected by cropping).

The WorkspaceIndexMax and WorkspaceIndexMin are named correctly, so renaming the property to match these is probablt the best option.

The documentation for the property does indicate that it uses the workspace index, but this isn't clear from the algorithm dialog unless you specifically hover over the text input box.

To Reproduce

  1. Load a workspace.
  2. Use SaveAscii to attempt to save the first spectra (SpectrumList = 1)
  3. Note in the saved file that it was actually the spectrum with workspace index = 1 that was saved (usually Spectrum Number = 2).

Expected behavior It should be clear what spectrum is being saved by this property.

Platform/Version (please complete the following information):

jclarkeSTFC commented 4 weeks ago

Is the only way to do this whilst maintaining backwards compatibility with scripts to have a new SaveAscii3 algorithm with the correct parameter name that just calls SaveAscii2? I assume then that anyone with an existing script will end up calling SaveAscii2 if they have specified SpectrumList as an argument, or is that not how it works?