Skip to content

Commit

Permalink
fix the focusing memory issue
Browse files Browse the repository at this point in the history
  • Loading branch information
y8z committed Oct 3, 2024
1 parent 5ded72c commit 9901ad8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
20 changes: 8 additions & 12 deletions total_scattering/file_handling/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import re
import hashlib
import base64
# from mantid.api import AnalysisDataService as ADS

_shared_shape_keys = ["Shape", "Height", "Center"]
required_shape_keys = {
Expand Down Expand Up @@ -323,7 +324,7 @@ def load(ws_name, input_files, group_wksp,
Plus(LHSWorkspace=ws_name,
RHSWorkspace="wksp_tmp_qrb",
OutputWorkspace=ws_name)
DeleteWorkspace(Workspace="wksp_tmp_qrb")
DeleteWorkspace(Workspace="wksp_tmp_qrb")

if absorption_wksp != '':
ConvertUnits(
Expand Down Expand Up @@ -484,7 +485,7 @@ def align_focus_mts(out_wksp,

Rebin(
InputWorkspace="wksp_proc",
OutputWorkspace="wksp_proc_rebin",
OutputWorkspace="wksp_proc",
Params=tof_bin_params,
PreserveEvents=True
)
Expand All @@ -494,30 +495,25 @@ def align_focus_mts(out_wksp,
# Q properly. As a workaround, we can convert to d first,
# then to Q.
ConvertUnits(
InputWorkspace="wksp_proc_rebin",
OutputWorkspace="wksp_proc_rebin_d",
InputWorkspace="wksp_proc",
OutputWorkspace="wksp_proc",
Target="dSpacing"
)

if group_wksp_in is not None:
DiffractionFocussing(
InputWorkspace="wksp_proc_rebin_d",
OutputWorkspace="wksp_proc_focus",
InputWorkspace="wksp_proc",
OutputWorkspace="wksp_proc",
GroupingWorkspace=group_wksp_in
)
wksp_to_convert = "wksp_proc_focus"
else:
wksp_to_convert = "wksp_proc_rebin_d"

ConvertUnits(
InputWorkspace=wksp_to_convert,
InputWorkspace="wksp_proc",
OutputWorkspace=out_wksp,
Target="MomentumTransfer"
)

DeleteWorkspace(Workspace="wksp_proc")
DeleteWorkspace(Workspace="wksp_proc_rebin")
DeleteWorkspace(Workspace=wksp_to_convert)

return

Expand Down
1 change: 1 addition & 0 deletions total_scattering/reduction/total_scattering_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
SaveNexus, \
LoadNexus, \
RenameWorkspace
# from mantid.api import AnalysisDataService as ADS

from total_scattering.file_handling.load import load, create_absorption_wksp
from total_scattering.file_handling.save import save_banks
Expand Down

0 comments on commit 9901ad8

Please sign in to comment.