|
10 | 10 | from scipp.testing import assert_allclose |
11 | 11 |
|
12 | 12 | from ess import amor |
13 | | -from ess.amor import data # noqa: F401 |
| 13 | +from ess.amor import data |
14 | 14 | from ess.reflectometry import orso |
| 15 | +from ess.reflectometry.tools import scale_reflectivity_curves_to_overlap |
15 | 16 | from ess.reflectometry.types import ( |
16 | 17 | Filename, |
17 | 18 | ProtonCurrent, |
@@ -105,13 +106,40 @@ def test_orso_pipeline(amor_pipeline: sciline.Pipeline): |
105 | 106 |
|
106 | 107 | @pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation") |
107 | 108 | @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): |
109 | 110 | from orsopy import fileio |
110 | 111 |
|
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 | + |
| 137 | + ) |
| 138 | + ) |
| 139 | + fileio.orso.save_orso( |
| 140 | + datasets=[wf.compute(orso.OrsoIofQDataset)], |
| 141 | + fname=output_folder / 'amor_reduced_iofq.ort', |
| 142 | + ) |
115 | 143 |
|
116 | 144 |
|
117 | 145 | @pytest.mark.filterwarnings("ignore:Failed to convert .* into a transformation") |
|
0 commit comments