def integrate_ranges(ranges, integral, mask, detector, input_workspace_name, input_workspace, x_dim, y_dim, is_multi_range): for integral_range in ranges: output_workspace = generate_output_workspace_name(integral_range, integral, mask, detector, input_workspace_name) output_workspace = run_algorithm(input_workspace, integral_range, integral, output_workspace, x_dim, y_dim) if is_multi_range: add_to_group(output_workspace, input_workspace_name + '_ranges') if is_multi_range: return AnalysisDataService.retrieve(input_workspace_name + '_ranges') else: return output_workspace