11# SPDX-License-Identifier: BSD-3-Clause
22# Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
3- # flake8: noqa: F403, F405
3+ from pathlib import Path
44
55import numpy as np
66import pytest
@@ -71,6 +71,18 @@ def test_has_expected_coordinates(amor_pipeline: sciline.Pipeline):
7171 assert "Q_resolution" in reflectivity_over_q .coords
7272
7373
74+ @pytest .mark .filterwarnings ("ignore:Failed to convert .* into a transformation" )
75+ @pytest .mark .filterwarnings ("ignore:Invalid transformation, missing attribute" )
76+ def test_pipeline_no_gravity_correction (amor_pipeline : sciline .Pipeline ):
77+ # The sample rotation value in the file is slightly off, so we set it manually
78+ amor_pipeline [SampleRotation [SampleRun ]] = sc .scalar (0.85 , unit = "deg" )
79+ amor_pipeline [Filename [SampleRun ]] = amor .data .amor_sample_run (608 )
80+ amor_pipeline [amor .types .GravityToggle ] = False
81+ reflectivity_over_q = amor_pipeline .compute (ReflectivityOverQ )
82+ assert "Q" in reflectivity_over_q .coords
83+ assert "Q_resolution" in reflectivity_over_q .coords
84+
85+
7486@pytest .mark .filterwarnings ("ignore:Failed to convert .* into a transformation" )
7587@pytest .mark .filterwarnings ("ignore:Invalid transformation, missing attribute" )
7688def test_orso_pipeline (amor_pipeline : sciline .Pipeline ):
@@ -91,6 +103,17 @@ def test_orso_pipeline(amor_pipeline: sciline.Pipeline):
91103 assert np .isfinite (res .data ).all ()
92104
93105
106+ @pytest .mark .filterwarnings ("ignore:Failed to convert .* into a transformation" )
107+ @pytest .mark .filterwarnings ("ignore:Invalid transformation, missing attribute" )
108+ def test_save_reduced_orso_file (amor_pipeline : sciline .Pipeline , output_folder : Path ):
109+ from orsopy import fileio
110+
111+ amor_pipeline [SampleRotation [SampleRun ]] = sc .scalar (0.85 , unit = "deg" )
112+ amor_pipeline [Filename [SampleRun ]] = amor .data .amor_sample_run (608 )
113+ res = amor_pipeline .compute (orso .OrsoIofQDataset )
114+ fileio .orso .save_orso (datasets = [res ], fname = output_folder / 'amor_reduced_iofq.ort' )
115+
116+
94117@pytest .mark .filterwarnings ("ignore:Failed to convert .* into a transformation" )
95118@pytest .mark .filterwarnings ("ignore:Invalid transformation, missing attribute" )
96119def test_pipeline_can_compute_reflectivity_merging_events_from_multiple_runs (
0 commit comments