essreduce 25.4.1__py3-none-any.whl → 25.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ess/reduce/nexus/types.py CHANGED
@@ -341,10 +341,3 @@ class Choppers(
341
341
  sc.DataGroup[sc.DataGroup[Any]],
342
342
  ):
343
343
  """All choppers in a NeXus file."""
344
-
345
-
346
- class Analyzers(
347
- sciline.Scope[RunType, sc.DataGroup[sc.DataGroup[Any]]],
348
- sc.DataGroup[sc.DataGroup[Any]],
349
- ):
350
- """All analyzers in a NeXus file."""
@@ -15,10 +15,10 @@ from scipp.constants import g
15
15
  from scipp.core import label_based_index_to_positional_index
16
16
  from scippneutron.chopper import extract_chopper_from_nexus
17
17
 
18
+ from ..utils import prune_type_vars
18
19
  from . import _nexus_loader as nexus
19
20
  from .types import (
20
21
  AllNeXusComponents,
21
- Analyzers,
22
22
  Beamline,
23
23
  CalibratedBeamline,
24
24
  CalibratedDetector,
@@ -524,13 +524,6 @@ def parse_disk_choppers(
524
524
  )
525
525
 
526
526
 
527
- def parse_analyzers(
528
- analyzers: AllNeXusComponents[snx.NXcrystal, RunType],
529
- ) -> Analyzers[RunType]:
530
- """Convert the NeXus representation of an analyzer to ours."""
531
- return Analyzers[RunType](analyzers.apply(nexus.compute_component_position))
532
-
533
-
534
527
  def _drop(
535
528
  children: dict[str, snx.Field | snx.Group], classes: tuple[snx.NXobject, ...]
536
529
  ) -> dict[str, snx.Field | snx.Group]:
@@ -627,7 +620,6 @@ _common_providers = (
627
620
  nx_class_for_source,
628
621
  nx_class_for_sample,
629
622
  nx_class_for_disk_chopper,
630
- nx_class_for_crystal,
631
623
  )
632
624
 
633
625
  _monitor_providers = (
@@ -646,8 +638,6 @@ _detector_providers = (
646
638
 
647
639
  _chopper_providers = (parse_disk_choppers,)
648
640
 
649
- _analyzer_providers = (parse_analyzers,)
650
-
651
641
  _metadata_providers = (
652
642
  load_beamline_metadata_from_nexus,
653
643
  load_measurement_metadata_from_nexus,
@@ -710,7 +700,6 @@ def GenericNeXusWorkflow(
710
700
  *_monitor_providers,
711
701
  *_detector_providers,
712
702
  *_chopper_providers,
713
- *_analyzer_providers,
714
703
  *_metadata_providers,
715
704
  )
716
705
  )
@@ -718,33 +707,6 @@ def GenericNeXusWorkflow(
718
707
  wf[PreopenNeXusFile] = PreopenNeXusFile(False)
719
708
 
720
709
  if run_types is not None or monitor_types is not None:
721
- _prune_type_vars(wf, run_types=run_types, monitor_types=monitor_types)
710
+ prune_type_vars(wf, run_types=run_types, monitor_types=monitor_types)
722
711
 
723
712
  return wf
724
-
725
-
726
- def _prune_type_vars(
727
- workflow: sciline.Pipeline,
728
- *,
729
- run_types: Iterable[sciline.typing.Key] | None,
730
- monitor_types: Iterable[sciline.typing.Key] | None,
731
- ) -> None:
732
- # Remove all nodes that use a run type or monitor types that is
733
- # not listed in the function arguments.
734
- excluded_run_types = _excluded_type_args(RunType, run_types)
735
- excluded_monitor_types = _excluded_type_args(MonitorType, monitor_types)
736
- excluded_types = excluded_run_types | excluded_monitor_types
737
-
738
- graph = workflow.underlying_graph
739
- to_remove = [
740
- node for node in graph if excluded_types & set(getattr(node, "__args__", set()))
741
- ]
742
- graph.remove_nodes_from(to_remove)
743
-
744
-
745
- def _excluded_type_args(
746
- type_var: Any, keep: Iterable[sciline.typing.Key] | None
747
- ) -> set[sciline.typing.Key]:
748
- if keep is None:
749
- return set()
750
- return set(type_var.__constraints__) - set(keep)
@@ -6,42 +6,57 @@ Utilities for computing real neutron time-of-flight from chopper settings and
6
6
  neutron time-of-arrival at the detectors.
7
7
  """
8
8
 
9
- from .eto_to_tof import default_parameters, providers, resample_tof_data
9
+ from .eto_to_tof import (
10
+ default_parameters,
11
+ providers,
12
+ resample_detector_time_of_flight_data,
13
+ resample_monitor_time_of_flight_data,
14
+ )
10
15
  from .simulation import simulate_beamline
11
16
  from .to_events import to_events
12
17
  from .types import (
18
+ DetectorLtotal,
19
+ DetectorTofData,
13
20
  DistanceResolution,
14
21
  LookupTableRelativeErrorThreshold,
15
- Ltotal,
16
22
  LtotalRange,
23
+ MonitorLtotal,
24
+ MonitorTofData,
17
25
  PulsePeriod,
18
26
  PulseStride,
19
27
  PulseStrideOffset,
20
- RawData,
21
- ResampledTofData,
28
+ ResampledDetectorTofData,
29
+ ResampledMonitorTofData,
22
30
  SimulationResults,
23
31
  TimeOfFlightLookupTable,
32
+ TimeOfFlightLookupTableFilename,
24
33
  TimeResolution,
25
- TofData,
26
34
  )
35
+ from .workflow import GenericTofWorkflow, TofLutProvider
27
36
 
28
37
  __all__ = [
38
+ "DetectorLtotal",
39
+ "DetectorTofData",
29
40
  "DistanceResolution",
41
+ "GenericTofWorkflow",
30
42
  "LookupTableRelativeErrorThreshold",
31
- "Ltotal",
32
43
  "LtotalRange",
44
+ "MonitorLtotal",
45
+ "MonitorTofData",
33
46
  "PulsePeriod",
34
47
  "PulseStride",
35
48
  "PulseStrideOffset",
36
- "RawData",
37
- "ResampledTofData",
49
+ "ResampledDetectorTofData",
50
+ "ResampledMonitorTofData",
38
51
  "SimulationResults",
39
52
  "TimeOfFlightLookupTable",
53
+ "TimeOfFlightLookupTableFilename",
40
54
  "TimeResolution",
41
- "TofData",
55
+ "TofLutProvider",
42
56
  "default_parameters",
43
57
  "providers",
44
- "resample_tof_data",
58
+ "resample_detector_time_of_flight_data",
59
+ "resample_monitor_time_of_flight_data",
45
60
  "simulate_beamline",
46
61
  "to_events",
47
62
  ]