def _get_default_peaks(self): """ Gets default peaks for Engg algorithms. Values from CeO2 """ import EnggUtils return EnggUtils.default_ceria_expected_peaks()
def PyInit(self): self.declareProperty(MatrixWorkspaceProperty("InputWorkspace", "", Direction.Input), doc="Workspace with the calibration run to use.") import EnggUtils self.declareProperty( FloatArrayProperty("ExpectedPeaks", values=EnggUtils.default_ceria_expected_peaks(), direction=Direction.Input), doc="A list of dSpacing values where peaks are expected.") self.declareProperty( FileProperty(name="ExpectedPeaksFromFile", defaultValue="", action=FileAction.OptionalLoad, extensions=[".csv"]), doc= "Load from file a list of dSpacing values to be translated into TOF to find expected " "peaks. This takes precedence over 'ExpectedPeaks' if both options are given." ) peaks_grp = 'Peaks to fit' self.setPropertyGroup('ExpectedPeaks', peaks_grp) self.setPropertyGroup('ExpectedPeaksFromFile', peaks_grp) self.declareProperty( MatrixWorkspaceProperty("VanadiumWorkspace", "", Direction.Input, PropertyMode.Optional), doc= 'Workspace with the Vanadium (correction and calibration) run. Alternatively, ' 'when the Vanadium run has been already processed, the properties can be used' ) self.declareProperty( ITableWorkspaceProperty("VanIntegrationWorkspace", "", Direction.Input, PropertyMode.Optional), doc= 'Results of integrating the spectra of a Vanadium run, with one column ' '(integration result) and one row per spectrum. This can be used in ' 'combination with OutVanadiumCurveFits from a previous execution and ' 'VanadiumWorkspace to provide pre-calculated values for Vanadium correction.' ) self.declareProperty( MatrixWorkspaceProperty('VanCurvesWorkspace', '', Direction.Input, PropertyMode.Optional), doc= 'A workspace2D with the fitting workspaces corresponding to the instrument banks. ' 'This workspace has three spectra per bank, as produced by the algorithm Fit. ' 'This is meant to be used as an alternative input VanadiumWorkspace for testing and ' 'performance reasons. If not given, no workspace is generated.') vana_grp = 'Vanadium (open beam) properties' self.setPropertyGroup('VanadiumWorkspace', vana_grp) self.setPropertyGroup('VanIntegrationWorkspace', vana_grp) self.setPropertyGroup('VanCurvesWorkspace', vana_grp) self.declareProperty( "Bank", '', StringListValidator(EnggUtils.ENGINX_BANKS), direction=Direction.Input, doc="Which bank to calibrate. It can be specified as 1 or 2, or " "equivalently, North or South. See also " + self.INDICES_PROP_NAME + " " "for a more flexible alternative to select specific detectors") self.declareProperty( self.INDICES_PROP_NAME, '', direction=Direction.Input, doc='Sets the spectrum numbers for the detectors ' 'that should be considered in the calibration (all others will be ' 'ignored). This option cannot be used together with Bank, as they overlap. ' 'You can give multiple ranges, for example: "0-99", or "0-9, 50-59, 100-109".' ) banks_grp = 'Banks / spectra' self.setPropertyGroup('Bank', banks_grp) self.setPropertyGroup(self.INDICES_PROP_NAME, banks_grp) self.declareProperty( ITableWorkspaceProperty("DetectorPositions", "", Direction.Input, PropertyMode.Optional), "Calibrated detector positions. If not specified, default ones (from the " "current instrument definition) are used.") self.declareProperty( 'OutputParametersTableName', '', direction=Direction.Input, doc= 'Name for a table workspace with the calibration parameters calculated ' 'from this algorithm: difc and zero parameters for GSAS. these two parameters ' 'are added as two columns in a single row. If not given, no table is ' 'generated.') self.declareProperty( "DIFA", 0.0, direction=Direction.Output, doc= "Calibration parameter DIFA for the bank or range of pixels/detectors given" ) self.declareProperty( "DIFC", 0.0, direction=Direction.Output, doc= "Calibration parameter DIFC for the bank or range of pixels/detectors given" ) self.declareProperty( "TZERO", 0.0, direction=Direction.Output, doc= "Calibration parameter TZERO for the bank or range of pixels/detectors given" ) self.declareProperty( ITableWorkspaceProperty("FittedPeaks", "", Direction.Output), doc= "Information on fitted peaks as produced by the (child) algorithm EnggFitPeaks." ) out_grp = 'Outputs' self.setPropertyGroup('DetectorPositions', out_grp) self.setPropertyGroup('OutputParametersTableName', out_grp) self.setPropertyGroup('DIFA', out_grp) self.setPropertyGroup('DIFC', out_grp) self.setPropertyGroup('TZERO', out_grp) self.setPropertyGroup('FittedPeaks', out_grp)
def PyInit(self): self.declareProperty( MatrixWorkspaceProperty("InputWorkspace", "", Direction.Input), doc="Workspace with the calibration run to use.", ) import EnggUtils self.declareProperty( FloatArrayProperty( "ExpectedPeaks", values=EnggUtils.default_ceria_expected_peaks(), direction=Direction.Input ), doc="A list of dSpacing values where peaks are expected.", ) self.declareProperty( FileProperty( name="ExpectedPeaksFromFile", defaultValue="", action=FileAction.OptionalLoad, extensions=[".csv"] ), doc="Load from file a list of dSpacing values to be translated into TOF to " "find expected peaks. This takes precedence over 'ExpectedPeaks' if both " "options are given.", ) peaks_grp = "Peaks to fit" self.setPropertyGroup("ExpectedPeaks", peaks_grp) self.setPropertyGroup("ExpectedPeaksFromFile", peaks_grp) self.declareProperty( MatrixWorkspaceProperty("VanadiumWorkspace", "", Direction.Input, PropertyMode.Optional), doc="Workspace with the Vanadium (correction and calibration) run. " "Alternatively, when the Vanadium run has been already processed, " "the properties can be used", ) self.declareProperty( ITableWorkspaceProperty("VanIntegrationWorkspace", "", Direction.Input, PropertyMode.Optional), doc="Results of integrating the spectra of a Vanadium run, with one column " "(integration result) and one row per spectrum. This can be used in " "combination with OutVanadiumCurveFits from a previous execution and " "VanadiumWorkspace to provide pre-calculated values for Vanadium correction.", ) self.declareProperty( MatrixWorkspaceProperty("VanCurvesWorkspace", "", Direction.Input, PropertyMode.Optional), doc="A workspace2D with the fitting workspaces corresponding to " "the instrument banks. This workspace has three spectra per bank, as produced " "by the algorithm Fit. This is meant to be used as an alternative input " "VanadiumWorkspace for testing and performance reasons. If not given, no " "workspace is generated.", ) vana_grp = "Vanadium (open beam) properties" self.setPropertyGroup("VanadiumWorkspace", vana_grp) self.setPropertyGroup("VanIntegrationWorkspace", vana_grp) self.setPropertyGroup("VanCurvesWorkspace", vana_grp) self.declareProperty( "Bank", "", StringListValidator(EnggUtils.ENGINX_BANKS), direction=Direction.Input, doc="Which bank to calibrate. It can be specified as 1 or 2, or " "equivalently, North or South. See also " + self.INDICES_PROP_NAME + " " "for a more flexible alternative to select specific detectors", ) self.declareProperty( self.INDICES_PROP_NAME, "", direction=Direction.Input, doc="Sets the spectrum numbers for the detectors " "that should be considered in the calibration (all others will be " "ignored). This option cannot be used together with Bank, as they overlap. " 'You can give multiple ranges, for example: "0-99", or "0-9, 50-59, 100-109".', ) banks_grp = "Banks / spectra" self.setPropertyGroup("Bank", banks_grp) self.setPropertyGroup(self.INDICES_PROP_NAME, banks_grp) self.declareProperty( ITableWorkspaceProperty("DetectorPositions", "", Direction.Input, PropertyMode.Optional), "Calibrated detector positions. If not specified, default ones (from the " "current instrument definition) are used.", ) self.declareProperty( "OutputParametersTableName", "", direction=Direction.Input, doc="Name for a table workspace with the calibration parameters calculated " "from this algorithm: difc and zero parameters for GSAS. these two parameters " "are added as two columns in a single row. If not given, no table is " "generated.", ) self.declareProperty( "Difc", 0.0, direction=Direction.Output, doc="Calibrated Difc value for the bank or range of pixels/detectors given", ) self.declareProperty( "Zero", 0.0, direction=Direction.Output, doc="Calibrated Zero value for the bank or range of pixels/detectors given", ) self.declareProperty( ITableWorkspaceProperty("FittedPeaks", "", Direction.Output), doc="Information on fitted peaks as produced by the (child) algorithm " "EnggFitPeaks.", ) out_grp = "Outputs" self.setPropertyGroup("DetectorPositions", out_grp) self.setPropertyGroup("OutputParametersTableName", out_grp) self.setPropertyGroup("Difc", out_grp) self.setPropertyGroup("Zero", out_grp) self.setPropertyGroup("FittedPeaks", out_grp)
def PyInit(self): self.declareProperty(MatrixWorkspaceProperty("Workspace", "", Direction.InOut), "Workspace with the calibration run to use. The calibration will be applied on it.") self.declareProperty(MatrixWorkspaceProperty("VanadiumWorkspace", "", Direction.Input, PropertyMode.Optional), "Workspace with the Vanadium (correction and calibration) run.") self.declareProperty(ITableWorkspaceProperty('VanIntegrationWorkspace', '', Direction.Input, PropertyMode.Optional), doc = 'Results of integrating the spectra of a Vanadium run, with one column ' '(integration result) and one row per spectrum. This can be used in ' 'combination with OutVanadiumCurveFits from a previous execution and ' 'VanadiumWorkspace to provide pre-calculated values for Vanadium correction.') self.declareProperty(MatrixWorkspaceProperty('VanCurvesWorkspace', '', Direction.Input, PropertyMode.Optional), doc = 'A workspace2D with the fitting workspaces corresponding to ' 'the instrument banks. This workspace has three spectra per bank, as produced ' 'by the algorithm Fit. This is meant to be used as an alternative input ' 'VanadiumWorkspace for testing and performance reasons. If not given, no ' 'workspace is generated.') vana_grp = 'Vanadium (open beam) properties' self.setPropertyGroup('VanadiumWorkspace', vana_grp) self.setPropertyGroup('VanIntegrationWorkspace', vana_grp) self.setPropertyGroup('VanCurvesWorkspace', vana_grp) self.declareProperty(ITableWorkspaceProperty("OutDetPosTable", "", Direction.Output),\ doc="A table with the detector IDs and calibrated detector positions and " "additional calibration information. The table includes: the old positions " "in V3D format (3D vector with x, y, z values), the new positions in V3D, the " "new positions in spherical coordinates, the change in L2, and the DIFC and " "ZERO parameters.") self.declareProperty("Bank", '', StringListValidator(EnggUtils.ENGINX_BANKS), direction=Direction.Input, doc = "Which bank to calibrate: It can be specified as 1 or 2, or " "equivalently, North or South. See also " + self.INDICES_PROP_NAME + " " "for a more flexible alternative to select specific detectors") self.declareProperty(self.INDICES_PROP_NAME, '', direction=Direction.Input, doc = 'Sets the spectrum numbers for the detectors ' 'that should be considered in the calibration (all others will be ' 'ignored). This option cannot be used together with Bank, as they overlap. ' 'You can give multiple ranges, for example: "0-99", or "0-9, 50-59, 100-109".') banks_grp = 'Banks / spectra' self.setPropertyGroup('Bank', banks_grp) self.setPropertyGroup(self.INDICES_PROP_NAME, banks_grp) self.declareProperty(FileProperty("OutDetPosFilename", "", FileAction.OptionalSave, [".csv"]), doc="Name of the file to save the pre-/post-calibrated detector positions - this " "saves the same information that is provided in the output table workspace " "(OutDetPosTable).") opt_outs_grp = 'Optional outputs' self.setPropertyGroup('OutDetPosFilename', opt_outs_grp) self.declareProperty(FloatArrayProperty("ExpectedPeaks", values=EnggUtils.default_ceria_expected_peaks(), direction=Direction.Input), doc="A list of dSpacing values where peaks are expected.") self.declareProperty(FileProperty(name="ExpectedPeaksFromFile",defaultValue="", action=FileAction.OptionalLoad,extensions = [".csv"]), doc="Load from file a list of dSpacing values to be translated into TOF to " "find expected peaks. This takes precedence over 'ExpectedPeaks' if both " "options are given.") peaks_grp = 'Peaks to fit' self.setPropertyGroup('ExpectedPeaks', peaks_grp) self.setPropertyGroup('ExpectedPeaksFromFile', peaks_grp)
def PyInit(self): self.declareProperty(MatrixWorkspaceProperty("Workspace", "", Direction.InOut), "Workspace with the calibration run to use. The calibration will be applied on it.") self.declareProperty(MatrixWorkspaceProperty("VanadiumWorkspace", "", Direction.Input, PropertyMode.Optional), "Workspace with the Vanadium (correction and calibration) run.") self.declareProperty(ITableWorkspaceProperty('VanIntegrationWorkspace', '', Direction.Input, PropertyMode.Optional), doc='Results of integrating the spectra of a Vanadium run, with one column ' '(integration result) and one row per spectrum. This can be used in ' 'combination with OutVanadiumCurveFits from a previous execution and ' 'VanadiumWorkspace to provide pre-calculated values for Vanadium correction.') self.declareProperty(MatrixWorkspaceProperty('VanCurvesWorkspace', '', Direction.Input, PropertyMode.Optional), doc='A workspace2D with the fitting workspaces corresponding to ' 'the instrument banks. This workspace has three spectra per bank, as produced ' 'by the algorithm Fit. This is meant to be used as an alternative input ' 'VanadiumWorkspace for testing and performance reasons. If not given, no ' 'workspace is generated.') vana_grp = 'Vanadium (open beam) properties' self.setPropertyGroup('VanadiumWorkspace', vana_grp) self.setPropertyGroup('VanIntegrationWorkspace', vana_grp) self.setPropertyGroup('VanCurvesWorkspace', vana_grp) self.declareProperty(ITableWorkspaceProperty("OutDetPosTable", "", Direction.Output), doc="A table with the detector IDs and calibrated detector positions and " "additional calibration information. The table includes: the old positions " "in V3D format (3D vector with x, y, z values), the new positions in V3D, the " "new positions in spherical coordinates, the change in L2, and the DIFA, " "DIFC and TZERO calibration parameters.") self.declareProperty(ITableWorkspaceProperty("FittedPeaks", "", Direction.Output), doc="Information on fitted peaks. The table has one row per calibrated " "detector contains. In each row, the parameters of all the peaks fitted " "are specified together with the the expected peak value (in d-spacing). " "The expected values are given in the field labelled 'dSpacing'. When " "fitting back-to-back exponential functions, the 'X0' column has the fitted " "peak center.") self.declareProperty("Bank", '', StringListValidator(EnggUtils.ENGINX_BANKS), direction=Direction.Input, doc="Which bank to calibrate: It can be specified as 1 or 2, or " "equivalently, North or South. See also " + self.INDICES_PROP_NAME + " " "for a more flexible alternative to select specific detectors") self.declareProperty(self.INDICES_PROP_NAME, '', direction=Direction.Input, doc='Sets the spectrum numbers for the detectors ' 'that should be considered in the calibration (all others will be ' 'ignored). This option cannot be used together with Bank, as they overlap. ' 'You can give multiple ranges, for example: "0-99", or "0-9, 50-59, 100-109".') banks_grp = 'Banks / spectra' self.setPropertyGroup('Bank', banks_grp) self.setPropertyGroup(self.INDICES_PROP_NAME, banks_grp) self.declareProperty(FileProperty("OutDetPosFilename", "", FileAction.OptionalSave, [".csv"]), doc="Name of the file to save the pre-/post-calibrated detector positions - this " "saves the same information that is provided in the output table workspace " "(OutDetPosTable).") # The default value of '-0.0005' is borrowed from OG routines self.declareProperty('RebinBinWidth', defaultValue='-0.0005', direction=Direction.Input, doc="Before calculating the calibrated positions (fitting peaks) this algorithms " "re-bins the input sample data using a single bin width parameter. This option is" "to change the default bin width which is set to the value traditionally used for " "the Engin-X instrument") opt_outs_grp = 'Optional outputs' self.setPropertyGroup('OutDetPosFilename', opt_outs_grp) self.declareProperty(FloatArrayProperty("ExpectedPeaks", values=EnggUtils.default_ceria_expected_peaks(), direction=Direction.Input), doc="A list of dSpacing values where peaks are expected.") self.declareProperty(FileProperty(name="ExpectedPeaksFromFile",defaultValue="", action=FileAction.OptionalLoad,extensions = [".csv"]), doc="Load from file a list of dSpacing values to be translated into TOF to " "find expected peaks. This takes precedence over 'ExpectedPeaks' if both " "options are given.") peaks_grp = 'Peaks to fit' self.setPropertyGroup('ExpectedPeaks', peaks_grp) self.setPropertyGroup('ExpectedPeaksFromFile', peaks_grp)