Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/user-guide/dream/dream-advanced-powder-reduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@
").rename_axis(index='detector')\n",
"\n",
"all_detector_workflow = workflow.copy()\n",
"mapped = all_detector_workflow[EmptyCanSubtractedIofDspacing[SampleRun]].map(\n",
"mapped = all_detector_workflow[EmptyCanSubtractedIofDspacing].map(\n",
" parameter_table\n",
")\n",
"all_detector_workflow[EmptyCanSubtractedIofDspacing[SampleRun]] = mapped.reduce(\n",
"all_detector_workflow[EmptyCanSubtractedIofDspacing] = mapped.reduce(\n",
" func=powder.grouping.collect_detectors\n",
")"
]
Expand All @@ -444,7 +444,7 @@
"outputs": [],
"source": [
"all_detector_workflow.visualize(\n",
" EmptyCanSubtractedIofDspacing[SampleRun], graph_attr={\"rankdir\": \"LR\"}, compact=True\n",
" EmptyCanSubtractedIofDspacing, graph_attr={\"rankdir\": \"LR\"}, compact=True\n",
")"
]
},
Expand All @@ -463,7 +463,7 @@
"metadata": {},
"outputs": [],
"source": [
"result = all_detector_workflow.compute(EmptyCanSubtractedIofDspacing[SampleRun])"
"result = all_detector_workflow.compute(EmptyCanSubtractedIofDspacing)"
]
},
{
Expand Down Expand Up @@ -537,10 +537,10 @@
").rename_axis(index='detector')\n",
"\n",
"all_detector_workflow = workflow.copy()\n",
"mapped = all_detector_workflow[EmptyCanSubtractedIofDspacingTwoTheta[SampleRun]].map(\n",
"mapped = all_detector_workflow[EmptyCanSubtractedIofDspacingTwoTheta].map(\n",
" parameter_table\n",
")\n",
"all_detector_workflow[EmptyCanSubtractedIofDspacingTwoTheta[SampleRun]] = mapped.reduce(\n",
"all_detector_workflow[EmptyCanSubtractedIofDspacingTwoTheta] = mapped.reduce(\n",
" func=powder.grouping.collect_detectors\n",
")"
]
Expand All @@ -553,7 +553,7 @@
"outputs": [],
"source": [
"all_detector_workflow.visualize(\n",
" EmptyCanSubtractedIofDspacingTwoTheta[SampleRun],\n",
" EmptyCanSubtractedIofDspacingTwoTheta,\n",
" graph_attr={\"rankdir\": \"LR\"},\n",
" compact=True,\n",
")"
Expand All @@ -566,7 +566,7 @@
"metadata": {},
"outputs": [],
"source": [
"result = all_detector_workflow.compute(EmptyCanSubtractedIofDspacingTwoTheta[SampleRun])"
"result = all_detector_workflow.compute(EmptyCanSubtractedIofDspacingTwoTheta)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/dream/dream-powder-reduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@
"outputs": [],
"source": [
"results = workflow.compute([\n",
" EmptyCanSubtractedIofDspacing[SampleRun],\n",
" EmptyCanSubtractedIofDspacing,\n",
" ReducedEmptyCanSubtractedTofCIF\n",
"])\n",
"intensity = results[EmptyCanSubtractedIofDspacing[SampleRun]]\n",
"intensity = results[EmptyCanSubtractedIofDspacing]\n",
"cif_data = results[ReducedEmptyCanSubtractedTofCIF]"
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/ess/powder/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def convert_reduced_to_tof(


def convert_reduced_to_empty_can_subtracted_tof(
data: EmptyCanSubtractedIofDspacing[SampleRun], calibration: OutputCalibrationData
data: EmptyCanSubtractedIofDspacing, calibration: OutputCalibrationData
) -> EmptyCanSubtractedIntensityTof:
return EmptyCanSubtractedIntensityTof(
_convert_reduced_to_tof_impl(data, calibration)
Expand Down
4 changes: 2 additions & 2 deletions src/ess/powder/correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,14 @@ def apply_lorentz_correction(da: sc.DataArray) -> sc.DataArray:
def subtract_empty_can(
data: IntensityDspacing[SampleRun],
background: IntensityDspacing[EmptyCanRun],
) -> EmptyCanSubtractedIofDspacing[SampleRun]:
) -> EmptyCanSubtractedIofDspacing:
return EmptyCanSubtractedIofDspacing(data.bins.concatenate(-background))


def subtract_empty_can_two_theta(
data: IntensityDspacingTwoTheta[SampleRun],
background: IntensityDspacingTwoTheta[EmptyCanRun],
) -> EmptyCanSubtractedIofDspacingTwoTheta[SampleRun]:
) -> EmptyCanSubtractedIofDspacingTwoTheta:
return EmptyCanSubtractedIofDspacingTwoTheta(data.bins.concatenate(-background))


Expand Down
12 changes: 6 additions & 6 deletions src/ess/powder/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ class IntensityDspacingTwoTheta(sciline.Scope[RunType, sc.DataArray], sc.DataArr
"""Data that has been normalized by a vanadium run, and grouped into 2theta bins."""


class EmptyCanSubtractedIofDspacing(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
"""Intensity vs. d-spacing, subtracted by empty can measurement."""
EmptyCanSubtractedIofDspacing = NewType("EmptyCanSubtractedIofDspacing", sc.DataArray)
"""Intensity vs. d-spacing, subtracted by empty can measurement."""


class EmptyCanSubtractedIofDspacingTwoTheta(
sciline.Scope[RunType, sc.DataArray], sc.DataArray
):
"""Intensity vs. d-spacing and 2theta, subtracted by empty can measurement."""
EmptyCanSubtractedIofDspacingTwoTheta = NewType(
"EmptyCanSubtractedIofDspacingTwoTheta", sc.DataArray
)
"""Intensity vs. d-spacing and 2theta, subtracted by empty can measurement."""


IntensityTof = NewType("IntensityTof", sc.DataArray)
Expand Down
6 changes: 3 additions & 3 deletions tests/dream/geant4_reduction_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def make_workflow(params_for_det, *, run_norm):

def test_pipeline_can_compute_dspacing_result(workflow):
workflow = powder.with_pixel_mask_filenames(workflow, [])
result = workflow.compute(EmptyCanSubtractedIofDspacing[SampleRun])
result = workflow.compute(EmptyCanSubtractedIofDspacing)
assert result.sizes == {'dspacing': len(params[DspacingBins]) - 1}
assert sc.identical(result.coords['dspacing'], params[DspacingBins])

Expand All @@ -113,7 +113,7 @@ def test_pipeline_can_compute_dspacing_result_without_empty_can(workflow):
def test_pipeline_can_compute_dspacing_result_using_lookup_table_filename(workflow):
workflow = powder.with_pixel_mask_filenames(workflow, [])
workflow[TimeOfFlightLookupTableFilename] = dream.data.tof_lookup_table_high_flux()
result = workflow.compute(EmptyCanSubtractedIofDspacing[SampleRun])
result = workflow.compute(EmptyCanSubtractedIofDspacing)
assert result.sizes == {'dspacing': len(params[DspacingBins]) - 1}
assert sc.identical(result.coords['dspacing'], params[DspacingBins])

Expand Down Expand Up @@ -191,7 +191,7 @@ def test_pipeline_normalizes_and_subtracts_empty_can_as_expected(
workflow[FocussedDataDspacing[EmptyCanRun]] = empty_can
workflow[UncertaintyBroadcastMode] = UncertaintyBroadcastMode.drop
workflow = powder.with_pixel_mask_filenames(workflow, [])
result = workflow.compute(EmptyCanSubtractedIofDspacing[SampleRun])
result = workflow.compute(EmptyCanSubtractedIofDspacing)

subtracted = sample.bins.concatenate(-empty_can)
expected = powder.correction.normalize_by_vanadium_dspacing(
Expand Down
Loading