Ticket #9547 (assigned)
Allow Tube Calibration File for Each Bank
Reported by: | Peter Parker | Owned by: | Peter Parker |
---|---|---|---|
Priority: | major | Milestone: | Backlog |
Component: | SANS | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: |
Description
The TUBECALIBFILE command in User Files can be used to specify a calibration file for the SANS2D instrument. Currently, this is set up so that only one file can be specified.
Unfortunately, each bank in SANS2D will have it's own calibration file, and so we need some way to specify two files, and then merge the detector positions of one bank into a workspace containing the detectors positions of the other.
I'm not yet sure how we should change the command to accommodate this. Maybe TUBECALIBFILE/REAR and TUBECALIBFILE/FRONT is the best way, but I'd like to try and make things as generic as possible.
Meanwhile, I provided a script to Richard so that he can merge the files manually so that he only has to specify one file. It may come in useful when implementing this ticket:
# Files in \\isis\inst$\Instruments$\NDXSANS2D\user\Masks: rear_calib_file = "TubeCalibrationTable_512pixel_23563rear_29May14.nxs" front_calib_file = "TubeCalibrationTable_512pixel_23610front_28May14.nxs" rear_calib = Load(rear_calib_file) front_calib = Load(front_calib_file) det_id_list = [] for ws_index in range(rear_calib.getNumberHistograms()): spectrum = rear_calib.getSpectrum(ws_index) if spectrum.getSpectrumNo() < 0: continue for det_id in spectrum.getDetectorIDs(): if det_id > 2523511: continue det_id_list.append(det_id) rear_inst = rear_calib.getInstrument() # Creating an unmanaged version of the algorithm is important here. Otherwise, # things get really slow, and the workspace history becomes unmanageable. move = AlgorithmManager.createUnmanaged('MoveInstrumentComponent') move.initialize() move.setChild(True) move.setProperty("Workspace", "front_calib") move.setProperty("RelativePosition", False) for det_id in det_id_list: det = rear_inst.getDetector(det_id) if "rear-detector" in det.getFullName(): move.setProperty("DetectorID", det_id) move.setProperty("X", det.getPos().getX()) move.setProperty("Y", det.getPos().getY()) move.setProperty("Z", det.getPos().getZ()) move.setProperty("DetectorID", det_id) move.execute() RenameWorkspace(InputWorkspace="front_calib", OutputWorkspace="merged") DeleteWorkspace(Workspace="rear_calib")