\(\renewcommand\AA{\unicode{x212B}}\)
Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Workspace | Input | Workspace | Mandatory | Input workspace |
UpstreamSpectra | Output | long list | ||
UpstreamDetectorDistances | Output | dbl list | ||
DownstreamSpectra | Output | long list | ||
DownstreamDetectorDistances | Output | dbl list |
Algorithm to sort detectors by distance. Will return arrays for upstream (downstrem) spectrum number and detector distances, ordered by distance.
# create some workspace with an instrument
ws = CreateSampleWorkspace()
upIDs,upDistances,downIDs,downDistances=SortDetectors(ws)
# No upstream detectors
print("Type of upID: {}".format(type(upIDs)))
print("Number of upDistances: {}".format(upDistances.shape[0]))
#Downstream detectors
print("First few values of downIDs: {}".format(downIDs[0:5]))
print("First few values of downDistances: {} {} {} {} {}".format(downDistances[0], downDistances[1], downDistances[2], downDistances[3],downDistances[4]))
Output:
Type of upID: <... 'numpy.ndarray'>
Number of upDistances: 0
First few values of downIDs: [ 0 1 10 11 2]
First few values of downDistances: 5.0 5.000006... 5.000006... 5.00001279... 5.00002559...
Categories: AlgorithmIndex | Utility\Sorting
Python: SortDetectors.py