|
9 | 9 | from Engineering.texture.correction.correction_model import TextureCorrectionModel |
10 | 10 | from Engineering.texture.polefigure.polefigure_model import TextureProjection |
11 | 11 | from mantid.simpleapi import SaveNexus, logger, CreateEmptyTableWorkspace, Fit |
12 | | -from mantid.simpleapi import ConvertUnits, Rebunch, Rebin, SumSpectra, AppendSpectra, CloneWorkspace, CropWorkspace, Load |
| 12 | +from mantid.simpleapi import ConvertUnits, Rebunch, Rebin, SumSpectra, AppendSpectra, CloneWorkspace, CropWorkspaceRagged, Load |
13 | 13 | from pathlib import Path |
14 | 14 | from Engineering.EnginX import EnginX |
15 | 15 | from Engineering.IMAT import IMAT |
@@ -288,18 +288,17 @@ def validate_abs_corr_inputs( |
288 | 288 |
|
289 | 289 |
|
290 | 290 | def crop_and_rebin(ws, out_ws, lower, upper, rebin_params): |
291 | | - CropWorkspace(ws, lower, upper, OutputWorkspace="__tmp_peak_window") |
| 291 | + CropWorkspaceRagged(ws, lower, upper, OutputWorkspace="__tmp_peak_window") |
292 | 292 | Rebin("__tmp_peak_window", rebin_params, OutputWorkspace=out_ws) |
293 | 293 |
|
294 | 294 |
|
295 | 295 | def _get_max_bin(ws): |
296 | | - xdat = ws.extractX() |
297 | | - return np.diff(xdat, axis=1).max() |
| 296 | + return max(np.diff(ws.readX(i)).max() for i in range(ws.getNumberHistograms())) |
298 | 297 |
|
299 | 298 |
|
300 | 299 | def crop_wss_and_combine(wss, peak, lower, upper, output): |
301 | 300 | cropped_rebinned_wss = [f"rebin_ws_{peak}_0"] |
302 | | - peak_window_ws = CropWorkspace(wss[0], lower, upper, OutputWorkspace="__peak_window_crop") |
| 301 | + peak_window_ws = CropWorkspaceRagged(wss[0], lower, upper, OutputWorkspace="__peak_window_crop") |
303 | 302 | rebin_params = (lower, _get_max_bin(peak_window_ws), upper) |
304 | 303 | Rebin("__peak_window_crop", rebin_params, OutputWorkspace=f"rebin_ws_{peak}_0") |
305 | 304 | CloneWorkspace(InputWorkspace=f"rebin_ws_{peak}_0", OutputWorkspace=f"rebin_ws_{peak}") |
@@ -663,7 +662,6 @@ def fit_all_peaks( |
663 | 662 | # we will then fix the amount this can change in the individual fits |
664 | 663 |
|
665 | 664 | x0_lims, all_cropped_rebinned_wss = fit_initial_summed_spectra(wss, peaks, peak_window, fit_kwargs.copy(), peak_func_name) |
666 | | - |
667 | 665 | for iws, wsname in enumerate(wss): |
668 | 666 | # notice user how far through the fitting they are (useful if any fits fail) |
669 | 667 | logger.notice(f"Fitting Workspace: {wsname} ({iws + 1}/{len(wss)})") |
|
0 commit comments