def createAndLoadAnalysis(anaType, runConfig, folder, name=None): """ Creates a new analysis of the specified anaType, with common analysis folder given. If name is specified, use this name, else use the default for this analysis anaType. The created analysis is then loaded and returned. raises AnalysisException_createFail if something goes wrong. """ if not anaType in AnalysisInterface.getTypes(): raise AnalysisException_createFail("Type '" + anaType + "' is not valid") name = AnalysisInterface.getName(anaType, name) if os.path.exists(os.path.join(folder, name)): raise AnalysisException_createFail("Analysis file already created?!?") import acdOpti.AcdOptiRunConfig assert isinstance(runConfig, acdOpti.AcdOptiRunConfig.AcdOptiRunConfig) if anaType == "Dummy": from Dummy import Dummy Dummy.createNew(folder, name) return Dummy(folder, name, runConfig) if anaType == "DummyInput": from DummyInput import DummyInput DummyInput.createNew(folder, name) return DummyInput(folder, name, runConfig) elif anaType == "FileList": from FileList import FileList FileList.createNew(folder,name) return FileList(folder,name,runConfig) elif anaType == "Omega3P_modeInfo": from Omega3P_modeInfo import Omega3P_modeInfo Omega3P_modeInfo.createNew(folder, name) return Omega3P_modeInfo(folder,name,runConfig) elif anaType == "RFpost": from RFpost import RFpost RFpost.createNew(folder, name) return RFpost(folder, name, runConfig) elif anaType == "RFpost_local": from RFpost_local import RFpost_local RFpost_local.createNew(folder, name) return RFpost_local(folder,name,runConfig) elif anaType == "GroupVelocity": from GroupVelocity import GroupVelocity GroupVelocity.createNew(folder, name) return GroupVelocity(folder, name, runConfig) elif anaType == "ScMax": from ScMax import ScMax ScMax.createNew(folder, name) return ScMax(folder, name, runConfig) elif anaType == "ModeFileRecalc": from ModeFileRecalc import ModeFileRecalc ModeFileRecalc.createNew(folder, name) return ModeFileRecalc(folder, name, runConfig) elif anaType == "Metadata": from Metadata import Metadata Metadata.createNew(folder, name) return Metadata(folder,name,runConfig) else: raise AnalysisException_createFail("Unknown analysis type '" + anaType + "'")