This section allows the user to:
Table of Contents
Workspaces hold the data in Mantid. They come in several forms, but the most common is the Matrix Workspace which represents XYE data for one or more spectra. In MantidWorkbench the data contained in a workspace can viewed as a matrix or a table, and graphed in many ways including Line graphs, and ‘colourful’ (contour) plots.
Interaction with workspaces is typically through an interface. Matrix Workspaces are typically created by executing one of Mantid’s ‘Load’ algorithms or are the output of algorithms which take a Matrix Workspace as input.
In addition to data, workspaces hold a workspace history, which details the algorithms which have been run on this workspace.
The workspace list pane is found on the left-hand side of the main MantidWorkbench window. When a muon data set is loaded via the GUI, the Matrix Workspaces are created automatically and stored within a workspace called Muon Data; in turn this workspace contains the following sub-workspaces:
NAME12345 MA which contains all the Muon Analysis data for run 12345 on the NAME instrument. This data is further separated into more sub-workspaces, these are listed below.
In general the muon analysis GUI hides workspaces from the user; however, an understanding of their functionality is sometimes useful to take advantage of some of the more advanced features of MantidWorkbench. In particular, for those seeking to develop a specialist analysis method, the GUI can be used for the initial data reduction, while user coded Python or C++ algorithms act on workspaces to process the final result. This type of hybrid workflow demonstrates the versatility of the MantidWorkbench interface.
Other types of object, such as Tables, Matrices and Notes, may be created through the MantidWorkbench interface. As these are not workspaces the Algorithms can’t directly be applied. However, Tables may be converted to either a Table or Matrix workspace through an option on the analysis menu for subsequent data processing. For instance, converting the Results Table to a matrix workspace enables MantidWorkbench fitting the be carried out.
Matrix Workspaces are typically created by executing one of Mantid’s ‘Load’ algorithms or are the output of algorithms which take a Matrix Workspace as input. In addition to data, workspaces hold a workspace history which lists the algorithms that have been applied to the data.
To load a raw data file without using the Mantid Analysis GUI, and examine its content:
- In the ‘Workspaces’ pane, click Load>File
- Load the file HIFI00062798.nxs by using the Browse button - See Figure 9(a).
Click on the arrow beside the file name – this allows information about the format of data file to be viewed. The following should be seen in the Workspace List pane to the right of the screen.
It can be seen that a workspace called HIFI00062798 has been created and...
However, the NeXuS format allows a lot more information be stored in a data file than that listed above. As an example right click on the file name and select ‘Sample Logs’. A list of experiment and instrument parameters that have been logged during a measurement, from magnetic fields to sample temperatures, appears.
To interrogate any of these logs double click on the ‘Name’, try this with Temp_Cryostat as shown in figure 9(b).
As mentioned, the HIFI00062798.nxs workspace holds within it raw positron counts / bin for each individual HiFi detector. To examine the data collected in a single detector, right click on HIFI00062798 and select “Plot>Spectrum...” .
On HiFi, as way of example, there are 64 detectors hence ID numbers: 1-64 (1-32 = upstream detectors, 33-64 = downstream detectors.
Enter a detector (ID) number of choice and click OK to plot the associated raw data. This process is illustrated below.
For information:
To export the data contained within any listed workspace, the Algorithms tab at the bottom of the workspace list pane can be used.
Follow the instructions below to try this
- Load the workspace HIFI00062798.nxs, see Loading Data for more on how to do this.
- Using the drop-down menu next to the Execute button, type or select SaveAscii, and click Execute. This is shown in Figure 10(b)
- The SaveAscii Input Dialog box - shown in Figure should appear. Select a directory (for the written data file) and specify a file name.
- Note the workspace to be exported can be selected from the uppermost dropdown list, next to InputWorkspace, in this case let us leave it as HIFI00062798.
- Define which workspace spectra to export using the WorkspaceIndexMin and WorkspaceIndexMax inputs. Use these to save spectra 10 and 11.
- Choose the type of data separator used in the file (CSV is usually a reliable option), add comments and uncheck the WriteXError box.
- Export the spectra.
Overlaying data plots can be useful when trying to compare two different sets of data simultaneously by having them on one individual plot. Overlaying data can be done by simply clicking and dragging a workspace onto an existing plot, or can be done via the Overlaying Data option from the workspace pane.
To try this follow these instructions:
- Load the HIFI00062798 workspace and plot spectrum number 10 from the workspace panel, as described in Loading Data .
- Go to the ‘Plots’ menu by clicking the button of the same name in the bottom left of the window, and ensure that the plot of spectrum 10 is selected in bold.
- Return to the workspaces panel and right click on the HIFI00062798 workspace, as before going to Plot but this time selecting ‘Overplot Spectrum...’ rather than ‘Spectrum...’
- Spectrum 20 should now be visible on the spectrum 10 plot along with the original data. This process is shown in Figure 11(a) below.
The plot style a data set can be selected using the gear icon at the top of the plot window, this will open the Figure options menu.
To demonstrate changing a plot’s markers and curve colour follow these instructions:
- Spectrum 20 of HIFI00062798 should already have been plotted, via the Workspaces pane. If not, do so now.
- Click the gear icon above the plot, this will bring up a new Figure options window for the data set.
- Go to the Curves tab and use the Color (RGBA) option under Line to change the colour from Blue to Red.
- Click Apply to view the changes and save the selected option.
- To change the marker style - by default none are shown - use the Style drop-down menu under the Marker heading in bold, use this now to change the marker style to square. Again, click Apply.
One can also change the axis settings, such as the maximum and minimum values, and plotting against a logarithmic scale. The axis limits can be changed either through the Figure options menu, or by double clicking on the relevant axis, while other . See the instructions below for an example on how to change the X-Axis limits and set the Y-Scale to logarithmic.
- Load the MUSR00024563 dataset using the muon analysis GUI, and plot the backward counts. How to do this is described in the Home section of The Tabs.
- Open the Figure options menu as described above, or double click on the X axis to Edit axis.
- In the Axes tab of the Figure options, set the value in the box labelled Right to 16 or do the same for the box labelled Max in the Edit axis dialog.
- Press Apply, or click the OK button.
- In the Y-Axis section of the figure options, use the Scale drop-down menu and change the setting to log or double click on the Y axis and tick the box labelled Log.
- Click OK and observe the changes to the plot, this process is shown for the Figure options in Figure 11(c), and the Edit axis in 11(d).
There are alternate ways, within Mantid, in which data can be fitted with a function, other than using the Muon Analysis GUI; one such solution is the Fit Function tool. The Fit Function tool is similar to the Data Analysis section of the Muon Analysis GUI, however, it is not restricted to muon analysis, and thus contains many more built-in functions.
To demonstrate the process of fitting a function to a workspace with the Fit Function tool, follow the instructions below.
- Open the file HIFI00062798.nxs using the Muon analysis GUI, this can then be closed, as it won’t be used for data analysis.
- Plot the long pair from HIFI62798 Pairs (plotting spectrums described in Loading Data).
- Click on the data plot window and click the Fit button next to the gear icon. See Figure 12(a).
- A new panel should now open on the left hand side of the window, this is the Fit Function panel.
- Note the vertical green limit selection lines present on the plot - by clicking and dragging these the data to be fitted can be constrained; try this now to set the fit limits to ~0 and ~12 . The lines are not currently present in the Fitting tab of the Muon Analysis interface
- Similar to the Muon Analysis GUI, a function can be added by right clicking the ‘Functions’ toggle, selecting ‘Add Function’ and picking a function from the menu. Do this now and add an ExpDecayOsc function to the data.
Alternatively, right clicking the plot, with the Fit Function tool open, and selecting ‘Add other function...’ also adds a function. This will bring up a selection box which lists all available fitting functions in alphabetical order.
- Fit ExpDecayOsc to the data by selecting Fit in the Fit drop down box. Figure 12(b) shows the process. Again note that a better fit is achieved if Alpha has been guessed via the Grouping tab.
User Defined functions can be added to data using the Fit Function tool, see below for instructions on how to do this.
- Load the file EMU00011888.nxs using the Muon Analysis GUI
- In the Home tab of the GUI, change the Detector Grouping to ‘fwd’ and the Plot Type to ‘Counts’, to plot muon counts against time, for the fwd detectors. If this is unclear, re-visit Home in The Tabs. (Without integrated plotting: Go to Muon Data > EMU11888 >EMU11888 Groups and plot the spectrum ending fwd; Counts; #1 as described in Loading Data)
- Click the Fit button at the right hand side of the toolbar to open the fit function tool for the data plot.
- Add the ‘UserFunction’ function, this can be found in the General section of the fit function menu.
- In the Functions panel, there will now be an undefined User Function. Expand it to see the parameters and click on the empty box next to the ‘Formula’ input box, and then the ‘...’ button which appears. This will take you to the User Function dialogue box.
- In the large blank white box at the bottom of the window, define the following function; a*exp(-x/b)+c. This is an exponential decay function for our data.
- Make sure that the ‘Parameters’ box contains all of the parameters for the function (‘a, b, c’) and click ‘Use’ to define the function.
- The three parameters should have now appeared in the function. Change their default values from 0 to 1.
- Fit the function to the data. See Figure 12(c) for the process.