Skip to content

Commit b3707a9

Browse files
committed
Change names to standard scheme
1 parent af78c8e commit b3707a9

File tree

13 files changed

+531
-645
lines changed

13 files changed

+531
-645
lines changed

docs/user-guide/tof/dream.ipynb

Lines changed: 195 additions & 243 deletions
Large diffs are not rendered by default.

docs/user-guide/tof/frame-unwrapping.ipynb

Lines changed: 101 additions & 127 deletions
Large diffs are not rendered by default.

docs/user-guide/tof/wfm.ipynb

Lines changed: 127 additions & 165 deletions
Large diffs are not rendered by default.

src/ess/reduce/live/raw.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import scippnexus as snx
3030

3131
from ess.reduce.nexus.types import (
32-
CalibratedDetector,
32+
EmptyDetector,
3333
Filename,
3434
NeXusComponent,
3535
NeXusDetectorName,
@@ -305,7 +305,7 @@ def transform_weights(
305305

306306
@staticmethod
307307
def from_detector_and_histogrammer(
308-
detector: CalibratedDetector[SampleRun],
308+
detector: EmptyDetector[SampleRun],
309309
window: RollingDetectorViewWindow,
310310
projection: Histogrammer,
311311
) -> RollingDetectorView:
@@ -320,10 +320,10 @@ def from_detector_and_histogrammer(
320320
def from_detector_with_projection(
321321
projection: Callable[[sc.DataArray], sc.DataArray] | None,
322322
) -> Callable[
323-
[CalibratedDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
323+
[EmptyDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
324324
]:
325325
def factory(
326-
detector: CalibratedDetector[SampleRun],
326+
detector: EmptyDetector[SampleRun],
327327
window: RollingDetectorViewWindow,
328328
) -> RollingDetectorView:
329329
"""Helper for constructing via a Sciline workflow."""
@@ -591,7 +591,7 @@ def gaussian_position_noise(sigma: PositionNoiseSigma) -> PositionNoise:
591591

592592
def position_with_noisy_replicas(
593593
*,
594-
detector: CalibratedDetector[SampleRun],
594+
detector: EmptyDetector[SampleRun],
595595
position_noise: PositionNoise,
596596
replicas: PositionNoiseReplicaCount,
597597
) -> CalibratedPositionWithNoisyReplicas:

src/ess/reduce/nexus/types.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,23 @@ class MonitorPositionOffset(
199199
"""Offset for the monitor position, added to base position."""
200200

201201

202-
class CalibratedDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
203-
"""Calibrated data from a detector."""
202+
class EmptyDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
203+
"""Detector without neutron data."""
204204

205205

206206
class CalibratedBeamline(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
207207
"""Calibrated beamline with detector and other components."""
208208

209209

210-
class CalibratedMonitor(
211-
sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray
212-
):
213-
"""Calibrated data from a monitor."""
210+
class EmptyMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
211+
"""Monitor without neutron data."""
214212

215213

216-
class DetectorData(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
214+
class RawDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
217215
"""Calibrated detector merged with neutron event or histogram data."""
218216

219217

220-
class MonitorData(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
218+
class RawMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
221219
"""Calibrated monitor merged with neutron event or histogram data."""
222220

223221

src/ess/reduce/nexus/workflow.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@
2121
AllNeXusComponents,
2222
Beamline,
2323
CalibratedBeamline,
24-
CalibratedDetector,
25-
CalibratedMonitor,
2624
Component,
2725
DetectorBankSizes,
28-
DetectorData,
2926
DetectorPositionOffset,
27+
EmptyDetector,
28+
EmptyMonitor,
3029
Filename,
3130
GravityVector,
3231
Measurement,
33-
MonitorData,
3432
MonitorPositionOffset,
3533
MonitorType,
3634
NeXusAllComponentLocationSpec,
@@ -46,6 +44,8 @@
4644
Position,
4745
PreopenNeXusFile,
4846
RawChoppers,
47+
RawDetector,
48+
RawMonitor,
4949
RunType,
5050
TimeInterval,
5151
UniqueComponent,
@@ -360,7 +360,7 @@ def get_calibrated_detector(
360360
# all.
361361
offset: DetectorPositionOffset[RunType],
362362
bank_sizes: DetectorBankSizes,
363-
) -> CalibratedDetector[RunType]:
363+
) -> EmptyDetector[RunType]:
364364
"""
365365
Extract the data array corresponding to a detector's signal field.
366366
@@ -395,13 +395,13 @@ def get_calibrated_detector(
395395
else:
396396
transform_value = transform.value
397397
position = transform_value * offsets
398-
return CalibratedDetector[RunType](
398+
return EmptyDetector[RunType](
399399
da.assign_coords(position=position + offset.to(unit=position.unit))
400400
)
401401

402402

403403
def assemble_beamline(
404-
detector: CalibratedDetector[RunType],
404+
detector: EmptyDetector[RunType],
405405
source_position: Position[snx.NXsource, RunType],
406406
sample_position: Position[snx.NXsample, RunType],
407407
gravity: GravityVector,
@@ -438,7 +438,7 @@ def assemble_beamline(
438438
def assemble_detector_data(
439439
detector: CalibratedBeamline[RunType],
440440
event_data: NeXusData[snx.NXdetector, RunType],
441-
) -> DetectorData[RunType]:
441+
) -> RawDetector[RunType]:
442442
"""
443443
Assemble a detector data array with event data.
444444
@@ -454,7 +454,7 @@ def assemble_detector_data(
454454
grouped = nexus.group_event_data(
455455
event_data=event_data, detector_number=detector.coords['detector_number']
456456
)
457-
return DetectorData[RunType](
457+
return RawDetector[RunType](
458458
_add_variances(grouped)
459459
.assign_coords(detector.coords)
460460
.assign_masks(detector.masks)
@@ -465,7 +465,7 @@ def get_calibrated_monitor(
465465
monitor: NeXusComponent[MonitorType, RunType],
466466
offset: MonitorPositionOffset[RunType, MonitorType],
467467
source_position: Position[snx.NXsource, RunType],
468-
) -> CalibratedMonitor[RunType, MonitorType]:
468+
) -> EmptyMonitor[RunType, MonitorType]:
469469
"""
470470
Extract the data array corresponding to a monitor's signal field.
471471
@@ -482,7 +482,7 @@ def get_calibrated_monitor(
482482
Position of the neutron source.
483483
"""
484484
monitor = nexus.compute_component_position(monitor)
485-
return CalibratedMonitor[RunType, MonitorType](
485+
return EmptyMonitor[RunType, MonitorType](
486486
nexus.extract_signal_data_array(monitor).assign_coords(
487487
position=monitor['position'] + offset.to(unit=monitor['position'].unit),
488488
source_position=source_position,
@@ -491,9 +491,9 @@ def get_calibrated_monitor(
491491

492492

493493
def assemble_monitor_data(
494-
monitor: CalibratedMonitor[RunType, MonitorType],
494+
monitor: EmptyMonitor[RunType, MonitorType],
495495
data: NeXusData[MonitorType, RunType],
496-
) -> MonitorData[RunType, MonitorType]:
496+
) -> RawMonitor[RunType, MonitorType]:
497497
"""
498498
Assemble a monitor data array with event data.
499499
@@ -507,7 +507,7 @@ def assemble_monitor_data(
507507
Data array with neutron counts.
508508
"""
509509
da = data.assign_coords(monitor.coords).assign_masks(monitor.masks)
510-
return MonitorData[RunType, MonitorType](_add_variances(da))
510+
return RawMonitor[RunType, MonitorType](_add_variances(da))
511511

512512

513513
def parse_disk_choppers(

src/ess/reduce/time_of_flight/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,23 @@
2424
)
2525
from .types import (
2626
DetectorLtotal,
27-
DetectorTofData,
2827
MonitorLtotal,
29-
MonitorTofData,
3028
PulseStrideOffset,
3129
TimeOfFlightLookupTable,
3230
TimeOfFlightLookupTableFilename,
31+
TofDetector,
32+
TofMonitor,
3333
)
3434
from .workflow import GenericTofWorkflow
3535

3636
__all__ = [
3737
"DetectorLtotal",
38-
"DetectorTofData",
3938
"DiskChoppers",
4039
"DistanceResolution",
4140
"GenericTofWorkflow",
4241
"LookupTableRelativeErrorThreshold",
4342
"LtotalRange",
4443
"MonitorLtotal",
45-
"MonitorTofData",
4644
"NumberOfSimulatedNeutrons",
4745
"PulsePeriod",
4846
"PulseStride",
@@ -53,7 +51,9 @@
5351
"TimeOfFlightLookupTable",
5452
"TimeOfFlightLookupTableFilename",
5553
"TimeResolution",
54+
"TofDetector",
5655
"TofLookupTableWorkflow",
56+
"TofMonitor",
5757
"providers",
5858
"simulate_chopper_cascade_using_tof",
5959
]

src/ess/reduce/time_of_flight/eto_to_tof.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121

2222
from ..nexus.types import (
2323
CalibratedBeamline,
24-
CalibratedMonitor,
25-
DetectorData,
26-
MonitorData,
24+
EmptyMonitor,
2725
MonitorType,
26+
RawDetector,
27+
RawMonitor,
2828
RunType,
2929
)
3030
from .resample import rebin_strictly_increasing
3131
from .types import (
3232
DetectorLtotal,
33-
DetectorTofData,
3433
MonitorLtotal,
35-
MonitorTofData,
3634
PulseStrideOffset,
3735
TimeOfFlightLookupTable,
36+
TofDetector,
37+
TofMonitor,
3838
)
3939

4040

@@ -294,7 +294,7 @@ def detector_ltotal_from_straight_line_approximation(
294294

295295

296296
def monitor_ltotal_from_straight_line_approximation(
297-
monitor_beamline: CalibratedMonitor[RunType, MonitorType],
297+
monitor_beamline: EmptyMonitor[RunType, MonitorType],
298298
) -> MonitorLtotal[RunType, MonitorType]:
299299
"""
300300
Compute Ltotal for the monitor.
@@ -334,11 +334,11 @@ def _compute_tof_data(
334334

335335

336336
def detector_time_of_flight_data(
337-
detector_data: DetectorData[RunType],
337+
detector_data: RawDetector[RunType],
338338
lookup: TimeOfFlightLookupTable,
339339
ltotal: DetectorLtotal[RunType],
340340
pulse_stride_offset: PulseStrideOffset,
341-
) -> DetectorTofData[RunType]:
341+
) -> TofDetector[RunType]:
342342
"""
343343
Convert the time-of-arrival data to time-of-flight data using a lookup table.
344344
The output data will have a time-of-flight coordinate.
@@ -357,7 +357,7 @@ def detector_time_of_flight_data(
357357
When pulse-skipping, the offset of the first pulse in the stride. This is
358358
typically zero but can be a small integer < pulse_stride.
359359
"""
360-
return DetectorTofData[RunType](
360+
return TofDetector[RunType](
361361
_compute_tof_data(
362362
da=detector_data,
363363
lookup=lookup,
@@ -368,11 +368,11 @@ def detector_time_of_flight_data(
368368

369369

370370
def monitor_time_of_flight_data(
371-
monitor_data: MonitorData[RunType, MonitorType],
371+
monitor_data: RawMonitor[RunType, MonitorType],
372372
lookup: TimeOfFlightLookupTable,
373373
ltotal: MonitorLtotal[RunType, MonitorType],
374374
pulse_stride_offset: PulseStrideOffset,
375-
) -> MonitorTofData[RunType, MonitorType]:
375+
) -> TofMonitor[RunType, MonitorType]:
376376
"""
377377
Convert the time-of-arrival data to time-of-flight data using a lookup table.
378378
The output data will have a time-of-flight coordinate.
@@ -391,7 +391,7 @@ def monitor_time_of_flight_data(
391391
When pulse-skipping, the offset of the first pulse in the stride. This is
392392
typically zero but can be a small integer < pulse_stride.
393393
"""
394-
return MonitorTofData[RunType, MonitorType](
394+
return TofMonitor[RunType, MonitorType](
395395
_compute_tof_data(
396396
da=monitor_data,
397397
lookup=lookup,

src/ess/reduce/time_of_flight/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class MonitorLtotal(sl.Scope[RunType, MonitorType, sc.Variable], sc.Variable):
3333
"""Total path length of neutrons from source to monitor."""
3434

3535

36-
class DetectorTofData(sl.Scope[RunType, sc.DataArray], sc.DataArray):
36+
class TofDetector(sl.Scope[RunType, sc.DataArray], sc.DataArray):
3737
"""Detector data with time-of-flight coordinate."""
3838

3939

40-
class MonitorTofData(sl.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
40+
class TofMonitor(sl.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
4141
"""Monitor data with time-of-flight coordinate."""

0 commit comments

Comments
 (0)