Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
Workspace | Input | Workspace | Mandatory | Input workspace |
UpstreamSpectra | Output | int list | ||
UpstreamDetectorDistances | Output | dbl list | ||
DownstreamSpectra | Output | int 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:",type(upIDs)
print "Number of upDistances:",upDistances.shape[0]
#Downstream detectors
print "First few values of downIDs: ", downIDs[0:5]
print "First few values of downDistances: ", downDistances[0], downDistances[1], downDistances[2], downDistances[3],downDistances[4]
Output:
Type of upID: <type 'numpy.ndarray'>
Number of upDistances: 0
First few values of downIDs: [ 0 1 10 11 2]
First few values of downDistances: 5.0 5.0000064 5.0000064 5.00001279998 5.00002559993
Categories: Algorithms | PythonAlgorithms | Utility
Python: SortDetectors.py