Mantid 4.0 Workbench

This is a thread where users can discuss early interaction and experience of using the new Mantid Workbench.

If you are testing Workbench and have any thoughts/suggestions please post them here. This will allow the development team to capture a sense of user requirements and hopefully give you a more useful product.

Thanks!

Needs the equivalent of View>Preferences and management of Interfaces.

Just a question, should the Mantid work bench be able to run scripts which currently work in Mantid?
I have some which use loadascii which fail, but don’t know if I should be expecting it to work or not (and if not I will hold off testing until I can play)

Solved by explicitly importing mantid into scripts before running (the header text of a blank script)

1 Like

Something which I just found, I had crashed the workbench in a way that also crashed the error reporter. That in itself wasn’t an issue (and is reported through other channels), however, Windows was unable to kill Mantid, and so I had to go to the task manager. In the task manager I closed the Mantid process, but Mantid stayed alive (and crashed). I closed a few more things, but it took quite a while to find that it was pythonw which needed to be killed in order to close the workbench.
At the time I was trying (and clearly succeeding) in reproducing an bug I found in 3.13, but I have always been able to close Mantid before just clicking the normal exit button a few times. Am not sure about any fixes/workarounds but the workbench seems a bit harder to stop and restart.

I have some sort of error with the new workbench reading a function description and interpreting it in some no-clear way. My code is:
def TurnScanToP2TPlots(folderpath, nameofpol_file, nameofintensity_file,polarisation=False,suffix="",nobender=“I_no_transbender”, plotdata=False):
“”“This extracts the scan parameter value and name from a set of folders within a McStas scan and creates a dictionary of the filepaths and the parameter name and value; you should already be in the correct folder, you also want to have
LoadAscii(Filename=r’C:\Users\npi34092\Dropbox\ISIS\OFFSPEC\Beamline\Upgrade\no_bender_5e7\l_after_bender.dat’, OutputWorkspace=‘I_no_bender’, Unit=‘Wavelength’). It then opens the folderpath, looks for pol and intensity files and generates P squared * transmission plots. It deletes the polarisation curves unless you say no to”""
os.chdir(str(folderpath))

Which should do nothing. However this produces an error when run:

SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 258-259: truncated \UXXXXXXXX escape

Any ideas anyone? This was written in Mantid 3 and from quick investigation I can’t reproduce the error with any print statement (python 2 or 3 formatted) or a couple of test other mantid algorithms in the same position

@joscooper Thanks for reporting these issues. I believe all of the issues you have reported above should be sorted in the current nightly build. We “solved” the issues of missing imports for scripts that worked in MantidPlot by detecting on open whether it needs to have these imports applied and asking if the script should be fixed.

Cheers.

Still a few problems with scripts in the Workbench:

  • Spurious “Syntax error: unexpected indent” with scripts which work OK in MantidPlot. The offending line is some way into the script and is not the first at that indent level. For example my “AnalyseThresholdScans9.py” which is on the Script Repository under Muon if you want a look. It has tab indents. If I run “Tabs to Spaces” it does run OK. (It already had some but perhaps not all required import statements at the top)
  • Algorithms defined in the Script Window do not appear in the Algorithms list and are not offered if I start typing in the box next to Execute. They did appear in MantidPlot. So I can’t easily try out the algorithm that my script has just defined, and go back to make changes and retry.
  • The algorithms and subcategories at the second level (e.g. the next level down below Arithmetic, Muon, etc) are jumbled in a random order. MantidPlot sorts them.

Table workspace errors:
My script creates a table and adds columns with types X, Y and YError. In MantidPlot I can then just open the window, select the Y and YError columns and do Scatter plot.
In Workbench, the opened table window has no column types and attempting a plot immediately will fail. I can use the menus to identify them as X and Y. Y-Error doesn’t seem to work: on plotting it I get the Y Error values plotted as another Y data set in a different colour. The menus are confusing - is it supposed to associate Y-Error columns with Y columns which need not be adjacent?

Currently plotting spectrum with errors makes a very confusing plot:

Without errors:

All of my data seems to be sensible as far as I can tell.
Nightly build from March 12th on widows 7

I also see the spurious syntax errors for indentations from scripts written solely in mantid

@joscooper @jameslord Thanks for the reports. We’re looking into the script issues. Some mix up with tabs/spaces as far as we can tell.

@joscooper Is there any chance you could send me the data for that plot? It looks sensible on the data I try here.

I am unable to launch the Workbench on Windows 10 64bit. I have installed both the 4.0 and the Nightly 4.0.20190327.1954-win64 but neither of them starts the Workbench. It directly comes up with the Error reporting window. There is also no output if I launch it in a terminal. MantidPlot runes fine.

If I try to run this .\mantidpython --classic .\workbench\app\mainwindow.py

I get an error:
File “C:\MantidNightlyInstall\bin\workbench\config\user.py”, line 90, in get
value = self.qsettings.value(option)
TypeError: unable to convert a QVariant back to a Python object

If I fix this by:
try:
value = self.qsettings.value(option)
except:
value = None

the workbench seams to start but I complains that it cannot find QT5 only QT4.

So then I set system variable QT_API to pyqt5, and Workbench is running fine now.

So then I changed back to:
value = self.qsettings.value(option)

this also works now.

I am not sure why Mantid was using pyqt4 as standard, the QT_API was not set before and then the standard should be pyqt5.

Dear Thomas,

Sorry you are having trouble with the Workbench. The mantidpython script is currently hardcoding pyqt4 as we have not yet made some other parts that depend on that Qt5 compatible.

At a command prompt, in the C:\MantidNightlyInstall directory, could you run bin\launch_workbench.exe -console and see if that gives any errors?

I think this was caused by some other python installation, and some cross-talk between the user options, telling the python which runs the workbench to use pyqt4.
I have delete every python / QT installation and also every Mantid installation and also all rests which where left in the user folder.
Then I reinstalled Mantid 4.0 and the workbench did work without a problem, without setting the QT_API variable.
I then reinstalled anaconda python and it is still working.

I have now also reinstalled the Nightly, and started it as you suggested, it is also working now.
The only error I get is;
Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal

How do I create a plot of a workspace with an extra line at y=0 (or x=0) as can be done in many other packages even including the old MantidPlot?
There’s an option for a grid but that adds lines for every tick and not just y=0. I’m happy to create the plot with a small script if necessary rather than having a button in the plot settings dialog.
I’ve searched the matplotlib documentation with no success so far…

Hi James,

This can be done with a small script.

Make sure the figure you want to add the axis line to is the last figure you created, then you can run the following to add the lines with whatever colour you’d like:

from __future__ import (absolute_import, division, print_function, unicode_literals)

import matplotlib.pyplot as plt

plt.axhline(0, color=‘red’) # this adds a horizontal line at y=0
plt.axvline(0, color=‘green’) # this adds a vertical line at x=0
plt.show()

You can also change the style of the lines like any other Matplotlib line, see matplotlib.pyplot.axhline — Matplotlib 3.1.2 documentation for other arguments you can use.

Hope this helps!

A few pieces of really basic workflow feedback from my first interactions with Workbench (in 4.1).

Reducing TOSCA data:

  • A simple data reduction (multiple run numbers, summed, default rebin) seems to take MUCH longer than it used to. Unsure if this is expected.

Having reduced TOSCA data:

  • Right-click workspace → Plot → Spectrum… → Window pops up to allow you to select which spectrum to plot. In MantidPlot the cursor would already be in the box ready to accept keyboard input, it now requires clicking in the edit box. Very minor but utterly frustrating when plotting many spectra.

Having plotted TOSCA data (or any data??):

  • ANY change to the display options for the line (e.g. toggle error bars, changing line type, etc.) causes a reset of the axes to full scale, even if they’ve been set manually previously. This is annoying to say the least as TOSCA data files run from -20 - 10000 wavenumbers but 99% of plots use a smaller x-range.
  • Possibly this is due to be implemented but previously in MantidPlot it was possible to save a particular “default” set of options for plotting graphs, e.g. line type, etc. - this would be a great feature to have again.
  • After double-clicking on an axis to modify the axis limits then entering the minimum, hitting tab doesn’t take you to the next “max” text box. It seems to have ordered the “max” text box at the end of “tab targets”.

Hi Hamish,

Thanks for taking the time to try the workbench and provide feedback.

Regarding the speed of the TOSCA reduction I can’t think of a particular reason why this should be slower.
@AnthonyLim this is probably one for Matthew to look into - I’ve created an issue: Speed issues with TOSCA reduction on workbench · Issue #26675 · mantidproject/mantid · GitHub.

For the other points I will raise issues for them with the exception of the “default” plot options that is already on the backlog.

Thanks!

1 Like

@Hamish_C what is the size of the reduced file? I think the slow down may be a side effect of the new reduction algorithm, which was designed to prevent large (in the region of gigabyte) files.