예제 #1
0
    def function1D(self, xvals, **optparms):
        r""" Fourier transform of the symmetrized stretched exponential integrated
        within each energy bin.

        The Symmetrized Stretched Exponential:
                height * exp( - |t/tau|**beta )

        The Fourier Transform:
            F(E) \int_{-infty}^{infty} (dt/h) e^{-i2\pi Et/h} f(t)
            F(E) is normalized:
                \int_{-infty}^{infty} dE F(E) = 1

        Let P(E) be the primitive of F(E) from minus infinity to E, then for element i of
        xvals we compute:
            1. bin_boundaries[i] = (xvals[i]+xvals[i+1])/2
            3. P(bin_boundaries[i+1])- P(bin_boundaries[i])
        :param xvals: list of values where to evaluate the function
        :param optparms: alternate list of function parameters
        :return: P(bin_boundaries[i+1])- P(bin_boundaries[i]), the difference of the primitive
        """
        rf = 16
        parms, de, energies, fourier = function1Dcommon(self, xvals, rf=rf, **optparms)
        if parms is None:
            return fourier # return zeros if parameters not valid
        denergies = (energies[-1] - energies[0]) / (len(energies)-1)
        # Find bin boundaries
        boundaries = (xvals[1:]+xvals[:-1])/2  # internal bin boundaries
        boundaries = np.insert(boundaries, 0, 2*xvals[0]-boundaries[0])  # external lower boundary
        boundaries = np.append(boundaries, 2*xvals[-1]-boundaries[-1])  # external upper boundary
        primitive = np.cumsum(fourier) * (denergies/(rf*de))  # running Riemann sum
        transform = np.interp(boundaries[1:] - parms['Centre'], energies, primitive) - \
            np.interp(boundaries[:-1] - parms['Centre'], energies, primitive)
        return transform * parms['Height']
예제 #2
0
    def function1D(self, xvals, **optparms):
        """ Fourier transform of the Symmetrized Stretched Exponential

        The Symmetrized Stretched Exponential:
                height * exp( - |t/tau|**beta )

        The Fourier Transform:
            F(E) \int_{-infty}^{infty} (dt/h) e^{-i2\pi Et/h} f(t)
            F(E) is normalized:
                \int_{-infty}^{infty} dE F(E) = 1
        """
        parms, de, energies, fourier = function1Dcommon(self, xvals, **optparms)
        if parms is None:
            return fourier  #return zeros if parameters not valid
        transform = parms['Height'] * np.interp(xvals-parms['Centre'], energies, fourier)
        return transform
예제 #3
0
    def function1D(self, xvals, **optparms):
        """ Fourier transform of the Symmetrized Stretched Exponential

        The Symmetrized Stretched Exponential:
                height * exp( - |t/tau|**beta )

        The Fourier Transform:
            F(E) \int_{-infty}^{infty} (dt/h) e^{-i2\pi Et/h} f(t)
            F(E) is normalized:
                \int_{-infty}^{infty} dE F(E) = 1
        """
        parms, de, energies, fourier = function1Dcommon(self, xvals, **optparms)
        if parms is None:
            return fourier  #return zeros if parameters not valid
        transform = parms['Height'] * np.interp(xvals-parms['Centre'], energies, fourier)
        return transform
예제 #4
0
    def function1D(self, xvals, **optparms):
        """ Fourier transform of the symmetrized stretched exponential integrated
        within each energy bin.

        The Symmetrized Stretched Exponential:
                height * exp( - |t/tau|**beta )

        The Fourier Transform:
            F(E) \int_{-infty}^{infty} (dt/h) e^{-i2\pi Et/h} f(t)
            F(E) is normalized:
                \int_{-infty}^{infty} dE F(E) = 1

        Let P(E) be the primitive of F(E) from minus infinity to E, then for element i of
        xvals we compute:
            1. bin_boundaries[i] = (xvals[i]+xvals[i+1])/2
            3. P(bin_boundaries[i+1])- P(bin_boundaries[i])
        :param xvals: list of values where to evaluate the function
        :param optparms: alternate list of function parameters
        :return: P(bin_boundaries[i+1])- P(bin_boundaries[i]), the difference of the primitive
        """
        rf = 16
        parms, de, energies, fourier = function1Dcommon(self,
                                                        xvals,
                                                        rf=rf,
                                                        **optparms)
        if parms is None:
            return fourier  # return zeros if parameters not valid
        denergies = (energies[-1] - energies[0]) / (len(energies) - 1)
        # Find bin boundaries
        boundaries = (xvals[1:] + xvals[:-1]) / 2  # internal bin boundaries
        boundaries = np.insert(boundaries, 0, 2 * xvals[0] -
                               boundaries[0])  # external lower boundary
        boundaries = np.append(boundaries, 2 * xvals[-1] -
                               boundaries[-1])  # external upper boundary
        primitive = np.cumsum(fourier) * (denergies /
                                          (rf * de))  # running Riemann sum
        transform = np.interp(boundaries[1:] - parms['Centre'], energies, primitive) - \
            np.interp(boundaries[:-1] - parms['Centre'], energies, primitive)
        return transform * parms['Height']