def __init__(self): ''' Constructor ''' dataBaseName = configParser.get("Database", "name") dataBaseUri = configParser.get("Database", "uri") instrumentName = configParser.get("General", "instrument_name") self.db = globals()[dataBaseName](dataBaseUri,instrumentName)
def __init__(self): ''' Constructor @param launcherNameToUse : Parameters of the launcher ''' classLauncher = globals()[configParser.get("Launcher", "name")] executable = configParser.get("Launcher", "executable") if executable is not None and len(executable.strip())>0: classLauncherInitParams = ast.literal_eval(executable) self.launcher = classLauncher(classLauncherInitParams) else: self.launcher = classLauncher()
def _buildInputParams(self): ''' Necessary input params for Lamp and Mantid Some redundancy is introduced as scripts read different formats ''' params = {} params["instrument"] = configParser.get("General", "instrument_name") if self.validator.jsonContent.has_key("params") : queryParams = self.validator.jsonContent["params"] if queryParams.has_key("numors"): # list of numors: listOfNumorsText = queryParams["numors"] # TODO : We have to handle this for numor ranges listOfNumors = listOfNumorsText.split(',') db = storage.getDBConnection() listOfFiles = db.getListOfFiles(listOfNumors) if len(listOfFiles) <= 0: raise Exception("The numors %s don't exist in the DB"%listOfNumors) elif len(listOfFiles) > 1: params["data_files_full_path"]=listOfFiles params["data_files"] = [] for i in listOfFiles: b = os.path.basename(i) params["data_files"].append(b) else: params["data_file_full_path"]=listOfFiles[0] params["data_file"] = os.path.basename(listOfFiles[0]) # Assuming all files in the same folder params["working_path"] = os.path.dirname(listOfFiles[0]) logger.debug(pprint.pformat(params)) return params
def __init__(self,databaseNamePrefix='reduction'): ''' Constructor ''' self.client = MongoClient() # localhost databasename = databaseNamePrefix + configParser.get("General", "instrument_name") self.db = self.client[databasename] logger.debug("Using database: %s."%databasename)
def setUp(self): # For the tests to pass self.instrumentNameOriginal = configParser.get("General", "instrument_name") configParser.set("General", "instrument_name", self.instrumentName)
import config.config from config.config import configParser import sys sys.path.append(configParser.get('Mantid','bin_folder')) from mantid.simpleapi import * ### Usefull functions def workspaceToDic(ws): res = {} # res["type"] = "1d" # # res["y_axis"] = ws.extractY().shape[1] # res["y_axis_data"] = ws.extractY()[0] # # res["x_axis_size"] = ws.extractX().shape[1] # res["x_axis_data"] = ws.extractX()[0] # # xAxis = ws.getAxis(0) # xAxisUnit = xAxis.getUnit() # res["x_axis_label"] = xAxisUnit.name() # res["x_axis_unit"] = xAxisUnit.label() # # yAxis = ws.getAxis(1) # yAxisUnit = yAxis.getUnit() # res["y_axis_label"] = yAxisUnit.name() # res["y_axis_unit"] = yAxisUnit.label()
def __init__(self): ''' Constructor ''' functionsFilename = configParser.get("General", "functions_specs_file") self._functionsDic = self._importJsonFromFile(functionsFilename)
def __init__(self): ''' Constructor ''' self._functionsFilename = configParser.get("General", "functions_specs_file") self._instrumentName = configParser.get("General", "instrument_name")