def initialize_Mantid(): """ Start mantid framework """ global mtd global mantid_initialized if mantid_initialized: return sys.path.append(os.getcwd()) sys.path.append( os.path.join( os.getcwd(), 'bin') ) import MantidFramework from MantidFramework import mtd mtd.initialise() mantid_initialized = True
def initialize_Mantid(mantidpath): """ Start mantid framework """ global mtd global mantid_initialized if mantid_initialized: return sys.path.append(mantidpath) sys.path.append( os.path.join(mantidpath, 'bin') ) sys.path.append(os.getcwd()) sys.path.append( os.path.join( os.getcwd(), 'bin') ) try: import MantidFramework from MantidFramework import mtd except: raise Exception("Error importing MantidFramework. Did you specify the --mantidpath option?") mtd.initialise() mantid_initialized = True
import unittest import os from MantidFramework import mtd mtd.initialise() from mantidsimple import * # import Numpy to check that it's on the system import numpy class NumpyTest(unittest.TestCase): """ Simple test to check the numpy integration """ def setUp(self): pass def test_array_output(self): loader = LoadCanSAS1D("LOQ_CANSAS1D.xml", "test") # Get the Y array x = mtd["test"].dataY(0) # Check that we got an ndarray # self.assertEqual(x.__class__, numpy.ndarray) # Some sanity check to verify that we have the right file
if os.path.exists('/SNS/TOPAZ/shared/PythonPrograms/PythonLibrary'): sys.path.append('/SNS/TOPAZ/shared/PythonPrograms/PythonLibrary') else: sys.path.append('C:\ISAW_repo\PythonPrograms\PythonLibrary') import ReduceDictionary if os.path.exists("/opt/Mantid/bin"): sys.path.append("/opt/Mantid/bin") # sys.path.append("/opt/mantidnightly/bin") else: sys.path.append("C:/MantidInstall/bin") from mantid.simpleapi import * from MantidFramework import mtd mtd.initialise() # from mantidsimple import * # # Get the config file name and the run number to process from the command line # if (len(sys.argv) < 3): print "You MUST give the config file name and run number on the command line" exit(0) config_file_name = sys.argv[1] run = sys.argv[2] # # Load the parameter names and values from the specified configuration file # into a dictionary and set all the required parameters from the dictionary.
def test_import(self): from MantidFramework import mtd mtd.initialise()