コード例 #1
0
ファイル: staj.py プロジェクト: agreen991/refl1d
    def fit_FWHMresolution(self, Q, dQ, weight=1):
        A = numpy.array([abs(Q)/self.wavelength,
                         numpy.ones_like(Q)*(4*pi/self.wavelength)])
        s = wsolve(A,y=dQ,dy=weight)
        self.wavelength_dispersion = s.x[0]
        self.angular_divergence = s.x[1]

        return self
コード例 #2
0
ファイル: staj.py プロジェクト: usnistgov/refl1d
    def fit_FWHMresolution(self, Q, dQ, weight=1):
        A = numpy.array([
            abs(Q) / self.wavelength,
            numpy.ones_like(Q) * (4 * pi / self.wavelength)
        ])
        s = wsolve(A, y=dQ, dy=weight)
        self.wavelength_dispersion = s.x[0]
        self.angular_divergence = s.x[1]

        return self
コード例 #3
0
ファイル: staj.py プロジェクト: usnistgov/refl1d
    def fit_FWHMresolution(self, Q, dQ, weight=1):
        r"""
        Choose the best dL and dT to match the resolution dQ.

        Given that mlayer uses the following resolution function:

        .. math::

            \Delta Q_k = (|Q_k| \Delta\lambda + 4 \pi \Delta\theta)/\lambda_k

        we can use a linear system solver to find the optimal
        $\Delta \lambda$ and $\Delta \theta$ across our dataset from the
        over-determined system:

        .. math::

          [|Q_k|/\lambda_k, 4\pi/\lambda_k][\Delta\lambda, \Delta\theta]^T
              = \Delta Q_k

        If weights are provided (e.g., $\Delta R_k/R_k$), then weigh each
        point during the fit.

        Given that the experiment is often run with fixed slits at the
        start and end, you may choose to match the resolution across the
        entire $Q$ range, or instead restrict it to just the region where
        the slits are opening.  You will generally want to get the resolution
        correct at the critical edge since that's where it will have the
        largest effect on the fit.

        Returns the object so that operations can be chained.
        """
        A = numpy.array([
            abs(Q) / self.wavelength,
            numpy.ones_like(Q) * (4 * pi / self.wavelength)
        ]).T
        s = wsolve(A, y=dQ, dy=weight)
        self.wavelength_dispersion = s.x[0]
        self.angular_divergence = s.x[1]

        return self
コード例 #4
0
ファイル: staj.py プロジェクト: agreen991/refl1d
    def fit_FWHMresolution(self, Q, dQ, weight=1):
        r"""
        Choose the best dL and dT to match the resolution dQ.

        Given that mlayer uses the following resolution function:

        .. math::

            \Delta Q_k = (|Q_k| \Delta\lambda + 4 \pi \Delta\theta)/\lambda_k

        we can use a linear system solver to find the optimal
        $\Delta \lambda$ and $\Delta \theta$ across our dataset from the
        over-determined system:

        .. math::

          [|Q_k|/\lambda_k, 4\pi/\lambda_k][\Delta\lambda, \Delta\theta]^T
              = \Delta Q_k

        If weights are provided (e.g., $\Delta R_k/R_k$), then weigh each
        point during the fit.

        Given that the experiment is often run with fixed slits at the
        start and end, you may choose to match the resolution across the
        entire $Q$ range, or instead restrict it to just the region where
        the slits are opening.  You will generally want to get the resolution
        correct at the critical edge since that's where it will have the
        largest effect on the fit.

        Returns the object so that operations can be chained.
        """
        A = numpy.array([abs(Q)/self.wavelength,
                         numpy.ones_like(Q)*(4*pi/self.wavelength)]).T
        s = wsolve(A,y=dQ,dy=weight)
        self.wavelength_dispersion = s.x[0]
        self.angular_divergence = s.x[1]

        return self