Пример #1
0
def declare_rounding_property(o):
    '''
    Declares the properties needed for rounding.
    '''
    rounding = StringListValidator()
    rounding.addAllowedValue(ROUNDING_NONE)
    rounding.addAllowedValue(ROUNDING_TEN_TO_INT)
    o.declareProperty(name=PROP_NAME_ROUNDING_MODE,
                      defaultValue=ROUNDING_NONE, validator=rounding,
                      direction=Direction.Input, doc='Bin width rounding')
Пример #2
0
def declare_rounding_property(o):
    '''
    Declares the properties needed for rounding.
    '''
    rounding = StringListValidator()
    rounding.addAllowedValue(ROUNDING_NONE)
    rounding.addAllowedValue(ROUNDING_TEN_TO_INT)
    o.declareProperty(name=PROP_NAME_ROUNDING_MODE,
                      defaultValue=ROUNDING_NONE,
                      validator=rounding,
                      direction=Direction.Input,
                      doc='Bin width rounding')
Пример #3
0
 def PyInit(self):
     validator = StringListValidator()
     validator.addAllowedValue(self._allowed)
     self.declareProperty("Input", "", validator)
Пример #4
0
 def PyInit(self):
     validator = StringListValidator()
     validator.addAllowedValue(self._allowed)
     self.declareProperty("Input", "", validator)
Пример #5
0
    def PyInit(self):
        self.declareProperty(StringArrayProperty('InputWorkspace', direction=Direction.Input, validator=ADSValidator()),
                             doc="Input MD workspace (in Q-space) to use for peak finding")
        cell_type = StringListValidator()
        cell_type.addAllowedValue("Cubic")
        cell_type.addAllowedValue("Hexagonal")
        cell_type.addAllowedValue("Rhombohedral")
        cell_type.addAllowedValue("Tetragonal")
        cell_type.addAllowedValue("Orthorhombic")
        cell_type.addAllowedValue("Monoclinic")
        cell_type.addAllowedValue("Triclinic")
        self.declareProperty("CellType", "", cell_type, doc="Cell type to use for UB refining")

        centering_type = StringListValidator()
        centering_type.addAllowedValue("F")
        centering_type.addAllowedValue("I")
        centering_type.addAllowedValue("C")
        centering_type.addAllowedValue("P")
        centering_type.addAllowedValue("R")
        self.declareProperty("Centering", "P", centering_type, doc="Centering to use for selecting cells")

        # Some of the options to pass through to FindPeaksMD (options like CalculateGoniometerForCW, FlipX, etc are
        # assumed to be True)
        self.declareProperty("MaxPeaks", 1000, doc="Maximum number of peaks to find.")
        self.declareProperty("PeakDistanceThreshold", 0.25, doc="Threshold distance for rejecting peaks that are found "
                                                                "to be too close from each other")
        # Having this number too low will likely cause FindUBUsingFFT to fail since not enough peaks will be found
        self.declareProperty("DensityThresholdFactor", 2000.0,
                             doc="Scaling factor which the overall signal density will be multiplied by to determine "
                                 "a threshold for determining peaks.")

        self.declareProperty("Wavelength", FloatPropertyWithValue.EMPTY_DBL,
                             doc="Wavelength value to use only if one was not found in the sample log")

        # Lattice parameter validators from same as FindUBUsingLatticeParameters
        self.declareProperty("UseLattice", False, direction=Direction.Input,
                             doc="Whether to refine UB matrix based on given lattice parameters")

        self.declareProperty("LatticeA", FloatPropertyWithValue.EMPTY_DBL, doc="The a value of the lattice")
        self.declareProperty("LatticeB", FloatPropertyWithValue.EMPTY_DBL, doc="The b value of the lattice")
        self.declareProperty("LatticeC", FloatPropertyWithValue.EMPTY_DBL, doc="The c value of the lattice")
        self.declareProperty("LatticeAlpha", FloatPropertyWithValue.EMPTY_DBL, doc="The alpha value of the lattice")
        self.declareProperty("LatticeBeta", FloatPropertyWithValue.EMPTY_DBL, doc="The beta value of the lattice")
        self.declareProperty("LatticeGamma", FloatPropertyWithValue.EMPTY_DBL, doc="The gamma value of the lattice")

        self.declareProperty(WorkspaceProperty("OutputWorkspace", defaultValue="", direction=Direction.Output,
                                               optional=PropertyMode.Mandatory), doc="Output peaks workspace")

        lattice_params = ["LatticeA", "LatticeB", "LatticeC", "LatticeAlpha", "LatticeBeta", "LatticeGamma"]
        for param in lattice_params:
            self.setPropertyGroup(param, "Lattice Settings")
            self.setPropertySettings(param, EnabledWhenProperty("UseLattice", PropertyCriterion.IsNotDefault))
Пример #6
0
    def PyInit(self):
        self.declareProperty(
            StringArrayProperty("InputWorkspace",
                                direction=Direction.Input,
                                validator=ADSValidator()),
            doc="Input MDEvent workspace to use for integration")

        self.declareProperty(
            StringArrayProperty("PeaksWorkspace",
                                direction=Direction.Input,
                                validator=ADSValidator()),
            doc="Peaks workspace containing peaks to integrate")

        positive_val = FloatBoundedValidator(lower=0.0)
        self.declareProperty(
            "PeakRadius",
            defaultValue=1.0,
            validator=positive_val,
            doc="Fixed radius around each peak position in which to integrate"
            " (same units as input workspace) ")

        self.declareProperty(
            "BackgroundInnerRadius",
            defaultValue=0.0,
            validator=positive_val,
            doc="Inner radius used to evaluate the peak background")
        self.declareProperty(
            "BackgroundOuterRadius",
            defaultValue=0.0,
            validator=positive_val,
            doc="Outer radius used to evaluate the peak background")

        self.declareProperty(
            "ApplyLorentz",
            defaultValue=True,
            doc=
            "Whether the Lorentz correction should be applied to the integrated peaks"
        )

        self.declareProperty(
            "RemoveZeroIntensity",
            defaultValue=True,
            doc="If to remove peaks with 0 or less intensity from the output")

        formats = StringListValidator()
        formats.addAllowedValue("SHELX")
        formats.addAllowedValue("Fullprof")
        self.declareProperty(
            "OutputFormat",
            defaultValue="SHELX",
            validator=formats,
            doc="Save direction cosines in HKL, or the fullprof format")

        self.declareProperty(
            FileProperty(name="OutputFile",
                         defaultValue="",
                         direction=Direction.Input,
                         action=FileAction.OptionalSave),
            doc="Filepath to save the integrated peaks workspace in HKL format"
        )

        self.declareProperty(
            WorkspaceProperty("OutputWorkspace",
                              defaultValue="",
                              direction=Direction.Output,
                              optional=PropertyMode.Mandatory),
            doc=
            "Output peaks workspace (copy of input with updated peak intensities)"
        )