|
20 | 20 | "outputs": [], |
21 | 21 | "source": [ |
22 | 22 | "import scipp as sc\n", |
23 | | - "import scippneutron as scn\n", |
24 | | - "import scippneutron.io\n", |
| 23 | + "from scippneutron.io import cif\n", |
25 | 24 | "\n", |
26 | 25 | "from ess import dream, powder\n", |
27 | 26 | "import ess.dream.data # noqa: F401\n", |
|
87 | 86 | "cell_type": "markdown", |
88 | 87 | "id": "6", |
89 | 88 | "metadata": {}, |
| 89 | + "source": [ |
| 90 | + "We also need some parameters to configure the output file:" |
| 91 | + ] |
| 92 | + }, |
| 93 | + { |
| 94 | + "cell_type": "code", |
| 95 | + "execution_count": null, |
| 96 | + "id": "7", |
| 97 | + "metadata": {}, |
| 98 | + "outputs": [], |
| 99 | + "source": [ |
| 100 | + "workflow[CIFAuthors] = CIFAuthors([\n", |
| 101 | + " cif.Author(\n", |
| 102 | + " name=\"Jane Doe\",\n", |
| 103 | + " email=\"[email protected]\",\n", |
| 104 | + " orcid=\"0000-0000-0000-0001\",\n", |
| 105 | + " role=\"measurement\",\n", |
| 106 | + " ),\n", |
| 107 | + "])" |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + "cell_type": "markdown", |
| 112 | + "id": "8", |
| 113 | + "metadata": {}, |
90 | 114 | "source": [ |
91 | 115 | "## Use the workflow\n", |
92 | 116 | "\n", |
|
96 | 120 | { |
97 | 121 | "cell_type": "code", |
98 | 122 | "execution_count": null, |
99 | | - "id": "7", |
| 123 | + "id": "9", |
100 | 124 | "metadata": {}, |
101 | 125 | "outputs": [], |
102 | 126 | "source": [ |
|
105 | 129 | }, |
106 | 130 | { |
107 | 131 | "cell_type": "markdown", |
108 | | - "id": "8", |
| 132 | + "id": "10", |
109 | 133 | "metadata": {}, |
110 | 134 | "source": [ |
111 | | - "We then call `compute()` to compute the result:" |
| 135 | + "We then call `compute()` to compute the result:\n", |
| 136 | + "(The `cif` object will later be used to write the result to disk.)" |
112 | 137 | ] |
113 | 138 | }, |
114 | 139 | { |
115 | 140 | "cell_type": "code", |
116 | 141 | "execution_count": null, |
117 | | - "id": "9", |
| 142 | + "id": "11", |
118 | 143 | "metadata": {}, |
119 | 144 | "outputs": [], |
120 | 145 | "source": [ |
121 | | - "result = workflow.compute(IofDspacing)\n", |
122 | | - "result" |
| 146 | + "results = workflow.compute([IofDspacing, ReducedDspacingCIF])\n", |
| 147 | + "result = results[IofDspacing]\n", |
| 148 | + "cif_data = results[ReducedDspacingCIF]" |
123 | 149 | ] |
124 | 150 | }, |
125 | 151 | { |
126 | 152 | "cell_type": "code", |
127 | 153 | "execution_count": null, |
128 | | - "id": "10", |
| 154 | + "id": "12", |
129 | 155 | "metadata": {}, |
130 | 156 | "outputs": [], |
131 | 157 | "source": [ |
|
135 | 161 | }, |
136 | 162 | { |
137 | 163 | "cell_type": "markdown", |
138 | | - "id": "11", |
| 164 | + "id": "13", |
139 | 165 | "metadata": {}, |
140 | 166 | "source": [ |
141 | | - "We can now save the result to disk:" |
| 167 | + "We can now save the result to disk:\n", |
| 168 | + "(The comment is optional but helps to identify the file later.)" |
142 | 169 | ] |
143 | 170 | }, |
144 | 171 | { |
145 | 172 | "cell_type": "code", |
146 | 173 | "execution_count": null, |
147 | | - "id": "12", |
| 174 | + "id": "14", |
148 | 175 | "metadata": {}, |
149 | 176 | "outputs": [], |
150 | 177 | "source": [ |
151 | | - "dspacing_histogram.coords[\"dspacing\"] = sc.midpoints(\n", |
152 | | - " dspacing_histogram.coords[\"dspacing\"]\n", |
153 | | - ")\n", |
154 | | - "scn.io.save_xye(\"dspacing.xye\", dspacing_histogram)" |
| 178 | + "cif_data.comment = \"\"\"This file was generated with the DREAM data reduction user guide\n", |
| 179 | + "in the documentation of ESSdiffraction.\n", |
| 180 | + "See https://scipp.github.io/essdiffraction/\n", |
| 181 | + "\"\"\"\n", |
| 182 | + "cif_data.save('dspacing.cif')" |
155 | 183 | ] |
156 | 184 | }, |
157 | 185 | { |
158 | 186 | "cell_type": "markdown", |
159 | | - "id": "13", |
| 187 | + "id": "15", |
160 | 188 | "metadata": {}, |
161 | 189 | "source": [ |
162 | 190 | "## Compute intermediate results\n", |
|
169 | 197 | { |
170 | 198 | "cell_type": "code", |
171 | 199 | "execution_count": null, |
172 | | - "id": "14", |
| 200 | + "id": "16", |
173 | 201 | "metadata": {}, |
174 | 202 | "outputs": [], |
175 | 203 | "source": [ |
|
186 | 214 | { |
187 | 215 | "cell_type": "code", |
188 | 216 | "execution_count": null, |
189 | | - "id": "15", |
| 217 | + "id": "17", |
190 | 218 | "metadata": {}, |
191 | 219 | "outputs": [], |
192 | 220 | "source": [ |
|
198 | 226 | }, |
199 | 227 | { |
200 | 228 | "cell_type": "markdown", |
201 | | - "id": "16", |
| 229 | + "id": "18", |
202 | 230 | "metadata": {}, |
203 | 231 | "source": [ |
204 | 232 | "## Grouping by scattering angle\n", |
|
210 | 238 | { |
211 | 239 | "cell_type": "code", |
212 | 240 | "execution_count": null, |
213 | | - "id": "17", |
| 241 | + "id": "19", |
214 | 242 | "metadata": {}, |
215 | 243 | "outputs": [], |
216 | 244 | "source": [ |
|
222 | 250 | { |
223 | 251 | "cell_type": "code", |
224 | 252 | "execution_count": null, |
225 | | - "id": "18", |
| 253 | + "id": "20", |
226 | 254 | "metadata": {}, |
227 | 255 | "outputs": [], |
228 | 256 | "source": [ |
|
233 | 261 | { |
234 | 262 | "cell_type": "code", |
235 | 263 | "execution_count": null, |
236 | | - "id": "19", |
| 264 | + "id": "21", |
237 | 265 | "metadata": {}, |
238 | 266 | "outputs": [], |
239 | 267 | "source": [ |
|
251 | 279 | { |
252 | 280 | "cell_type": "code", |
253 | 281 | "execution_count": null, |
254 | | - "id": "20", |
| 282 | + "id": "22", |
255 | 283 | "metadata": {}, |
256 | 284 | "outputs": [], |
257 | 285 | "source": [ |
|
275 | 303 | "name": "python", |
276 | 304 | "nbconvert_exporter": "python", |
277 | 305 | "pygments_lexer": "ipython3", |
278 | | - "version": "3.10.14" |
| 306 | + "version": "3.10.13" |
279 | 307 | } |
280 | 308 | }, |
281 | 309 | "nbformat": 4, |
|
0 commit comments