AnalysisDataServiceImpl#

This is a Python binding to the C++ class Mantid::API::AnalysisDataServiceImpl.

What is it?#

The Analysis Data Service is a Data Service that is specialized to hold all of the Workspaces that are created by user run algorithms. Whenever an algorithm is executed it automatically extracts its input workspaces from the Analysis Data Service, and inserts its output workspaces upon completion.

Extracting a workspace from the Analysis Data Service#

The most usual way in user code would be to use the FrameworkManager.

Workspace* result = FrameworkManager::Instance().getWorkspace("workspaceName")

Or you could get it directly from the AnalysisDataService (as a Shared Pointer)

Workspace_sptr result = AnalysisDataService::Instance().retrieve("test_out1");

If you were writing an algorithm however you would most likely use a Workspace Property to access or store your workspaces.

Reference#

class mantid.api.AnalysisDataServiceImpl#
static Instance() AnalysisDataServiceImpl :#

Return a reference to the singleton instance

add((AnalysisDataServiceImpl)self, (str)name, (object)item) None :#

Adds the given object to the service with the given name. If the name/object exists it will raise an error.

addOrReplace((AnalysisDataServiceImpl)self, (str)name, (object)item) None :#

Adds the given object to the service with the given name. If the name exists the object is replaced.

addToGroup((AnalysisDataServiceImpl)arg1, (str)groupName, (str)wsName) None :#

Add a workspace in the ADS to a group in the ADS

clear((AnalysisDataServiceImpl)self[, (bool)silent=False]) None :#

Removes all objects managed by the service.

doesExist((AnalysisDataServiceImpl)self, (str)name) bool :#

Returns True if the object is found in the service.

getObjectNames((AnalysisDataServiceImpl)self[, (str)contain='']) list :#

Return the list of names currently known to the ADS

importAll()#

Creates a named variable in the globals dictionary of the current frame (inspect.currentframe).

For example, if the ADS contains a workspace with the name “deltax” then

mtd.importAll()

will create a python variable for that workspace as if the user had typed mtd[‘deltax’].

@param mtd The Analysis Data Service Object

remove((AnalysisDataServiceImpl)self, (str)name) None :#

Remove a named object

removeFromGroup((AnalysisDataServiceImpl)arg1, (str)groupName, (str)wsName) None :#

Remove a workspace from a group in the ADS

retrieve((AnalysisDataServiceImpl)self, (str)name) Workspace :#

Retrieve the named object. Raises an exception if the name does not exist

retrieveGroupPeaksWorkspaces((AnalysisDataServiceImpl)self, (list)names) list#
retrieveWorkspaces((AnalysisDataServiceImpl)self, (list)names[, (bool)unrollGroups=False]) list :#

Retrieve a list of workspaces by name

size((AnalysisDataServiceImpl)self) int :#

Returns the number of objects within the service

unique_hidden_name((AnalysisDataServiceImpl)self) str :#

Return a randomly generated unique hidden workspace name.

unique_name((AnalysisDataServiceImpl)self[, (int)n=5[, (str)prefix=''[, (str)suffix='']]]) str :#

Return a randomly generated unique name for a workspace

Parameters:
  • n (str) – length of string of random numbers

  • prefix (str) – String to be prepended to the generated string

  • suffix (str) – String to be appended to the generated string

Returns:

prefix + n*random characters + suffix

Return type:

str