Skip to content

Commit f066620

Browse files
committed
Add argument to toggle empty can run
1 parent a6812db commit f066620

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

docs/user-guide/dream/dream-powder-reduction.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
"metadata": {},
5757
"outputs": [],
5858
"source": [
59-
"workflow = dream.DreamGeant4Workflow(run_norm=powder.RunNormalization.monitor_histogram)"
59+
"workflow = dream.DreamGeant4Workflow(\n",
60+
" run_norm=powder.RunNormalization.monitor_histogram,\n",
61+
" subtract_empty_can=True,\n",
62+
")"
6063
]
6164
},
6265
{
@@ -94,10 +97,7 @@
9497
"workflow[DspacingBins] = sc.linspace(\"dspacing\", 0.3, 2.3434, 201, unit=\"angstrom\")\n",
9598
"\n",
9699
"# Do not mask any pixels / voxels:\n",
97-
"workflow = powder.with_pixel_mask_filenames(workflow, [])\n",
98-
"\n",
99-
"# Enable subtraction by an empty can measurement:\n",
100-
"powder.correction.add_empty_can_subtraction(workflow)"
100+
"workflow = powder.with_pixel_mask_filenames(workflow, [])"
101101
]
102102
},
103103
{

src/ess/dream/workflow.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from ess.powder.conversion import convert_monitor_to_wavelength
1616
from ess.powder.correction import (
1717
RunNormalization,
18+
add_empty_can_subtraction,
1819
insert_run_normalization,
1920
)
2021
from ess.powder.types import (
@@ -114,16 +115,34 @@ def convert_dream_monitor_to_wavelength(
114115
return convert_monitor_to_wavelength(monitor)
115116

116117

117-
def DreamGeant4Workflow(*, run_norm: RunNormalization) -> sciline.Pipeline:
118+
def DreamGeant4Workflow(
119+
*, run_norm: RunNormalization, subtract_empty_can: bool = False
120+
) -> sciline.Pipeline:
118121
"""
119122
Workflow with default parameters for the Dream Geant4 simulation.
123+
124+
Parameters
125+
----------
126+
run_norm:
127+
Select how to normalize each run (sample, vanadium, etc.).
128+
subtract_empty_can:
129+
If ``True``, subtract the same data by an empty can / empty instrument
130+
measurement before normalizing by vanadium.
131+
This requires specifying a filename parameter for the empty can run.
132+
133+
Returns
134+
-------
135+
:
136+
A workflow object for DREAM.
120137
"""
121138
wf = LoadGeant4Workflow()
122139
for provider in itertools.chain(powder_providers, _dream_providers):
123140
wf.insert(provider)
124141
wf.insert(convert_dream_monitor_to_wavelength)
125142
wf.insert(resample_monitor_time_of_flight_data)
126143
insert_run_normalization(wf, run_norm)
144+
if subtract_empty_can:
145+
add_empty_can_subtraction(wf)
127146
for key, value in itertools.chain(
128147
default_parameters().items(), time_of_flight.default_parameters().items()
129148
):

0 commit comments

Comments
 (0)