From 909937c8a554faceaf3e76ce7a45642811c04d8a Mon Sep 17 00:00:00 2001 From: Wenduo Zhou Date: Wed, 29 Apr 2015 17:33:45 -0400 Subject: [PATCH] Fixed some issues and added doc. Refs #11289. --- .../source/interfaces/HFIRPowderReduction.rst | 148 ++++++++++++++++++ .../HfirPDReductionControl.py | 5 - .../HFIRPowderReduction/HfirPDReductionGUI.py | 8 +- 3 files changed, 151 insertions(+), 10 deletions(-) create mode 100644 Code/Mantid/docs/source/interfaces/HFIRPowderReduction.rst diff --git a/Code/Mantid/docs/source/interfaces/HFIRPowderReduction.rst b/Code/Mantid/docs/source/interfaces/HFIRPowderReduction.rst new file mode 100644 index 000000000000..e8fb684a2d60 --- /dev/null +++ b/Code/Mantid/docs/source/interfaces/HFIRPowderReduction.rst @@ -0,0 +1,148 @@ +HFIR Powder Reduction Interface +=============================== + +.. contents:: Table of Contents + :local: + +Overview +-------- + +HFIR powder reduction interface (HFIR-PDR-GUI) is a GUI to download, view and reduce data from HFIR's powder diffractometers +in SPICE format. + + +Use cases for tabs +------------------ + + 1. **Raw Detectors**: Visualize the reading of detectors directly coming out of the raw data + * Plot N lines for N Pts.; + * Highlight (make it thicker) the Pt that is interested; + * New from Mantid: *ReadRawSpiceSignal(Pts)*; + 2. **Individual Detector**: Visual the readings of one detector across an experiment + * Plot the counts of any individual detector; + * Able to change the X-axis from 2theta to arbitrary sample environment log; + * New from Mantid: *ReadRawSpiceSignal(DetectorID, XLabel)*; + 3. **Normalized**: Reduce one scan each time + * Plot the reduced data + * Automatically locate detector efficiency file + * New from Mantid: *ConvertCWPDMDToSpectra(ExcludedDetectors=[])* + * New from Mantid: *ConvertSpiceDataToRealSpace(DetectorEfficiencyTable)* + 4. **Multiple Scans**: Reduce a set of scans + * Reduce a set of scans and plot in 2D/water-fall mode; + * Able to merge all the scans; + * New from Mantid: *ConvertCWPDMDToSpectra(ExcludedDetectors=[])* + 5. **Vanadium**: strip vanadium peaks + * Strip vanadium peak with unit 'Degrees' because of the binning (range and step size) must be respected; + * Peaks' position should be calculated and indicated auotmatically; + * *Mantid::StripPeaks()* will be called instread of *StripVadadiumPeaks()* because + the later one only works in d-spacing; + 6. **Advanced Setup** + * URL for raw data files; + + +Workflow for *Normalization* +============================ + +Here is a typical use case for reduce data via tab *Noramlization* + + 1. User specifies *Exp No* and *Scan No* and push button *Load*; + * HFIR-PDR-GUI loads SPICE data according to experiment number and scan number; + * HFIR-PDR-GUI checks whether vanadium correction file, i.e., detector efficiency file exists on server; + * HFIR-PDR-GUI checks whether excluded detectors file exists on server; + * HFIR-PDR-GUI checks log **m1** for wavelength and set to *Wavelength* ; + 2. User may specify detector efficient file; + 3. User specifies *Bin Size*; + 4. User pushes button *2Theta*, *dSpacng*, or *Q*; + * HFIR-PDF-GUI reduce data in unit of *2theta* by taking accounting of + - Detector efficiency; + - Excluded detectors; + 5. HFIR-PDR-GUI plots the reduced data; + 6. User may rebin by different binning parameters or unit; + 7. User may push button *Next Scan* or *Prev Scan* to load and reduce other scans with current setup; + 8. User may save the result by pushing button *Save*; + + +Workflow for *Raw Detectors* +============================ + +Here is a typical use case for reduce data via tab *Noramlization* + + 1. User specifies *Exp No* and *Scan No* and push button *Load*; + * HFIR-PDR-GUI loads SPICE data according to experiment number and scan number; + * HFIR-PDR-GUI checks whether vanadium correction file, i.e., detector efficiency file exists on server; + * HFIR-PDR-GUI checks whether excluded detectors file exists on server; + * HFIR-PDR-GUI checks log **m1** for wavelength and set to *Wavelength* ; + 2. User specifies a *Pt.* number and push button *Plot Raw Detector*; + * HFIR-PDF-GUI plots the raw detector counts normalized by monitor count; + 3. User may push button *Previous Pt.* or *Next Pt.* for the other experiment points; + + + +Workflow for *Multiple Scans* +======================================= + +It might be confusing to use the functionalities in tab *Multiple Scans*. +Here is the suggested workflow to reduce multiple scans and possibly merge them. + + 1. Set up *Exp No* and range of scan numbers; + 2. Push button *Load All* to load and reduce all runs specified in previous step to single-spectrum diffraction pattern; + 3. Waterfall plot all reduced scans in default; + 4. Optinally plot all data in 2D fill plot; + 5. User can delete some scans from the reduced scans via GUI or input text edit; + 6. Push button *Merge* to merge the scans; + 7. Push button *Save All* to save all individual scans to files; + 8. Push button *Save Merged* to save the merged scans to one file; + + +HB2A Data Reduction +------------------- + +Raw experimental data are to be corrected by (1) detector efficiency, (2) vanadium spectrum and etc. +Experiments are done with neutrons with various wavelengthes. +There information can be retrieved from HB2A's data repository accessible from internet. + +Experiment setup and sample log +=============================== + + 1. **Wavelength**: There are three settings for neutron wavelength, referenced by sample log *m1*. + * Ge 113: :math:`\lambda = 2.41 \AA`, m1 = 9.45 (The **error** can be 0.05, such that in Exp 231 scan0001, m1=9.5) + * Ge 115: :math:`\lambda = 1.54 \AA`, m1 = 0 + * Ge 117 :math:`\lambda = 1.12 \AA`, No used + + 2. **Collimator translation**: There are two status for collimator, which is specified by sample log *colltrans* + * *IN*: colltrans = 0 + * *OUT*: colltrans = +/-80 + + +Raw data correction files +========================= + + 1. **Detector efficiency**: + * File name: *HB2A_exp0IJK__GE_abc_XY_vcorr.txt* where + - IJK is the experiment number + - abc is the GE set up. It can be 113, 115 or 117 + - XY is either IN or OUT. + - Exmaple: *HB2A_exp0400__Ge_113_IN_vcorr.txt* + * Web address: *http://neutron.ornl.gov/user_data/hb2a/exp400/Datafiles/HB2A_exp0IJK__Ge_abc_IN_vcorr.txt* + - IJK is the experiment number + - abc is the GE set up. It can be 113, 115 or 117 + - XY is either IN or OUT. + - Exmaple: *http://neutron.ornl.gov/user_data/hb2a/exp400/Datafiles/HB2A_exp0400__Ge_113_IN_vcorr.txt* + + 2. **Excluded detectors**: Some detectors might be exluded from the experiment for some reason. It is recorded in some excluded detectors' file. + * File name: *HB2A_exp0IJK__exclude_detectors.txt* + - IJK is the epxeriment number + - Exmaple: *HB2A_exp0400__exclude_detectors.txt* + * Web address: *http://neutron.ornl.gov/user_data/hb2a/expIJK/Datafiles/HB2A_exp0IJK__exclude_detectors.txt* + - IJK is the experiment number + - Example: *http://neutron.ornl.gov/user_data/hb2a/exp400/Datafiles/HB2A_exp0400__exclude_detectors.txt* + + 3. Detector gaps: The 2-theta gap (in unit degrees) can be changed among cycles. + * Location example: *http://neutron.ornl.gov/user_data/hb2a/exp400/Datafiles/HB2A_exp0400__gaps.txt* + + +Limitation +---------- + +* HFIR powder reduction GUI supports for instrument HB2A only in release 3.4.0; + diff --git a/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionControl.py b/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionControl.py index f2e4491b6bc2..88226ad34a11 100644 --- a/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionControl.py +++ b/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionControl.py @@ -339,11 +339,6 @@ def getSampleLogValue(self, expno, scanno, samplelogname, xlabel): exp = int(expno) scan = int(scanno) - # FUTURE: Fix this! Should be applied to all sample logs - if xlabel != 'Pt.': - xlabel = 'Pt.' - self._logNotice('XLabel supports Pt. only. More tests are required to support other log.') - if self._myWorkspaceDict.has_key((exp, scan)) is False: raise NotImplementedError("Exp %d Scan %d does not have reduced \ workspace." % (exp, scan)) diff --git a/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionGUI.py b/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionGUI.py index 7a8ea5058d22..c2b6b769d29a 100644 --- a/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionGUI.py +++ b/Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionGUI.py @@ -483,8 +483,8 @@ def doLoadData(self, exp=None, scan=None): else: # read from GUI try: - self._logDebug("Attending to load Exp %d Scan %d." % (expno, scanno)) expno, scanno = self._uiGetExpScanNumber() + self._logDebug("Attending to load Exp %d Scan %d." % (expno, scanno)) except NotImplementedError as ne: self._logError("Error to get Exp and Scan due to %s." % (str(ne))) return @@ -1695,7 +1695,6 @@ def _plotSampleLog(self, expno, scanno, samplelogname): return False # Canvas and line information - self._indvDetCanvasMode = 'samplelog' # pop out the xlabel list @@ -1704,8 +1703,7 @@ def _plotSampleLog(self, expno, scanno, samplelogname): self.ui.comboBox_indvDetXLabel.clear() self.ui.comboBox_indvDetXLabel.addItems(floatsamplelognamelist) - # FUTURE: xlabel can be other sample log - xlabel='Pt' + xlabel=str(self.ui.comboBox_indvDetXLabel.currentText()) # get data vecx, vecy = self._myControl.getSampleLogValue(expno, scanno, samplelogname, xlabel) @@ -2028,7 +2026,7 @@ def _uiReduceData(self, itab, unit, expno=None, scanno=None): wavelength = float(self._myControl.getWavelength(expno, scanno)) else: wavelength = float(str(self.ui.lineEdit_wavelength.text())) - except ValueError: + except TypeError: if unit != '2theta': raise NotImplementedError('Wavelength must be specified for unit %s.'%(unit))