7
7
import sciline
8
8
import scipp as sc
9
9
import scipp .testing
10
+ from scippneutron .io .cif import Author
10
11
11
12
import ess .dream .data # noqa: F401
12
13
from ess import dream , powder
13
- from ess .dream .io .cif import CIFAuthor , CIFAuthors
14
14
from ess .powder .types import (
15
15
AccumulatedProtonCharge ,
16
16
BackgroundRun ,
17
17
CalibrationFilename ,
18
+ CIFAuthors ,
18
19
DspacingBins ,
19
20
Filename ,
20
21
IofDspacing ,
24
25
NeXusSample ,
25
26
NeXusSource ,
26
27
NormalizedByProtonCharge ,
27
- OutFilename ,
28
+ ReducedDspacingCIF ,
28
29
SampleRun ,
29
30
TofMask ,
30
31
TwoThetaBins ,
57
58
WavelengthMask : None ,
58
59
CIFAuthors : CIFAuthors (
59
60
[
60
- CIFAuthor (
61
- name = "Jane Doe" ,
email = "[email protected] " ,
id_orcid = "0000-0000-0000-0001"
61
+ Author (
62
+ name = "Jane Doe" ,
email = "[email protected] " ,
orcid = "0000-0000-0000-0001"
62
63
),
63
64
]
64
65
),
@@ -159,26 +160,19 @@ def test_use_workflow_helper(workflow):
159
160
160
161
161
162
def test_pipeline_can_save_data (workflow ):
162
- def get_result (da : IofDspacing ) -> IofDspacing :
163
- return da
164
-
165
- buffer = io .StringIO ()
166
- workflow [OutFilename ] = buffer
167
163
workflow = powder .with_pixel_mask_filenames (workflow , [])
164
+ result = workflow .compute (ReducedDspacingCIF )
168
165
169
- result , expected = workflow .bind_and_call (
170
- [dream .io .save_reduced_dspacing , get_result ]
171
- )
172
- sc .testing .assert_identical (result , expected )
173
-
166
+ buffer = io .StringIO ()
167
+ result .save (buffer )
174
168
buffer .seek (0 )
175
169
content = buffer .read ()
176
- # print(content)
177
- # assert False
178
170
179
171
assert content .startswith (r'#\#CIF_1.1' )
180
172
_assert_contains_source_info (content )
181
173
_assert_contains_author_info (content )
174
+ _assert_contains_beamline_info (content )
175
+ _assert_contains_dspacing_data (content )
182
176
183
177
184
178
def _assert_contains_source_info (cif_content : str ) -> None :
@@ -188,3 +182,14 @@ def _assert_contains_source_info(cif_content: str) -> None:
188
182
def _assert_contains_author_info (cif_content : str ) -> None :
189
183
assert "audit_contact_author.name 'Jane Doe'" in cif_content
190
184
assert 'audit_contact_author.email [email protected] ' in cif_content
185
+
186
+
187
+ def _assert_contains_beamline_info (cif_content : str ) -> None :
188
+ assert 'diffrn_source.beamline DREAM' in cif_content
189
+ assert 'diffrn_source.facility ESS' in cif_content
190
+
191
+
192
+ def _assert_contains_dspacing_data (cif_content : str ) -> None :
193
+ assert 'pd_proc.d_spacing' in cif_content
194
+ assert 'pd_proc.intensity_net' in cif_content
195
+ assert 'pd_proc.intensity_net_su' in cif_content
0 commit comments