def _handle_browse(self): # Add Error handling search_directories = ConfigService.Instance().getDataSearchDirs() file_paths = self.view.show_file_picker(RunSelectorPresenter.file_extensions, search_directories) self._add_runs(self.find_from_file_path(file_path) for file_path in file_paths) self._refresh()
def archive_search(): DEFAULT_FACILITY = 'default.facility' DEFAULT_INSTRUMENT = 'default.instrument' SEARCH_ARCHIVE = 'datasearch.searcharchive' HFIR = 'HFIR' HB2B = 'HB2B' # get the old values config = ConfigService.Instance() old_config = {} for property_name in [ DEFAULT_FACILITY, DEFAULT_INSTRUMENT, SEARCH_ARCHIVE ]: old_config[property_name] = config[property_name] # don't update things that are already set correctly if config[DEFAULT_FACILITY] == HFIR: del old_config[DEFAULT_FACILITY] else: config[DEFAULT_FACILITY] = HFIR if config[DEFAULT_INSTRUMENT] == HB2B: del old_config[DEFAULT_INSTRUMENT] else: config[DEFAULT_INSTRUMENT] = HB2B if HFIR in config[SEARCH_ARCHIVE]: del old_config[SEARCH_ARCHIVE] else: config[SEARCH_ARCHIVE] = HFIR try: # give back context yield finally: # set properties back to original values for property_name in old_config.keys(): config[property_name] = old_config[property_name]
def runTest(self): ConfigService.Instance().setString("default.instrument", "INTER") Load(self.runs_file, OutputWorkspace=self.runs_workspace) CreateTransmissionWorkspaces(self.transmission_run_names[0], self.transmission_run_names[1], scale=False) workspaces_to_exclude_from_result = AnalysisDataService.Instance( ).getObjectNames() stitched_name = StitchedTransmissionWorkspaceName( self.transmission_run_names[0], self.transmission_run_names[1]) Stitch1D(LHSWorkspace=TransmissionWorkspaceName( self.transmission_run_names[0]), RHSWorkspace=TransmissionWorkspaceName( self.transmission_run_names[1]), StartOverlap=10, EndOverlap=12, ScaleRHSWorkspace=False, OutputWorkspace=stitched_name) AutoReduce([stitched_name, stitched_name], self.run_numbers) RemoveWorkspaces(workspaces_to_exclude_from_result) GroupWorkspaces( InputWorkspaces=AnalysisDataService.Instance().getObjectNames(), OutputWorkspace=self.result_workspace) mtd[self.result_workspace].sortByName()
def setupInstrument(): configI = ConfigService.Instance() configI.setString("default.instrument", "INTER") configI.setString("default.facility", "ISIS")