The python class TubeSpec provides a way of specifying a set of tubes for calibration, so that the necessary information about detectors etc. is forthcoming. This class is provide by the python file tube_spec.py. The function getCalibration of Tube Calib needs such an object.
The construct TubeSpec takes one argument, which is a workspace that contains the instrument with tubes to be selected.
The function takes one argument tubeSpecString and it is a string specifying the whole instrument or a component of the instrument containing the tubes you wish to calibrate.
It may be the full path name for the component or steps may be missed out provided it remains unique.
For example panel03 of WISH can be specified by just panel03, because panel03 is unique within the instrument. Also tube012 of this panel, which is unique within the panel but not within the instrument can be specified by panel03/tube012 but not tube012. If the specification is not unique, the first found will be used and there will be no error message. So if in doubt don’t skip a step.
This function allows you to calibrate a set of tubes that is not defined by a single component. For example a set of windows. It takes an array of strings as its argument. Each string specifies a component such as a window or a single tube in the same manner as for setTubeSpecByString. The components must be disjoint.
There are some functions useful for getting information about a tube specification. It is not necessary to call them in a calibration script, but they may be useful for checking the specification.
getNumTubes tells you the number of tubes in the specification.
getDetectorInfoFromTube returns information about detectors in the (N+1)st tube in the specification, where N is the argument. Three integers are returned:
getTubeLength returns the length of the (N+1)st tube in the specification in meters, where N is the argument.
getTubeName returns the name of the (N+1)st tube in the specification, where N is the argument.
getTubeByString returns a list of workspace indices for the (N+1)st tube in the specification, where N is the argument. The name of this function needs updating. This list is inside tube calib.
Tubes are currently ordered in the specification in the same order as they appear in the IDF. This may differ from the order they appear in the workspace indices.