Skip to content

Commit 08c9c56

Browse files
committed
test: update saved orso file with better data
1 parent cbec456 commit 08c9c56

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

tests/amor/pipeline_test.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
from scipp.testing import assert_allclose
1111

1212
from ess import amor
13-
from ess.amor import data # noqa: F401
13+
from ess.amor import data
1414
from ess.reflectometry import orso
15+
from ess.reflectometry.tools import scale_reflectivity_curves_to_overlap
1516
from ess.reflectometry.types import (
1617
Filename,
1718
ProtonCurrent,
@@ -105,13 +106,40 @@ def test_orso_pipeline(amor_pipeline: sciline.Pipeline):
105106

106107
@pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation")
107108
@pytest.mark.filterwarnings("ignore:Invalid transformation, missing attribute")
108-
def test_save_reduced_orso_file(amor_pipeline: sciline.Pipeline, output_folder: Path):
109+
def test_save_reduced_orso_file(output_folder: Path):
109110
from orsopy import fileio
110111

111-
amor_pipeline[SampleRotation[SampleRun]] = sc.scalar(0.85, unit="deg")
112-
amor_pipeline[Filename[SampleRun]] = amor.data.amor_run(608)
113-
res = amor_pipeline.compute(orso.OrsoIofQDataset)
114-
fileio.orso.save_orso(datasets=[res], fname=output_folder / 'amor_reduced_iofq.ort')
112+
wf = sciline.Pipeline(providers=amor.providers, params=amor.default_parameters())
113+
wf[SampleSize[SampleRun]] = sc.scalar(10.0, unit="mm")
114+
wf[SampleSize[ReferenceRun]] = sc.scalar(10.0, unit="mm")
115+
wf[YIndexLimits] = sc.scalar(11), sc.scalar(41)
116+
wf[WavelengthBins] = sc.geomspace("wavelength", 3, 12.5, 2000, unit="angstrom")
117+
wf[ZIndexLimits] = sc.scalar(170), sc.scalar(266)
118+
wf = with_filenames(
119+
wf, SampleRun, [data.amor_run(4079), data.amor_run(4080), data.amor_run(4081)]
120+
)
121+
wf[Filename[ReferenceRun]] = data.amor_run(4152)
122+
wf[QBins] = sc.geomspace(dim="Q", start=0.01, stop=0.06, num=201, unit="1/angstrom")
123+
r = wf.compute(ReflectivityOverQ)
124+
_, (s, *_) = scale_reflectivity_curves_to_overlap(
125+
[r.hist()],
126+
critical_edge_interval=(
127+
sc.scalar(0.01, unit='1/angstrom'),
128+
sc.scalar(0.014, unit='1/angstrom'),
129+
),
130+
)
131+
wf[ReflectivityOverQ] = s * r
132+
wf[orso.OrsoCreator] = orso.OrsoCreator(
133+
fileio.base.Person(
134+
name="Max Mustermann",
135+
affiliation="European Spallation Source ERIC",
136+
contact="[email protected]",
137+
)
138+
)
139+
fileio.orso.save_orso(
140+
datasets=[wf.compute(orso.OrsoIofQDataset)],
141+
fname=output_folder / 'amor_reduced_iofq.ort',
142+
)
115143

116144

117145
@pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation")

0 commit comments

Comments
 (0)