|
20 | 20 | GravityVector, |
21 | 21 | IntensityDspacing, |
22 | 22 | IntensityTof, |
| 23 | + MonitorCoordTransformGraph, |
23 | 24 | MonitorType, |
24 | 25 | Position, |
25 | 26 | RunType, |
@@ -268,22 +269,52 @@ def convert_reduced_to_empty_can_subtracted_tof( |
268 | 269 | ) |
269 | 270 |
|
270 | 271 |
|
| 272 | +def powder_monitor_coordinate_transformation_graph( |
| 273 | + source_position: Position[snx.NXsource, RunType], |
| 274 | + sample_position: Position[snx.NXsample, RunType], |
| 275 | + gravity: GravityVector, |
| 276 | +) -> MonitorCoordTransformGraph[RunType]: |
| 277 | + """Generate a coordinate transformation graph for monitors, |
| 278 | +
|
| 279 | + Parameters |
| 280 | + ---------- |
| 281 | + source_position: |
| 282 | + Position of the neutron source. |
| 283 | + sample_position: |
| 284 | + Position of the sample. |
| 285 | + gravity: |
| 286 | + Gravity vector. |
| 287 | +
|
| 288 | + Returns |
| 289 | + ------- |
| 290 | + : |
| 291 | + A dictionary with the graph for the transformation. |
| 292 | + """ |
| 293 | + return MonitorCoordTransformGraph( |
| 294 | + { |
| 295 | + **scn.conversion.graph.beamline.beamline(scatter=False), |
| 296 | + **scn.conversion.graph.tof.elastic("tof"), |
| 297 | + 'source_position': lambda: source_position, |
| 298 | + 'sample_position': lambda: sample_position, |
| 299 | + 'gravity': lambda: gravity, |
| 300 | + } |
| 301 | + ) |
| 302 | + |
| 303 | + |
271 | 304 | def convert_monitor_to_wavelength( |
272 | 305 | monitor: TofMonitor[RunType, MonitorType], |
| 306 | + graph: MonitorCoordTransformGraph[RunType], |
273 | 307 | ) -> WavelengthMonitor[RunType, MonitorType]: |
274 | | - graph = { |
275 | | - **scn.conversion.graph.beamline.beamline(scatter=False), |
276 | | - **scn.conversion.graph.tof.elastic("tof"), |
277 | | - } |
278 | 308 | return WavelengthMonitor[RunType, MonitorType]( |
279 | 309 | monitor.transform_coords("wavelength", graph=graph, keep_intermediate=False) |
280 | 310 | ) |
281 | 311 |
|
282 | 312 |
|
283 | 313 | providers = ( |
284 | | - powder_coordinate_transformation_graph, |
285 | 314 | add_scattering_coordinates_from_positions, |
286 | 315 | convert_reduced_to_tof, |
287 | 316 | convert_reduced_to_empty_can_subtracted_tof, |
288 | 317 | convert_monitor_to_wavelength, |
| 318 | + powder_coordinate_transformation_graph, |
| 319 | + powder_monitor_coordinate_transformation_graph, |
289 | 320 | ) |
0 commit comments