コード例 #1
0
def i0_upper(incs=None, model_info=None):
    """Find the maximum peak intensity for the cluster.

    This is for the grid search upper bound for the I0 parameter.


    @keyword incs:          The number of grid search increments.
    @type incs:             int
    @keyword model_info:    The spin containers and the spin ID strings from the model_loop() specific API method.
    @type model_info:       list of SpinContainer instances, list of str
    @return:                The maximum peak intensity of all spins and time points.
    @rtype:                 float
    """

    # Alias.
    spin_ids = model_info

    # Find the maximum intensity.
    upper = 0.0
    for si in range(len(spin_ids)):
        spin = return_spin(spin_id=spin_ids[si])
        upper = max(upper, max(spin.peak_intensity.values()))

    # Multiply the value by 2.0 and then round up to the next order - this will be the upper bound.
    return round_to_next_order(upper * 2.0)
コード例 #2
0
ファイル: parameter_object.py プロジェクト: pombredanne/relax
def i0_upper(incs=None, model_info=None):
    """Find the maximum peak intensity for the cluster.

    This is for the grid search upper bound for the I0 parameter.


    @keyword incs:          The number of grid search increments.
    @type incs:             int
    @keyword model_info:    The spin containers and the spin ID strings from the model_loop() specific API method.
    @type model_info:       list of SpinContainer instances, list of str
    @return:                The maximum peak intensity of all spins and time points.
    @rtype:                 float
    """

    # Alias.
    spin_ids = model_info

    # Find the maximum intensity.
    upper = 0.0
    for si in range(len(spin_ids)):
        spin = return_spin(spin_ids[si])
        upper = max(upper, max(spin.peak_intensity.values()))

    # Multiply the value by 2.0 and then round up to the next order - this will be the upper bound.
    return round_to_next_order(upper * 2.0)
コード例 #3
0
ファイル: __init__.py プロジェクト: belisario21/relax_trunk
    def _assemble_scaling_matrix(self, spin=None, scaling=True):
        """Create and return the scaling matrix.

        @keyword spin:          The spin data container.
        @type spin:             SpinContainer instance
        @keyword scaling:       A flag which if false will cause the identity matrix to be returned.
        @type scaling:          bool
        @return:                The diagonal and square scaling matrix.
        @rtype:                 numpy diagonal matrix
        """

        # Initialise.
        scaling_matrix = identity(len(spin.params), float64)
        i = 0

        # No diagonal scaling.
        if not scaling:
            return scaling_matrix

        # Loop over the parameters.
        for i in range(len(spin.params)):
            # Relaxation rate.
            if spin.params[i] == 'rx':
                pass

            # Intensity scaling.
            elif search('^i', spin.params[i]):
                scaling_matrix[i, i] = round_to_next_order(max(spin.intensities.values()))

        # Return the scaling matrix.
        return scaling_matrix
コード例 #4
0
ファイル: parameter_object.py プロジェクト: tlinnet/relax
def iinf_upper(incs=None, model_info=None):
    """Find the average intensity of the last time point.

    This is for the grid search upper bound for the Iinf parameter.


    @keyword incs:          The number of grid search increments.
    @type incs:             int
    @keyword model_info:    The spin container and the spin ID string from the _model_loop_spin() specific API method.
    @type model_info:       SpinContainer instance, str
    @return:                The average peak intensity of the last time point.
    @rtype:                 float
    """

    # Unpack the data.
    spin, spin_id = model_info

    # Find the ID of the last time point.
    max_time = max(cdp.relax_times.values())
    for key in cdp.relax_times:
        if cdp.relax_times[key] == max_time:
            id = key
            break

    # The averaged value.
    upper = average(spin.peak_intensity[id])

    # Multiply the value by 2.0 and then round up to the next order - this will be the upper bound.
    return round_to_next_order(upper * 2.0)
コード例 #5
0
ファイル: parameter_object.py プロジェクト: tlinnet/relax
def i_scaling(model_info=None):
    """Determine the scaling factor for the peak intensities.

    This is for the scaling of the I0 and Iinf parameters during optimisation.  The maximum intensity will be used to scale all values.


    @keyword model_info:    The spin container and the spin ID string from the _model_loop_spin() specific API method.
    @type model_info:       SpinContainer instance, str
    @return:                The average peak intensity of the first time point.
    @rtype:                 float
    """

    # Unpack the data.
    spin, spin_id = model_info

    # The scaling factor as the maximum intensity.
    return round_to_next_order(max(spin.peak_intensity.values()))
コード例 #6
0
ファイル: parameter_object.py プロジェクト: tlinnet/relax
def i0_upper(incs=None, model_info=None):
    """Find the upper bound for the I0 parameter.

    @keyword incs:          The number of grid search increments.
    @type incs:             int
    @keyword model_info:    The spin container and the spin ID string from the _model_loop_spin() specific API method.
    @type model_info:       SpinContainer instance, str
    @return:                The average peak intensity of the first time point.
    @rtype:                 float
    """

    # Unpack the data.
    spin, spin_id = model_info

    # Find the maximum intensity.
    upper = max(spin.peak_intensity.values())

    # Multiply the value by 2.0 and then round up to the next order - this will be the upper bound.
    return round_to_next_order(upper * 2.0)
コード例 #7
0
ファイル: test_mathematics.py プロジェクト: tlinnet/relax
    def test_round_to_next_order4(self):
        """4th test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(1234), 10000.0)
コード例 #8
0
ファイル: test_mathematics.py プロジェクト: tlinnet/relax
    def test_round_to_next_order2(self):
        """2nd test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(12), 100.0)
コード例 #9
0
ファイル: test_mathematics.py プロジェクト: tlinnet/relax
    def test_round_to_next_order1(self):
        """1st test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(1.1), 10.0)
コード例 #10
0
ファイル: test_mathematics.py プロジェクト: tlinnet/relax
    def test_round_to_next_order0(self):
        """0th test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(0.123), 1.0)
コード例 #11
0
    def test_round_to_next_order4(self):
        """4th test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(1234), 10000.0)
コード例 #12
0
    def test_round_to_next_order2(self):
        """2nd test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(12), 100.0)
コード例 #13
0
    def test_round_to_next_order1(self):
        """1st test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(1.1), 10.0)
コード例 #14
0
    def test_round_to_next_order0(self):
        """0th test of the lib.mathematics.round_to_next_order function."""

        self.assertEqual(round_to_next_order(0.123), 1.0)