Skip to content

Commit a36f6e0

Browse files
committed
fix: remove 'return_scaling_factors'
1 parent 3ae8bd4 commit a36f6e0

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

docs/user-guide/amor/amor-reduction.ipynb

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"metadata": {},
162162
"outputs": [],
163163
"source": [
164-
"amor.data.amor_sample_run(608)"
164+
"amor.data.amor_sample_run('608')"
165165
]
166166
},
167167
{
@@ -178,18 +178,24 @@
178178
"outputs": [],
179179
"source": [
180180
"runs = {\n",
181-
" run_number: {\n",
181+
" '608': {\n",
182182
" # The sample rotation values in the files are slightly off, so we replace\n",
183183
" # them with corrected values.\n",
184-
" SampleRotation[SampleRun]: sc.scalar(sample_rotation_angle, unit='deg'),\n",
185-
" Filename[SampleRun]: amor.data.amor_sample_run(run_number),\n",
186-
" }\n",
187-
" for run_number, sample_rotation_angle in (\n",
188-
" ('608', 0.85),\n",
189-
" ('609', 2.25),\n",
190-
" ('610', 3.65),\n",
191-
" ('611', 5.05),\n",
192-
" )\n",
184+
" SampleRotation[SampleRun]: sc.scalar(0.85, unit='deg'),\n",
185+
" Filename[SampleRun]: amor.data.amor_sample_run('608'),\n",
186+
" },\n",
187+
" '609': {\n",
188+
" SampleRotation[SampleRun]: sc.scalar(2.25, unit='deg'),\n",
189+
" Filename[SampleRun]: amor.data.amor_sample_run('609'),\n",
190+
" },\n",
191+
" '610': {\n",
192+
" SampleRotation[SampleRun]: sc.scalar(3.65, unit='deg'),\n",
193+
" Filename[SampleRun]: amor.data.amor_sample_run('610'),\n",
194+
" },\n",
195+
" '611': {\n",
196+
" SampleRotation[SampleRun]: sc.scalar(5.05, unit='deg'),\n",
197+
" Filename[SampleRun]: amor.data.amor_sample_run('611'),\n",
198+
" },\n",
193199
"}\n",
194200
"\n",
195201
"reflectivity = {}\n",
@@ -218,7 +224,12 @@
218224
"source": [
219225
"from ess.reflectometry.tools import scale_reflectivity_curves_to_overlap\n",
220226
"\n",
221-
"scaled_reflectivity_curves, scale_factors = scale_reflectivity_curves_to_overlap(reflectivity.values(), critical_edge_interval=(sc.scalar(0.01, unit='1/angstrom'), sc.scalar(0.014, unit='1/angstrom')))\n",
227+
"scaled_reflectivity_curves, scale_factors = scale_reflectivity_curves_to_overlap(\n",
228+
" reflectivity.values(),\n",
229+
" # Optionally specify a Q-interval where the reflectivity is known to be 1.0\n",
230+
" critical_edge_interval=(sc.scalar(0.01, unit='1/angstrom'), sc.scalar(0.014, unit='1/angstrom'))\n",
231+
")\n",
232+
"\n",
222233
"sc.plot(dict(zip(reflectivity.keys(), scaled_reflectivity_curves, strict=True)), norm='log', vmin=1e-5)"
223234
]
224235
},
@@ -350,8 +361,8 @@
350361
"source": [
351362
"from ess.amor.figures import wavelength_z_figure\n",
352363
"\n",
353-
"workflow[Filename[SampleRun]] = amor.data.amor_sample_run('608')\n",
354-
"workflow[SampleRotation[SampleRun]] = runs['608']\n",
364+
"workflow[Filename[SampleRun]] = runs['608'][Filename[SampleRun]]\n",
365+
"workflow[SampleRotation[SampleRun]] = runs['608'][SampleRotation[SampleRun]]\n",
355366
"wavelength_z_figure(\n",
356367
" workflow.compute(FootprintCorrectedData[SampleRun]),\n",
357368
" wavelength_bins=workflow.compute(WavelengthBins),\n",

src/ess/reflectometry/tools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,7 @@ def orso_datasets_from_measurements(
333333
reflectivity_curves.append(wf.compute(ReflectivityOverQ))
334334

335335
scale_factors = (
336-
scale_reflectivity_curves_to_overlap(
337-
[r.hist() for r in reflectivity_curves], return_scaling_factors=True
338-
)
336+
scale_reflectivity_curves_to_overlap([r.hist() for r in reflectivity_curves])[1]
339337
if scale_to_overlap
340338
else (1,) * len(runs)
341339
)

tests/tools_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
import pytest
55
import sciline as sl
66
import scipp as sc
7-
87
from numpy.testing import assert_allclose as np_assert_allclose
98
from orsopy.fileio import Orso, OrsoDataset
109
from scipp.testing import assert_allclose
1110

1211
from ess.reflectometry.orso import OrsoIofQDataset
1312
from ess.reflectometry.tools import (
1413
combine_curves,
14+
linlogspace,
1515
orso_datasets_from_measurements,
1616
scale_reflectivity_curves_to_overlap,
17-
linlogspace,
1817
)
1918
from ess.reflectometry.types import Filename, ReflectivityOverQ, SampleRun
2019

@@ -147,7 +146,6 @@ def test_combined_curves():
147146
)
148147

149148

150-
<<<<<<< HEAD
151149
def test_linlogspace_linear():
152150
q_lin = linlogspace(
153151
dim='qz', edges=[0.008, 0.08], scale='linear', num=50, unit='1/angstrom'

0 commit comments

Comments
 (0)