def __init__(self, name):
        """Define the generator.

        Note that a ProfileGenerator needs a name passed in the initializer.
        This makes it so the generator can be referenced by name when it is
        part of a FitContribution.

        Here we create the Parameters for the calculation.

        A       --  The amplitude
        x0      --  The center
        sigma   --  The width

        """
        # This initializes various parts of the generator
        ProfileGenerator.__init__(self, name)

        # Here we create new Parameters using the '_newParameter' method of
        # ProfileGenerator. The signature is
        # _newParameter(name, value).
        # See the API for full details.
        self._newParameter('A', 1.0)
        self._newParameter('x0', 0.0)
        self._newParameter('sigma', 1.0)
        return
Exemple #2
0
 def __init__(self, name):
     ProfileGenerator.__init__(self, name)
     self._newParameter("wavelength", 10.0)
     self._newParameter("center", 2.0)
     self._newParameter("cos_coef", .1)
     self._newParameter("sin_coef", .1)
     self._newParameter("left_std", 5.)
     self._newParameter("right_std", 5.0)
     return
Exemple #3
0
    def processMetaData(self):
        """Process the metadata once it gets set."""
        ProfileGenerator.processMetaData(self)

        for name in self.__class__._parnames:
            val = self.meta.get(name)
            if val is not None:
                par = self.get(name)
                par.setValue(val)
        return
Exemple #4
0
    def __init__(self, name):
        """Define our generator.

        In this example we will keep count of how many times the calculation
        gets performed. The 'count' attribute will be used to store the count.

        """
        ProfileGenerator.__init__(self, name)
        # Count the calls
        self.count = 0
        return
Exemple #5
0
    def __init__(self, name):
        """Define our generator.

        In this example we will keep count of how many times the calculation
        gets performed. The 'count' attribute will be used to store the count.

        """
        ProfileGenerator.__init__(self, name)
        # Count the calls
        self.count = 0
        return
    def __init__(self, name = "pdf"):
        """Initialize the generator."""
        ProfileGenerator.__init__(self, name)

        self._phase = None
        self.stru = None
        self.meta = {}
        self._lastr = None
        self._calc = None

        self._pool = None

        return
Exemple #7
0
    def __init__(self, name="pdf"):
        """Initialize the generator."""
        ProfileGenerator.__init__(self, name)

        self._phase = None
        self.stru = None
        self.meta = {}
        self._lastr = numpy.empty(0)
        self._calc = None

        self._pool = None

        return
Exemple #8
0
    def __init__(self, name="pdf"):
        """Initialize the generator."""
        ProfileGenerator.__init__(self, name)

        self._pdfprofile = None
        # self.xscale = 1.0
        # self.yscale = 1.0
        self.meta = {'xscale':1.0,
                     'yscale':1.0}
        self._lastr = None

        self._setCalculator()
        return
Exemple #9
0
    def _validate(self):
        """Validate my state.

        This validates that the phase is not None.
        This performs ProfileGenerator validations.

        Raises AttributeError if validation fails.
        
        """
        # FIXME
        if self._pdfprofile is None:
            raise AttributeError("_pdfprofile is None")
        ProfileGenerator._validate(self)
        return
Exemple #10
0
    def _validate(self):
        """Validate my state.

        This validates that the phase is not None.
        This performs ProfileGenerator validations.

        Raises SrFitError if validation fails.

        """
        if self._calc is None:
            raise SrFitError("_calc is None")
        if self._phase is None:
            raise SrFitError("_phase is None")
        ProfileGenerator._validate(self)
        return
    def _validate(self):
        """Validate my state.

        This validates that the phase is not None.
        This performs ProfileGenerator validations.

        Raises SrFitError if validation fails.

        """
        if self._calc is None:
            raise SrFitError("_calc is None")
        if self._phase is None:
            raise SrFitError("_phase is None")
        ProfileGenerator._validate(self)
        return
    def processMetaData(self):
        """Process the metadata once it gets set."""
        ProfileGenerator.processMetaData(self)

        stype = self.meta.get("stype")
        if stype is not None:
            self.setScatteringType(stype)

        qmax = self.meta.get("qmax")
        if qmax is not None:
            self.setQmax(qmax)

        qmin = self.meta.get("qmin")
        if qmin is not None:
            self.setQmin(qmin)

        for name in self.__class__._parnames:
            val = self.meta.get(name)
            if val is not None:
                par = self.get(name)
                par.setValue(val)

        return
Exemple #13
0
    def processMetaData(self):
        """Process the metadata once it gets set."""
        ProfileGenerator.processMetaData(self)

        stype = self.meta.get("stype")
        if stype is not None:
            self.setScatteringType(stype)

        qmax = self.meta.get("qmax")
        if qmax is not None:
            self.setQmax(qmax)

        qmin = self.meta.get("qmin")
        if qmin is not None:
            self.setQmin(qmin)

        for name in self.__class__._parnames:
            val = self.meta.get(name)
            if val is not None:
                par = self.get(name)
                par.setValue(val)

        return
    def __init__(self, name, model):
        """Initialize the generator.

        name    --  A name for the SASGenerator
        model   --  SASModel object this adapts.

        """
        ProfileGenerator.__init__(self, name)

        self._model = model

        # Wrap normal parameters
        for parname in model.params:
            par = SASParameter(parname, model)
            self.addParameter(par)

        # Wrap dispersion parameters
        for parname in model.dispersion:
            name = parname + "_width"
            parname += ".width"
            par = SASParameter(name, model, parname)
            self.addParameter(par)

        return
Exemple #15
0
    def __init__(self, name, model):
        """Initialize the generator.

        name    --  A name for the SASGenerator
        model   --  SASModel object this adapts.

        """
        ProfileGenerator.__init__(self, name)

        self._model = model

        # Wrap normal parameters
        for parname in model.params:
            par = SASParameter(parname, model)
            self.addParameter(par)

        # Wrap dispersion parameters
        for parname in model.dispersion:
            name = parname + "_width"
            parname += ".width"
            par = SASParameter(name, model, parname)
            self.addParameter(par)

        return
Exemple #16
0
 def __init__(self, name):
     ProfileGenerator.__init__(self, name)
     self._newParameter("wavelength", 20.0)
     self._newParameter("cos_coef", .1)
     self._newParameter("sin_coef", .1)
     return